Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
swiftshader
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
swiftshader
Commits
420e8bf2
Commit
420e8bf2
authored
Aug 26, 2014
by
Jim Stichnoth
Committed by
Derek Schuff
Aug 26, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
COmmit
Patch from Jim Stichnoth <stichnot@chromium.org>.
parent
4d79fe5b
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
6 deletions
+38
-6
IceCfg.cpp
src/IceCfg.cpp
+1
-1
IceClFlags.h
src/IceClFlags.h
+2
-1
IceTargetLoweringX8632.cpp
src/IceTargetLoweringX8632.cpp
+8
-1
llvm2ice.cpp
src/llvm2ice.cpp
+2
-0
nacl-other-intrinsics.ll
tests_lit/llvm2ice_tests/nacl-other-intrinsics.ll
+25
-3
No files found.
src/IceCfg.cpp
View file @
420e8bf2
...
@@ -309,7 +309,7 @@ void Cfg::emit() {
...
@@ -309,7 +309,7 @@ void Cfg::emit() {
Str
<<
"
\t
.text
\n
"
;
Str
<<
"
\t
.text
\n
"
;
IceString
MangledName
=
getContext
()
->
mangleName
(
getFunctionName
());
IceString
MangledName
=
getContext
()
->
mangleName
(
getFunctionName
());
if
(
Ctx
->
getFlags
().
FunctionSections
)
if
(
Ctx
->
getFlags
().
FunctionSections
)
Str
<<
"
\t
.section
\t
.text."
<<
MangledName
<<
"
\n
"
;
Str
<<
"
\t
.section
\t
.text."
<<
MangledName
<<
"
,
\"
ax
\"
,@progbits
\n
"
;
if
(
!
getInternal
())
{
if
(
!
getInternal
())
{
Str
<<
"
\t
.globl
\t
"
<<
MangledName
<<
"
\n
"
;
Str
<<
"
\t
.globl
\t
"
<<
MangledName
<<
"
\n
"
;
Str
<<
"
\t
.type
\t
"
<<
MangledName
<<
",@function
\n
"
;
Str
<<
"
\t
.type
\t
"
<<
MangledName
<<
",@function
\n
"
;
...
...
src/IceClFlags.h
View file @
420e8bf2
...
@@ -21,12 +21,13 @@ public:
...
@@ -21,12 +21,13 @@ public:
ClFlags
()
ClFlags
()
:
DisableInternal
(
false
),
SubzeroTimingEnabled
(
false
),
:
DisableInternal
(
false
),
SubzeroTimingEnabled
(
false
),
DisableTranslation
(
false
),
DisableGlobals
(
false
),
DisableTranslation
(
false
),
DisableGlobals
(
false
),
FunctionSections
(
false
)
{}
FunctionSections
(
false
)
,
UseSandboxing
(
false
)
{}
bool
DisableInternal
;
bool
DisableInternal
;
bool
SubzeroTimingEnabled
;
bool
SubzeroTimingEnabled
;
bool
DisableTranslation
;
bool
DisableTranslation
;
bool
DisableGlobals
;
bool
DisableGlobals
;
bool
FunctionSections
;
bool
FunctionSections
;
bool
UseSandboxing
;
};
};
}
// end of namespace Ice
}
// end of namespace Ice
...
...
src/IceTargetLoweringX8632.cpp
View file @
420e8bf2
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
#include "IceDefs.h"
#include "IceDefs.h"
#include "IceCfg.h"
#include "IceCfg.h"
#include "IceCfgNode.h"
#include "IceCfgNode.h"
#include "IceClFlags.h"
#include "IceInstX8632.h"
#include "IceInstX8632.h"
#include "IceOperand.h"
#include "IceOperand.h"
#include "IceTargetLoweringX8632.def"
#include "IceTargetLoweringX8632.def"
...
@@ -3052,13 +3053,19 @@ void TargetX8632::lowerIntrinsicCall(const InstIntrinsicCall *Instr) {
...
@@ -3052,13 +3053,19 @@ void TargetX8632::lowerIntrinsicCall(const InstIntrinsicCall *Instr) {
return
;
return
;
}
}
case
Intrinsics
:
:
NaClReadTP
:
{
case
Intrinsics
:
:
NaClReadTP
:
{
if
(
Ctx
->
getFlags
().
UseSandboxing
)
{
Constant
*
Zero
=
Ctx
->
getConstantZero
(
IceType_i32
);
Constant
*
Zero
=
Ctx
->
getConstantZero
(
IceType_i32
);
Operand
*
Src
=
OperandX8632Mem
::
create
(
Func
,
IceType_i32
,
NULL
,
Zero
,
NULL
,
Operand
*
Src
=
OperandX8632Mem
::
create
(
Func
,
IceType_i32
,
NULL
,
Zero
,
NULL
,
0
,
OperandX8632Mem
::
SegReg_GS
);
0
,
OperandX8632Mem
::
SegReg_GS
);
Variable
*
Dest
=
Instr
->
getDest
();
Variable
*
Dest
=
Instr
->
getDest
();
Variable
*
T
=
NULL
;
Variable
*
T
=
NULL
;
_mov
(
T
,
Src
);
_mov
(
T
,
Src
);
_mov
(
Dest
,
T
);
_mov
(
Dest
,
T
);
}
else
{
InstCall
*
Call
=
makeHelperCall
(
"__nacl_read_tp"
,
Instr
->
getDest
(),
0
);
lowerCall
(
Call
);
}
return
;
return
;
}
}
case
Intrinsics
:
:
Setjmp
:
{
case
Intrinsics
:
:
Setjmp
:
{
...
...
src/llvm2ice.cpp
View file @
420e8bf2
...
@@ -59,6 +59,7 @@ static cl::opt<Ice::TargetArch> TargetArch(
...
@@ -59,6 +59,7 @@ static cl::opt<Ice::TargetArch> TargetArch(
clEnumValN
(
Ice
::
Target_ARM32
,
"arm"
,
"arm32"
),
clEnumValN
(
Ice
::
Target_ARM32
,
"arm"
,
"arm32"
),
clEnumValN
(
Ice
::
Target_ARM32
,
"arm32"
,
"arm32 (same as arm)"
),
clEnumValN
(
Ice
::
Target_ARM32
,
"arm32"
,
"arm32 (same as arm)"
),
clEnumValN
(
Ice
::
Target_ARM64
,
"arm64"
,
"arm64"
),
clEnumValEnd
));
clEnumValN
(
Ice
::
Target_ARM64
,
"arm64"
,
"arm64"
),
clEnumValEnd
));
static
cl
::
opt
<
bool
>
UseSandboxing
(
"sandbox"
,
cl
::
desc
(
"Use sandboxing"
));
static
cl
::
opt
<
bool
>
static
cl
::
opt
<
bool
>
FunctionSections
(
"ffunction-sections"
,
FunctionSections
(
"ffunction-sections"
,
cl
::
desc
(
"Emit functions into separate sections"
));
cl
::
desc
(
"Emit functions into separate sections"
));
...
@@ -135,6 +136,7 @@ int main(int argc, char **argv) {
...
@@ -135,6 +136,7 @@ int main(int argc, char **argv) {
Flags
.
DisableTranslation
=
DisableTranslation
;
Flags
.
DisableTranslation
=
DisableTranslation
;
Flags
.
DisableGlobals
=
DisableGlobals
;
Flags
.
DisableGlobals
=
DisableGlobals
;
Flags
.
FunctionSections
=
FunctionSections
;
Flags
.
FunctionSections
=
FunctionSections
;
Flags
.
UseSandboxing
=
UseSandboxing
;
Ice
::
GlobalContext
Ctx
(
Ls
,
Os
,
VMask
,
TargetArch
,
OptLevel
,
TestPrefix
,
Ice
::
GlobalContext
Ctx
(
Ls
,
Os
,
VMask
,
TargetArch
,
OptLevel
,
TestPrefix
,
Flags
);
Flags
);
...
...
tests_lit/llvm2ice_tests/nacl-other-intrinsics.ll
View file @
420e8bf2
; This tests the NaCl intrinsics not related to atomic operations.
; This tests the NaCl intrinsics not related to atomic operations.
; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s
; RUN: %llvm2ice -O2 --verbose none
-sandbox
%s | FileCheck %s
; RUN: %llvm2ice -Om1 --verbose none %s | FileCheck %s
; RUN: %llvm2ice -Om1 --verbose none
-sandbox
%s | FileCheck %s
; Do another run w/ O2 and a different check-prefix (otherwise O2 and Om1
; Do another run w/ O2 and a different check-prefix (otherwise O2 and Om1
; share the same "CHECK" prefix). This separate run helps check that
; share the same "CHECK" prefix). This separate run helps check that
; some code is optimized out.
; some code is optimized out.
; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s --check-prefix=CHECKO2REM
; RUN: %llvm2ice -O2 --verbose none -sandbox %s \
; RUN: | FileCheck %s --check-prefix=CHECKO2REM
; Do O2 runs without -sandbox to make sure llvm.nacl.read.tp gets
; lowered to __nacl_read_tp instead of gs:[0x0].
; RUN: %llvm2ice -O2 --verbose none %s \
; RUN: | FileCheck --check-prefix=CHECKO2UNSANDBOXED %s
; RUN: %llvm2ice -O2 --verbose none %s \
; RUN: | FileCheck --check-prefix=CHECKO2UNSANDBOXEDREM %s
; RUN: %llvm2ice -O2 --verbose none %s \
; RUN: %llvm2ice -O2 --verbose none %s \
; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj
; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj
...
@@ -48,6 +56,10 @@ entry:
...
@@ -48,6 +56,10 @@ entry:
; CHECK: mov e{{.*}}, dword ptr gs:[0]
; CHECK: mov e{{.*}}, dword ptr gs:[0]
; CHECKO2REM-LABEL: test_nacl_read_tp
; CHECKO2REM-LABEL: test_nacl_read_tp
; CHECKO2REM: mov e{{.*}}, dword ptr gs:[0]
; CHECKO2REM: mov e{{.*}}, dword ptr gs:[0]
; CHECKO2UNSANDBOXED-LABEL: test_nacl_read_tp
; CHECKO2UNSANDBOXED: call __nacl_read_tp
; CHECKO2UNSANDBOXEDREM-LABEL: test_nacl_read_tp
; CHECKO2UNSANDBOXEDREM: call __nacl_read_tp
define
i32
@test_nacl_read_tp_more_addressing
()
{
define
i32
@test_nacl_read_tp_more_addressing
()
{
entry:
entry:
...
@@ -69,6 +81,12 @@ entry:
...
@@ -69,6 +81,12 @@ entry:
; CHECKO2REM-LABEL: test_nacl_read_tp_more_addressing
; CHECKO2REM-LABEL: test_nacl_read_tp_more_addressing
; CHECKO2REM: mov e{{.*}}, dword ptr gs:[0]
; CHECKO2REM: mov e{{.*}}, dword ptr gs:[0]
; CHECKO2REM: mov e{{.*}}, dword ptr gs:[0]
; CHECKO2REM: mov e{{.*}}, dword ptr gs:[0]
; CHECKO2UNSANDBOXED-LABEL: test_nacl_read_tp_more_addressing
; CHECKO2UNSANDBOXED: call __nacl_read_tp
; CHECKO2UNSANDBOXED: call __nacl_read_tp
; CHECKO2UNSANDBOXEDREM-LABEL: test_nacl_read_tp_more_addressing
; CHECKO2UNSANDBOXEDREM: call __nacl_read_tp
; CHECKO2UNSANDBOXEDREM: call __nacl_read_tp
define
i32
@test_nacl_read_tp_dead
(
i32
%a
)
{
define
i32
@test_nacl_read_tp_dead
(
i32
%a
)
{
entry:
entry:
...
@@ -80,6 +98,8 @@ entry:
...
@@ -80,6 +98,8 @@ entry:
; Consider nacl.read.tp side-effect free, so it can be eliminated.
; Consider nacl.read.tp side-effect free, so it can be eliminated.
; CHECKO2REM-LABEL: test_nacl_read_tp_dead
; CHECKO2REM-LABEL: test_nacl_read_tp_dead
; CHECKO2REM-NOT: mov e{{.*}}, dword ptr gs:[0]
; CHECKO2REM-NOT: mov e{{.*}}, dword ptr gs:[0]
; CHECKO2UNSANDBOXEDREM-LABEL: test_nacl_read_tp_dead
; CHECKO2UNSANDBOXEDREM-NOT: call __nacl_read_tp
define
void
@test_memcpy
(
i32
%iptr_dst
,
i32
%iptr_src
,
i32
%len
)
{
define
void
@test_memcpy
(
i32
%iptr_dst
,
i32
%iptr_src
,
i32
%len
)
{
entry:
entry:
...
@@ -91,6 +111,8 @@ entry:
...
@@ -91,6 +111,8 @@ entry:
}
}
; CHECK-LABEL: test_memcpy
; CHECK-LABEL: test_memcpy
; CHECK: call memcpy
; CHECK: call memcpy
; CHECKO2REM-LABEL: test_memcpy
; CHECKO2UNSANDBOXEDREM-LABEL: test_memcpy
; TODO(jvoung) -- if we want to be clever, we can do this and the memmove,
; TODO(jvoung) -- if we want to be clever, we can do this and the memmove,
; memset without a function call.
; memset without a function call.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment