[llvm-branch-commits] [llvm-branch] r89515 - in /llvm/branches/Apple/Zoidberg: include/llvm/CodeGen/ lib/CodeGen/AsmPrinter/ lib/CodeGen/SelectionDAG/ lib/Target/MSP430/ lib/Target/PowerPC/ lib/Target/X86/ lib/Target/X86/AsmPrinter/ lib/Target/XCore/
Dan Gohman
gohman at apple.com
Fri Nov 20 15:49:52 PST 2009
Author: djg
Date: Fri Nov 20 17:49:51 2009
New Revision: 89515
URL: http://llvm.org/viewvc/llvm-project?rev=89515&view=rev
Log:
$ svn merge -c 89506 https://djg@llvm.org/svn/llvm-project/llvm/trunk
--- Merging r89506 into '.':
U include/llvm/CodeGen/SelectionDAGNodes.h
U include/llvm/CodeGen/SelectionDAG.h
U include/llvm/CodeGen/MachineOperand.h
U include/llvm/CodeGen/AsmPrinter.h
U lib/CodeGen/AsmPrinter/AsmPrinter.cpp
U lib/CodeGen/SelectionDAG/SelectionDAG.cpp
U lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
U lib/CodeGen/SelectionDAG/InstrEmitter.cpp
U lib/Target/PowerPC/PPCISelLowering.cpp
U lib/Target/XCore/XCoreISelLowering.cpp
U lib/Target/X86/X86ISelLowering.cpp
U lib/Target/X86/X86Subtarget.h
U lib/Target/X86/X86ISelDAGToDAG.cpp
U lib/Target/X86/AsmPrinter/X86MCInstLower.h
U lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
U lib/Target/X86/X86Subtarget.cpp
$ svn merge -c 89507 https://djg@llvm.org/svn/llvm-project/llvm/trunk
--- Merging r89507 into '.':
U lib/Target/MSP430/MSP430ISelDAGToDAG.cpp
$ svn merge -c 89509 https://djg@llvm.org/svn/llvm-project/llvm/trunk
--- Merging r89509 into '.':
G lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
Modified:
llvm/branches/Apple/Zoidberg/include/llvm/CodeGen/AsmPrinter.h
llvm/branches/Apple/Zoidberg/include/llvm/CodeGen/MachineOperand.h
llvm/branches/Apple/Zoidberg/include/llvm/CodeGen/SelectionDAG.h
llvm/branches/Apple/Zoidberg/include/llvm/CodeGen/SelectionDAGNodes.h
llvm/branches/Apple/Zoidberg/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/branches/Apple/Zoidberg/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
llvm/branches/Apple/Zoidberg/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/branches/Apple/Zoidberg/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
llvm/branches/Apple/Zoidberg/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp
llvm/branches/Apple/Zoidberg/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/branches/Apple/Zoidberg/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
llvm/branches/Apple/Zoidberg/lib/Target/X86/AsmPrinter/X86MCInstLower.h
llvm/branches/Apple/Zoidberg/lib/Target/X86/X86ISelDAGToDAG.cpp
llvm/branches/Apple/Zoidberg/lib/Target/X86/X86ISelLowering.cpp
llvm/branches/Apple/Zoidberg/lib/Target/X86/X86Subtarget.cpp
llvm/branches/Apple/Zoidberg/lib/Target/X86/X86Subtarget.h
llvm/branches/Apple/Zoidberg/lib/Target/XCore/XCoreISelLowering.cpp
Modified: llvm/branches/Apple/Zoidberg/include/llvm/CodeGen/AsmPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Zoidberg/include/llvm/CodeGen/AsmPrinter.h?rev=89515&r1=89514&r2=89515&view=diff
==============================================================================
--- llvm/branches/Apple/Zoidberg/include/llvm/CodeGen/AsmPrinter.h (original)
+++ llvm/branches/Apple/Zoidberg/include/llvm/CodeGen/AsmPrinter.h Fri Nov 20 17:49:51 2009
@@ -345,9 +345,11 @@
/// GetBlockAddressSymbol - Return the MCSymbol used to satisfy BlockAddress
/// uses of the specified basic block.
- MCSymbol *GetBlockAddressSymbol(const BlockAddress *BA) const;
+ MCSymbol *GetBlockAddressSymbol(const BlockAddress *BA,
+ const char *Suffix = "") const;
MCSymbol *GetBlockAddressSymbol(const Function *F,
- const BasicBlock *BB) const;
+ const BasicBlock *BB,
+ const char *Suffix = "") const;
/// EmitBasicBlockStart - This method prints the label for the specified
/// MachineBasicBlock, an alignment (if present) and a comment describing
Modified: llvm/branches/Apple/Zoidberg/include/llvm/CodeGen/MachineOperand.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Zoidberg/include/llvm/CodeGen/MachineOperand.h?rev=89515&r1=89514&r2=89515&view=diff
==============================================================================
--- llvm/branches/Apple/Zoidberg/include/llvm/CodeGen/MachineOperand.h (original)
+++ llvm/branches/Apple/Zoidberg/include/llvm/CodeGen/MachineOperand.h Fri Nov 20 17:49:51 2009
@@ -435,10 +435,12 @@
Op.setTargetFlags(TargetFlags);
return Op;
}
- static MachineOperand CreateBA(BlockAddress *BA) {
+ static MachineOperand CreateBA(BlockAddress *BA,
+ unsigned char TargetFlags = 0) {
MachineOperand Op(MachineOperand::MO_BlockAddress);
Op.Contents.OffsetedInfo.Val.BA = BA;
Op.setOffset(0); // Offset is always 0.
+ Op.setTargetFlags(TargetFlags);
return Op;
}
Modified: llvm/branches/Apple/Zoidberg/include/llvm/CodeGen/SelectionDAG.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Zoidberg/include/llvm/CodeGen/SelectionDAG.h?rev=89515&r1=89514&r2=89515&view=diff
==============================================================================
--- llvm/branches/Apple/Zoidberg/include/llvm/CodeGen/SelectionDAG.h (original)
+++ llvm/branches/Apple/Zoidberg/include/llvm/CodeGen/SelectionDAG.h Fri Nov 20 17:49:51 2009
@@ -326,8 +326,8 @@
unsigned Line, unsigned Col, MDNode *CU);
SDValue getLabel(unsigned Opcode, DebugLoc dl, SDValue Root,
unsigned LabelID);
- SDValue getBlockAddress(BlockAddress *BA, DebugLoc dl,
- bool isTarget = false);
+ SDValue getBlockAddress(BlockAddress *BA, EVT VT,
+ bool isTarget = false, unsigned char TargetFlags = 0);
SDValue getCopyToReg(SDValue Chain, DebugLoc dl, unsigned Reg, SDValue N) {
return getNode(ISD::CopyToReg, dl, MVT::Other, Chain,
Modified: llvm/branches/Apple/Zoidberg/include/llvm/CodeGen/SelectionDAGNodes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Zoidberg/include/llvm/CodeGen/SelectionDAGNodes.h?rev=89515&r1=89514&r2=89515&view=diff
==============================================================================
--- llvm/branches/Apple/Zoidberg/include/llvm/CodeGen/SelectionDAGNodes.h (original)
+++ llvm/branches/Apple/Zoidberg/include/llvm/CodeGen/SelectionDAGNodes.h Fri Nov 20 17:49:51 2009
@@ -2029,12 +2029,16 @@
class BlockAddressSDNode : public SDNode {
BlockAddress *BA;
+ unsigned char TargetFlags;
friend class SelectionDAG;
- BlockAddressSDNode(unsigned NodeTy, DebugLoc dl, EVT VT, BlockAddress *ba)
- : SDNode(NodeTy, dl, getSDVTList(VT)), BA(ba) {
+ BlockAddressSDNode(unsigned NodeTy, EVT VT, BlockAddress *ba,
+ unsigned char Flags)
+ : SDNode(NodeTy, DebugLoc::getUnknownLoc(), getSDVTList(VT)),
+ BA(ba), TargetFlags(Flags) {
}
public:
BlockAddress *getBlockAddress() const { return BA; }
+ unsigned char getTargetFlags() const { return TargetFlags; }
static bool classof(const BlockAddressSDNode *) { return true; }
static bool classof(const SDNode *N) {
Modified: llvm/branches/Apple/Zoidberg/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Zoidberg/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=89515&r1=89514&r2=89515&view=diff
==============================================================================
--- llvm/branches/Apple/Zoidberg/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/branches/Apple/Zoidberg/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Fri Nov 20 17:49:51 2009
@@ -1630,12 +1630,14 @@
return true;
}
-MCSymbol *AsmPrinter::GetBlockAddressSymbol(const BlockAddress *BA) const {
- return GetBlockAddressSymbol(BA->getFunction(), BA->getBasicBlock());
+MCSymbol *AsmPrinter::GetBlockAddressSymbol(const BlockAddress *BA,
+ const char *Suffix) const {
+ return GetBlockAddressSymbol(BA->getFunction(), BA->getBasicBlock(), Suffix);
}
MCSymbol *AsmPrinter::GetBlockAddressSymbol(const Function *F,
- const BasicBlock *BB) const {
+ const BasicBlock *BB,
+ const char *Suffix) const {
assert(BB->hasName() &&
"Address of anonymous basic block not supported yet!");
@@ -1647,7 +1649,8 @@
SmallString<60> Name;
raw_svector_ostream(Name) << MAI->getPrivateGlobalPrefix() << "BA"
<< FuncName.size() << '_' << FuncName << '_'
- << Mang->makeNameProper(BB->getName());
+ << Mang->makeNameProper(BB->getName())
+ << Suffix;
return OutContext.GetOrCreateSymbol(Name.str());
}
Modified: llvm/branches/Apple/Zoidberg/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Zoidberg/lib/CodeGen/SelectionDAG/InstrEmitter.cpp?rev=89515&r1=89514&r2=89515&view=diff
==============================================================================
--- llvm/branches/Apple/Zoidberg/lib/CodeGen/SelectionDAG/InstrEmitter.cpp (original)
+++ llvm/branches/Apple/Zoidberg/lib/CodeGen/SelectionDAG/InstrEmitter.cpp Fri Nov 20 17:49:51 2009
@@ -350,7 +350,8 @@
MI->addOperand(MachineOperand::CreateES(ES->getSymbol(),
ES->getTargetFlags()));
} else if (BlockAddressSDNode *BA = dyn_cast<BlockAddressSDNode>(Op)) {
- MI->addOperand(MachineOperand::CreateBA(BA->getBlockAddress()));
+ MI->addOperand(MachineOperand::CreateBA(BA->getBlockAddress(),
+ BA->getTargetFlags()));
} else {
assert(Op.getValueType() != MVT::Other &&
Op.getValueType() != MVT::Flag &&
Modified: llvm/branches/Apple/Zoidberg/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Zoidberg/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=89515&r1=89514&r2=89515&view=diff
==============================================================================
--- llvm/branches/Apple/Zoidberg/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/branches/Apple/Zoidberg/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Nov 20 17:49:51 2009
@@ -462,7 +462,8 @@
}
case ISD::TargetBlockAddress:
case ISD::BlockAddress: {
- ID.AddPointer(cast<BlockAddressSDNode>(N));
+ ID.AddPointer(cast<BlockAddressSDNode>(N)->getBlockAddress());
+ ID.AddInteger(cast<BlockAddressSDNode>(N)->getTargetFlags());
break;
}
} // end switch (N->getOpcode())
@@ -1323,18 +1324,20 @@
return SDValue(N, 0);
}
-SDValue SelectionDAG::getBlockAddress(BlockAddress *BA, DebugLoc DL,
- bool isTarget) {
+SDValue SelectionDAG::getBlockAddress(BlockAddress *BA, EVT VT,
+ bool isTarget,
+ unsigned char TargetFlags) {
unsigned Opc = isTarget ? ISD::TargetBlockAddress : ISD::BlockAddress;
FoldingSetNodeID ID;
- AddNodeIDNode(ID, Opc, getVTList(TLI.getPointerTy()), 0, 0);
+ AddNodeIDNode(ID, Opc, getVTList(VT), 0, 0);
ID.AddPointer(BA);
+ ID.AddInteger(TargetFlags);
void *IP = 0;
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
return SDValue(E, 0);
SDNode *N = NodeAllocator.Allocate<BlockAddressSDNode>();
- new (N) BlockAddressSDNode(Opc, DL, TLI.getPointerTy(), BA);
+ new (N) BlockAddressSDNode(Opc, VT, BA, TargetFlags);
CSEMap.InsertNode(N, IP);
AllNodes.push_back(N);
return SDValue(N, 0);
@@ -5810,6 +5813,8 @@
OS << ", ";
WriteAsOperand(OS, BA->getBlockAddress()->getBasicBlock(), false);
OS << ">";
+ if (unsigned int TF = BA->getTargetFlags())
+ OS << " [TF=" << TF << ']';
}
}
Modified: llvm/branches/Apple/Zoidberg/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Zoidberg/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=89515&r1=89514&r2=89515&view=diff
==============================================================================
--- llvm/branches/Apple/Zoidberg/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original)
+++ llvm/branches/Apple/Zoidberg/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Fri Nov 20 17:49:51 2009
@@ -884,7 +884,7 @@
}
if (BlockAddress *BA = dyn_cast<BlockAddress>(C))
- return DAG.getBlockAddress(BA, getCurDebugLoc());
+ return DAG.getBlockAddress(BA, VT);
const VectorType *VecTy = cast<VectorType>(V->getType());
unsigned NumElements = VecTy->getNumElements();
Modified: llvm/branches/Apple/Zoidberg/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Zoidberg/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp?rev=89515&r1=89514&r2=89515&view=diff
==============================================================================
--- llvm/branches/Apple/Zoidberg/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp (original)
+++ llvm/branches/Apple/Zoidberg/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp Fri Nov 20 17:49:51 2009
@@ -312,8 +312,8 @@
else if (AM.JT != -1)
Disp = CurDAG->getTargetJumpTable(AM.JT, MVT::i16, 0/*AM.SymbolFlags*/);
else if (AM.BlockAddr)
- Disp = CurDAG->getBlockAddress(AM.BlockAddr, DebugLoc()/*MVT::i32*/,
- true /*AM.SymbolFlags*/);
+ Disp = CurDAG->getBlockAddress(AM.BlockAddr, MVT::i32,
+ true, 0/*AM.SymbolFlags*/);
else
Disp = CurDAG->getTargetConstant(AM.Disp, MVT::i16);
Modified: llvm/branches/Apple/Zoidberg/lib/Target/PowerPC/PPCISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Zoidberg/lib/Target/PowerPC/PPCISelLowering.cpp?rev=89515&r1=89514&r2=89515&view=diff
==============================================================================
--- llvm/branches/Apple/Zoidberg/lib/Target/PowerPC/PPCISelLowering.cpp (original)
+++ llvm/branches/Apple/Zoidberg/lib/Target/PowerPC/PPCISelLowering.cpp Fri Nov 20 17:49:51 2009
@@ -1174,7 +1174,7 @@
DebugLoc DL = Op.getDebugLoc();
BlockAddress *BA = cast<BlockAddressSDNode>(Op)->getBlockAddress();
- SDValue TgtBA = DAG.getBlockAddress(BA, DL, /*isTarget=*/true);
+ SDValue TgtBA = DAG.getBlockAddress(BA, PtrVT, /*isTarget=*/true);
SDValue Zero = DAG.getConstant(0, PtrVT);
SDValue Hi = DAG.getNode(PPCISD::Hi, DL, PtrVT, TgtBA, Zero);
SDValue Lo = DAG.getNode(PPCISD::Lo, DL, PtrVT, TgtBA, Zero);
Modified: llvm/branches/Apple/Zoidberg/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Zoidberg/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp?rev=89515&r1=89514&r2=89515&view=diff
==============================================================================
--- llvm/branches/Apple/Zoidberg/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp (original)
+++ llvm/branches/Apple/Zoidberg/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp Fri Nov 20 17:49:51 2009
@@ -43,7 +43,6 @@
Twine(AsmPrinter.getFunctionNumber())+"$pb");
}
-
/// LowerGlobalAddressOperand - Lower an MO_GlobalAddress operand to an
/// MCOperand.
MCSymbol *X86MCInstLower::
@@ -231,6 +230,19 @@
return Ctx.GetOrCreateSymbol(Name.str());
}
+MCSymbol *X86MCInstLower::
+GetBlockAddressSymbol(const MachineOperand &MO) const {
+ const char *Suffix = "";
+ switch (MO.getTargetFlags()) {
+ default: llvm_unreachable("Unknown target flag on BA operand");
+ case X86II::MO_NO_FLAG: break; // No flag.
+ case X86II::MO_PIC_BASE_OFFSET: break; // Doesn't modify symbol name.
+ case X86II::MO_GOTOFF: Suffix = "@GOTOFF"; break;
+ }
+
+ return AsmPrinter.GetBlockAddressSymbol(MO.getBlockAddress(), Suffix);
+}
+
MCOperand X86MCInstLower::LowerSymbolOperand(const MachineOperand &MO,
MCSymbol *Sym) const {
// FIXME: We would like an efficient form for this, so we don't have to do a
@@ -331,8 +343,7 @@
MCOp = LowerSymbolOperand(MO, GetConstantPoolIndexSymbol(MO));
break;
case MachineOperand::MO_BlockAddress:
- MCOp = LowerSymbolOperand(MO, AsmPrinter.GetBlockAddressSymbol(
- MO.getBlockAddress()));
+ MCOp = LowerSymbolOperand(MO, GetBlockAddressSymbol(MO));
break;
}
Modified: llvm/branches/Apple/Zoidberg/lib/Target/X86/AsmPrinter/X86MCInstLower.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Zoidberg/lib/Target/X86/AsmPrinter/X86MCInstLower.h?rev=89515&r1=89514&r2=89515&view=diff
==============================================================================
--- llvm/branches/Apple/Zoidberg/lib/Target/X86/AsmPrinter/X86MCInstLower.h (original)
+++ llvm/branches/Apple/Zoidberg/lib/Target/X86/AsmPrinter/X86MCInstLower.h Fri Nov 20 17:49:51 2009
@@ -43,6 +43,7 @@
MCSymbol *GetExternalSymbolSymbol(const MachineOperand &MO) const;
MCSymbol *GetJumpTableSymbol(const MachineOperand &MO) const;
MCSymbol *GetConstantPoolIndexSymbol(const MachineOperand &MO) const;
+ MCSymbol *GetBlockAddressSymbol(const MachineOperand &MO) const;
MCOperand LowerSymbolOperand(const MachineOperand &MO, MCSymbol *Sym) const;
private:
Modified: llvm/branches/Apple/Zoidberg/lib/Target/X86/X86ISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Zoidberg/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=89515&r1=89514&r2=89515&view=diff
==============================================================================
--- llvm/branches/Apple/Zoidberg/lib/Target/X86/X86ISelDAGToDAG.cpp (original)
+++ llvm/branches/Apple/Zoidberg/lib/Target/X86/X86ISelDAGToDAG.cpp Fri Nov 20 17:49:51 2009
@@ -252,8 +252,8 @@
else if (AM.JT != -1)
Disp = CurDAG->getTargetJumpTable(AM.JT, MVT::i32, AM.SymbolFlags);
else if (AM.BlockAddr)
- Disp = CurDAG->getBlockAddress(AM.BlockAddr, DebugLoc()/*MVT::i32*/,
- true /*AM.SymbolFlags*/);
+ Disp = CurDAG->getBlockAddress(AM.BlockAddr, MVT::i32,
+ true, AM.SymbolFlags);
else
Disp = CurDAG->getTargetConstant(AM.Disp, MVT::i32);
@@ -777,7 +777,7 @@
AM.SymbolFlags = J->getTargetFlags();
} else {
AM.BlockAddr = cast<BlockAddressSDNode>(N0)->getBlockAddress();
- //AM.SymbolFlags = cast<BlockAddressSDNode>(N0)->getTargetFlags();
+ AM.SymbolFlags = cast<BlockAddressSDNode>(N0)->getTargetFlags();
}
if (N.getOpcode() == X86ISD::WrapperRIP)
@@ -808,7 +808,7 @@
AM.SymbolFlags = J->getTargetFlags();
} else {
AM.BlockAddr = cast<BlockAddressSDNode>(N0)->getBlockAddress();
- //AM.SymbolFlags = cast<BlockAddressSDNode>(N0)->getTargetFlags();
+ AM.SymbolFlags = cast<BlockAddressSDNode>(N0)->getTargetFlags();
}
return false;
}
Modified: llvm/branches/Apple/Zoidberg/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Zoidberg/lib/Target/X86/X86ISelLowering.cpp?rev=89515&r1=89514&r2=89515&view=diff
==============================================================================
--- llvm/branches/Apple/Zoidberg/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/branches/Apple/Zoidberg/lib/Target/X86/X86ISelLowering.cpp Fri Nov 20 17:49:51 2009
@@ -4722,18 +4722,27 @@
SDValue
X86TargetLowering::LowerBlockAddress(SDValue Op, SelectionDAG &DAG) {
- unsigned WrapperKind = X86ISD::Wrapper;
+ // Create the TargetBlockAddressAddress node.
+ unsigned char OpFlags =
+ Subtarget->ClassifyBlockAddressReference();
CodeModel::Model M = getTargetMachine().getCodeModel();
+ BlockAddress *BA = cast<BlockAddressSDNode>(Op)->getBlockAddress();
+ DebugLoc dl = Op.getDebugLoc();
+ SDValue Result = DAG.getBlockAddress(BA, getPointerTy(),
+ /*isTarget=*/true, OpFlags);
+
if (Subtarget->isPICStyleRIPRel() &&
(M == CodeModel::Small || M == CodeModel::Kernel))
- WrapperKind = X86ISD::WrapperRIP;
-
- DebugLoc DL = Op.getDebugLoc();
-
- BlockAddress *BA = cast<BlockAddressSDNode>(Op)->getBlockAddress();
- SDValue Result = DAG.getBlockAddress(BA, DL, /*isTarget=*/true);
+ Result = DAG.getNode(X86ISD::WrapperRIP, dl, getPointerTy(), Result);
+ else
+ Result = DAG.getNode(X86ISD::Wrapper, dl, getPointerTy(), Result);
- Result = DAG.getNode(WrapperKind, DL, getPointerTy(), Result);
+ // With PIC, the address is actually $g + Offset.
+ if (isGlobalRelativeToPICBase(OpFlags)) {
+ Result = DAG.getNode(ISD::ADD, dl, getPointerTy(),
+ DAG.getNode(X86ISD::GlobalBaseReg, dl, getPointerTy()),
+ Result);
+ }
return Result;
}
Modified: llvm/branches/Apple/Zoidberg/lib/Target/X86/X86Subtarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Zoidberg/lib/Target/X86/X86Subtarget.cpp?rev=89515&r1=89514&r2=89515&view=diff
==============================================================================
--- llvm/branches/Apple/Zoidberg/lib/Target/X86/X86Subtarget.cpp (original)
+++ llvm/branches/Apple/Zoidberg/lib/Target/X86/X86Subtarget.cpp Fri Nov 20 17:49:51 2009
@@ -28,6 +28,21 @@
#include <intrin.h>
#endif
+/// ClassifyBlockAddressReference - Classify a blockaddress reference for the
+/// current subtarget according to how we should reference it in a non-pcrel
+/// context.
+unsigned char X86Subtarget::
+ClassifyBlockAddressReference() const {
+ if (isPICStyleGOT()) // 32-bit ELF targets.
+ return X86II::MO_GOTOFF;
+
+ if (isPICStyleStubPIC()) // Darwin/32 in PIC mode.
+ return X86II::MO_PIC_BASE_OFFSET;
+
+ // Direct static reference to label.
+ return X86II::MO_NO_FLAG;
+}
+
/// ClassifyGlobalReference - Classify a global variable reference for the
/// current subtarget according to how we should reference it in a non-pcrel
/// context.
Modified: llvm/branches/Apple/Zoidberg/lib/Target/X86/X86Subtarget.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Zoidberg/lib/Target/X86/X86Subtarget.h?rev=89515&r1=89514&r2=89515&view=diff
==============================================================================
--- llvm/branches/Apple/Zoidberg/lib/Target/X86/X86Subtarget.h (original)
+++ llvm/branches/Apple/Zoidberg/lib/Target/X86/X86Subtarget.h Fri Nov 20 17:49:51 2009
@@ -199,6 +199,11 @@
unsigned char ClassifyGlobalReference(const GlobalValue *GV,
const TargetMachine &TM)const;
+ /// ClassifyBlockAddressReference - Classify a blockaddress reference for the
+ /// current subtarget according to how we should reference it in a non-pcrel
+ /// context.
+ unsigned char ClassifyBlockAddressReference() const;
+
/// IsLegalToCallImmediateAddr - Return true if the subtarget allows calls
/// to immediate address.
bool IsLegalToCallImmediateAddr(const TargetMachine &TM) const;
Modified: llvm/branches/Apple/Zoidberg/lib/Target/XCore/XCoreISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Zoidberg/lib/Target/XCore/XCoreISelLowering.cpp?rev=89515&r1=89514&r2=89515&view=diff
==============================================================================
--- llvm/branches/Apple/Zoidberg/lib/Target/XCore/XCoreISelLowering.cpp (original)
+++ llvm/branches/Apple/Zoidberg/lib/Target/XCore/XCoreISelLowering.cpp Fri Nov 20 17:49:51 2009
@@ -295,7 +295,7 @@
DebugLoc DL = Op.getDebugLoc();
BlockAddress *BA = cast<BlockAddressSDNode>(Op)->getBlockAddress();
- SDValue Result = DAG.getBlockAddress(BA, DL, /*isTarget=*/true);
+ SDValue Result = DAG.getBlockAddress(BA, getPointerTy(), /*isTarget=*/true);
return DAG.getNode(XCoreISD::PCRelativeWrapper, DL, getPointerTy(), Result);
}
More information about the llvm-branch-commits
mailing list