GlobalVariable *GVar = dyn_cast<GlobalVariable>(GV);
bool isThreadLocal = GVar && GVar->isThreadLocal();
- if (!isMemOp && !isCallOp && !isThreadLocal) O << '$';
+ if (!isMemOp && !isCallOp) O << '$';
std::string Name = Mang->getValueName(GV);
X86SharedAsmPrinter::decorateName(Name, GV);
GA->getValueType(0),
GA->getOffset());
SDOperand Offset = DAG.getNode(X86ISD::Wrapper, PtrVT, TGA);
+
+ if (GA->getGlobal()->isDeclaration()) // initial exec TLS model
+ Offset = DAG.getLoad(PtrVT, DAG.getEntryNode(), Offset, NULL, 0);
+
// The address of the thread local variable is the add of the thread
// pointer with the offset of the variable.
return DAG.getNode(ISD::ADD, PtrVT, ThreadPointer, Offset);
//
def TLS_addr : I<0, Pseudo, (ops GR32:$dst, i32imm:$sym),
- "leal $sym(,%ebx,1), $dst",
+ "leal ${sym:mem}(,%ebx,1), $dst",
[(set GR32:$dst, (X86tlsaddr tglobaltlsaddr:$sym))]>,
Imp<[EBX],[]>;
+let AddedComplexity = 10 in
+def TLS_gs : I<0, Pseudo, (ops GR32:$dst, GR32:$src),
+ "movl %gs:($src), $dst",
+ [(set GR32:$dst, (load (add X86TLStp, GR32:$src)))]>;
+
def TLS_tp : I<0, Pseudo, (ops GR32:$dst),
"movl %gs:0, $dst",
[(set GR32:$dst, X86TLStp)]>;