[llvm-commits] [llvm] r74246 - in /llvm/trunk/lib/Target/X86: X86ISelLowering.cpp X86InstrInfo.h
Chris Lattner
sabre at nondot.org
Thu Jun 25 17:43:53 PDT 2009
Author: lattner
Date: Thu Jun 25 19:43:52 2009
New Revision: 74246
URL: http://llvm.org/viewvc/llvm-project?rev=74246&view=rev
Log:
start adding logic in isel to determine asm printer semantics, step N of M.
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/lib/Target/X86/X86InstrInfo.h
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=74246&r1=74245&r2=74246&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Thu Jun 25 19:43:52 2009
@@ -4507,14 +4507,25 @@
SDValue X86TargetLowering::LowerJumpTable(SDValue Op, SelectionDAG &DAG) {
JumpTableSDNode *JT = cast<JumpTableSDNode>(Op);
- // FIXME there isn't really any debug into here
- DebugLoc dl = JT->getDebugLoc();
- SDValue Result = DAG.getTargetJumpTable(JT->getIndex(), getPointerTy());
- Result = DAG.getNode(X86ISD::Wrapper, dl, getPointerTy(), Result);
+
+ // In PIC mode (unless we're in RIPRel PIC mode) we add an offset to the
+ // global base reg.
+ unsigned char JTFlag = 0;
+ if (getTargetMachine().getRelocationModel() == Reloc::PIC_) {
+ if (Subtarget->isPICStyleStub())
+ JTFlag = X86II::MO_PIC_BASE_OFFSET;
+ else if (Subtarget->isPICStyleGOT())
+ JTFlag = X86II::MO_GOTOFF;
+ }
+
+ SDValue Result = DAG.getTargetJumpTable(JT->getIndex(), getPointerTy(),
+ JTFlag);
+ DebugLoc DL = JT->getDebugLoc();
+ Result = DAG.getNode(X86ISD::Wrapper, DL, getPointerTy(), Result);
+
// With PIC, the address is actually $g + Offset.
- if (getTargetMachine().getRelocationModel() == Reloc::PIC_ &&
- !Subtarget->isPICStyleRIPRel()) {
- Result = DAG.getNode(ISD::ADD, dl, getPointerTy(),
+ if (JTFlag) {
+ Result = DAG.getNode(ISD::ADD, DL, getPointerTy(),
DAG.getNode(X86ISD::GlobalBaseReg,
DebugLoc::getUnknownLoc(),
getPointerTy()),
Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.h?rev=74246&r1=74245&r2=74246&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.h (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.h Thu Jun 25 19:43:52 2009
@@ -77,9 +77,19 @@
/// MO_GOT_ABSOLUTE_ADDRESS - On a symbol operand, this represents a
/// relocation of:
- /// $SYMBOL_LABEL + [. - PICBASELABEL]
+ /// SYMBOL_LABEL + [. - PICBASELABEL]
MO_GOT_ABSOLUTE_ADDRESS = 1,
+ /// MO_PIC_BASE_OFFSET - On a symbol operand this indicates that the
+ /// immediate should get the value of the symbol minus the PIC base label:
+ /// SYMBOL_LABEL - PICBASELABEL
+ MO_PIC_BASE_OFFSET = 2,
+
+ /// MO_GOTOFF - On a symbol operand this indicates that the immediate should
+ /// the offset to the location of the symbol name from the base of the GOT.
+ /// SYMBOL_LABEL @GOTOFF
+ MO_GOTOFF = 3,
+
//===------------------------------------------------------------------===//
// Instruction encodings. These are the standard/most common forms for X86
More information about the llvm-commits
mailing list