Index: lib/Target/X86/X86InstrCompiler.td |
diff --git a/lib/Target/X86/X86InstrCompiler.td b/lib/Target/X86/X86InstrCompiler.td |
index f7882d4133e408ac5545eb268b113c3900f3f4b9..52ba81ff204ccdbe931d8fa1da6d617504e22bdb 100644 |
--- a/lib/Target/X86/X86InstrCompiler.td |
+++ b/lib/Target/X86/X86InstrCompiler.td |
@@ -93,8 +93,8 @@ def VAARG_64 : I<0, Pseudo, |
"#VAARG_64 $dst, $ap, $size, $mode, $align", |
[(set GR64:$dst, |
(X86vaarg64 addr:$ap, imm:$size, imm:$mode, imm:$align)), |
- (implicit EFLAGS)]>; |
- |
+ (implicit EFLAGS)]>, |
+ Requires<[IsNotNaCl]>; |
// Dynamic stack allocation yields a _chkstk or _alloca call for all Windows |
// targets. These calls are needed to probe the stack when allocating more than |
// 4k bytes in one go. Touching the stack at 4K increments is necessary to |
@@ -445,6 +445,16 @@ def TLS_base_addr64 : I<0, Pseudo, (outs), (ins i64mem:$sym), |
Requires<[In64BitMode]>; |
} |
+// @LOCALMOD-BEGIN |
+// NaCl TLS support |
+let usesCustomInserter = 1 in { |
+ def THREAD_POINTER_FROM_GS : |
+ I<0, Pseudo, (outs GR32:$dst), (ins), |
+ "# get thread pointer from %gs:0", |
+ [(set GR32:$dst, (X86thread_pointer_from_gs))]>; |
+} |
+// @LOCALMOD-END |
+ |
// Darwin TLS Support |
// For i386, the address of the thunk is passed on the stack, on return the |
// address of the variable is in %eax. %ecx is trashed during the function |
@@ -1024,9 +1034,9 @@ def : Pat<(add GR64:$src1, (X86Wrapper tglobaltlsaddr :$dst)), |
// Direct PC relative function call for small code model. 32-bit displacement |
// sign extended to 64-bit. |
def : Pat<(X86call (i64 tglobaladdr:$dst)), |
- (CALL64pcrel32 tglobaladdr:$dst)>; |
+ (CALL64pcrel32 tglobaladdr:$dst)>, Requires<[IsNotNaCl]>; |
def : Pat<(X86call (i64 texternalsym:$dst)), |
- (CALL64pcrel32 texternalsym:$dst)>; |
+ (CALL64pcrel32 texternalsym:$dst)>, Requires<[IsNotNaCl]>; |
// Tailcall stuff. The TCRETURN instructions execute after the epilog, so they |
// can never use callee-saved registers. That is the purpose of the GR64_TC |
@@ -1055,7 +1065,7 @@ def : Pat<(X86tcret ptr_rc_tailcall:$dst, imm:$off), |
// callee-saved register. |
def : Pat<(X86tcret (load addr:$dst), imm:$off), |
(TCRETURNmi addr:$dst, imm:$off)>, |
- Requires<[Not64BitMode, IsNotPIC]>; |
+ Requires<[Not64BitMode, IsNotPIC, IsNotNaCl]>; // @LOCALMOD |
def : Pat<(X86tcret (i32 tglobaladdr:$dst), imm:$off), |
(TCRETURNdi texternalsym:$dst, imm:$off)>, |
@@ -1073,15 +1083,15 @@ def : Pat<(X86tcret ptr_rc_tailcall:$dst, imm:$off), |
// There wouldn't be enough scratch registers for base+index. |
def : Pat<(X86tcret_6regs (load addr:$dst), imm:$off), |
(TCRETURNmi64 addr:$dst, imm:$off)>, |
- Requires<[In64BitMode]>; |
+ Requires<[In64BitMode, IsNotNaCl]>; |
def : Pat<(X86tcret (i64 tglobaladdr:$dst), imm:$off), |
(TCRETURNdi64 tglobaladdr:$dst, imm:$off)>, |
- Requires<[In64BitMode]>; |
+ Requires<[In64BitMode, IsNotNaCl]>; |
def : Pat<(X86tcret (i64 texternalsym:$dst), imm:$off), |
(TCRETURNdi64 texternalsym:$dst, imm:$off)>, |
- Requires<[In64BitMode]>; |
+ Requires<[In64BitMode, IsNotNaCl]>; |
// Normal calls, with various flavors of addresses. |
def : Pat<(X86call (i32 tglobaladdr:$dst)), |
@@ -1529,19 +1539,19 @@ def : Pat<(store (i8 (trunc_su (srl_su GR64:$src, (i8 8)))), addr:$dst), |
(MOV8mr_NOREX |
addr:$dst, |
(EXTRACT_SUBREG (i64 (COPY_TO_REGCLASS GR64:$src, GR64_ABCD)), |
- sub_8bit_hi))>; |
+ sub_8bit_hi))>, Requires<[IsNotNaCl]>; // @LOCALMOD |
def : Pat<(store (i8 (trunc_su (srl_su GR32:$src, (i8 8)))), addr:$dst), |
(MOV8mr_NOREX |
addr:$dst, |
(EXTRACT_SUBREG (i32 (COPY_TO_REGCLASS GR32:$src, GR32_ABCD)), |
sub_8bit_hi))>, |
- Requires<[In64BitMode]>; |
+ Requires<[In64BitMode, IsNotNaCl]>; // @LOCALMOD |
def : Pat<(store (i8 (trunc_su (srl_su GR16:$src, (i8 8)))), addr:$dst), |
(MOV8mr_NOREX |
addr:$dst, |
(EXTRACT_SUBREG (i16 (COPY_TO_REGCLASS GR16:$src, GR16_ABCD)), |
sub_8bit_hi))>, |
- Requires<[In64BitMode]>; |
+ Requires<[In64BitMode, IsNotNaCl]>; // @LOCALMOD |
// (shl x, 1) ==> (add x, x) |