[PATCH] D16474: Use PC-relative address for x32 TLS address
H.J Lu via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 22 12:27:02 PST 2016
hjl.tools updated the summary for this revision.
hjl.tools updated this revision to Diff 45727.
hjl.tools added a comment.
Use Subtarget->is32Bit()) instead. The full function now is:
/// This is only run on TargetGlobalTLSAddress nodes.
bool X86DAGToDAGISel::selectTLSADDRAddr(SDValue N, SDValue &Base,
SDValue &Scale, SDValue &Index,
SDValue &Disp, SDValue &Segment) {
assert(N.getOpcode() == ISD::TargetGlobalTLSAddress);
const GlobalAddressSDNode *GA = cast<GlobalAddressSDNode>(N);
X86ISelAddressMode AM;
AM.GV = GA->getGlobal();
AM.Disp += GA->getOffset();
AM.Base_Reg = CurDAG->getRegister(0, N.getValueType());
AM.SymbolFlags = GA->getTargetFlags();
if (Subtarget->is32Bit()) {
AM.Scale = 1;
AM.IndexReg = CurDAG->getRegister(X86::EBX, MVT::i32);
} else {
AM.IndexReg = CurDAG->getRegister(0, N.getValueType());
}
getAddressOperands(AM, SDLoc(N), Base, Scale, Index, Disp, Segment);
return true;
}
http://reviews.llvm.org/D16474
Files:
lib/Target/X86/X86ISelDAGToDAG.cpp
Index: lib/Target/X86/X86ISelDAGToDAG.cpp
===================================================================
--- lib/Target/X86/X86ISelDAGToDAG.cpp
+++ lib/Target/X86/X86ISelDAGToDAG.cpp
@@ -1679,11 +1679,11 @@
AM.Base_Reg = CurDAG->getRegister(0, N.getValueType());
AM.SymbolFlags = GA->getTargetFlags();
- if (N.getValueType() == MVT::i32) {
+ if (Subtarget->is32Bit()) {
AM.Scale = 1;
AM.IndexReg = CurDAG->getRegister(X86::EBX, MVT::i32);
} else {
- AM.IndexReg = CurDAG->getRegister(0, MVT::i64);
+ AM.IndexReg = CurDAG->getRegister(0, N.getValueType());
}
getAddressOperands(AM, SDLoc(N), Base, Scale, Index, Disp, Segment);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16474.45727.patch
Type: text/x-patch
Size: 669 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160122/ca51b9b7/attachment.bin>
More information about the llvm-commits
mailing list