From beeb93e6ba48af2661eabc4872d8b159fb43e5db Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 26 Jan 2010 05:58:28 +0000 Subject: add a new MachineJumpTableInfo::getJTISymbol method, use it to implement the default TargetLowering::getPICJumpTableRelocBaseExpr git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94523 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SelectionDAG/TargetLowering.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/CodeGen/SelectionDAG/TargetLowering.cpp') diff --git a/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/lib/CodeGen/SelectionDAG/TargetLowering.cpp index 34a31788ed..ccdedded90 100644 --- a/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -13,6 +13,7 @@ #include "llvm/Target/TargetLowering.h" #include "llvm/MC/MCAsmInfo.h" +#include "llvm/MC/MCExpr.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetMachine.h" @@ -812,6 +813,7 @@ unsigned TargetLowering::getJumpTableEncoding() const { SDValue TargetLowering::getPICJumpTableRelocBase(SDValue Table, SelectionDAG &DAG) const { + // FIXME: Eliminate usesGlobalOffsetTable() in favor of JTEntryKind. if (usesGlobalOffsetTable()) return DAG.getGLOBAL_OFFSET_TABLE(getPointerTy()); return Table; @@ -824,10 +826,10 @@ const MCExpr * TargetLowering::getPICJumpTableRelocBaseExpr(const MachineJumpTableInfo *MJTI, unsigned JTI, MCContext &Ctx) const { - assert(0 && "FIXME: IMPLEMENT ME"); + // The normal PIC reloc base is the label at the start of the jump table. + return MCSymbolRefExpr::Create(MJTI->getJTISymbol(JTI, Ctx), Ctx); } - bool TargetLowering::isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const { // Assume that everything is safe in static mode. -- cgit v1.2.3-18-g5258