llvm.org GIT mirror llvm / 017ec35
switch ELF @GOTOFF references to use X86MCTargetExpr. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95593 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 10 years ago
5 changed file(s) with 16 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
1313
1414 #include "X86MCInstLower.h"
1515 #include "X86AsmPrinter.h"
16 #include "X86COFFMachineModuleInfo.h"
1617 #include "X86MCAsmInfo.h"
17 #include "X86COFFMachineModuleInfo.h"
18 #include "X86MCTargetExpr.h"
1819 #include "llvm/Analysis/DebugInfo.h"
1920 #include "llvm/CodeGen/MachineModuleInfoImpls.h"
2021 #include "llvm/MC/MCContext.h"
6667 COFFMMI.DecorateCygMingName(Name, GV, *AsmPrinter.TM.getTargetData());
6768 }
6869
70 //X86MCTargetExpr::VariantKind Kind = X86MCTargetExpr::Invalid;
71
6972 switch (MO.getTargetFlags()) {
7073 default: llvm_unreachable("Unknown target flag on GV operand");
7174 case X86II::MO_NO_FLAG: // No flag.
114117 case X86II::MO_GOTOFF: Name += "@GOTOFF"; break;
115118 case X86II::MO_PLT: Name += "@PLT"; break;
116119 }
117
120
118121 return Ctx.GetOrCreateSymbol(Name.str());
119122 }
120123
1515 #include "X86.h"
1616 #include "X86InstrBuilder.h"
1717 #include "X86ISelLowering.h"
18 #include "X86MCTargetExpr.h"
1819 #include "X86TargetMachine.h"
1920 #include "X86TargetObjectFile.h"
2021 #include "llvm/CallingConv.h"
3536 #include "llvm/CodeGen/PseudoSourceValue.h"
3637 #include "llvm/MC/MCAsmInfo.h"
3738 #include "llvm/MC/MCContext.h"
38 #include "llvm/MC/MCExpr.h"
3939 #include "llvm/MC/MCSymbol.h"
4040 #include "llvm/ADT/BitVector.h"
4141 #include "llvm/ADT/SmallSet.h"
11291129 Subtarget->isPICStyleGOT());
11301130 // In 32-bit ELF systems, our jump table entries are formed with @GOTOFF
11311131 // entries.
1132
1133 // FIXME: @GOTOFF should be a property of MCSymbolRefExpr not in the MCSymbol.
1134 std::string Name = MBB->getSymbol(Ctx)->getName() + "@GOTOFF";
1135 return MCSymbolRefExpr::Create(Ctx.GetOrCreateSymbol(StringRef(Name)), Ctx);
1132 return X86MCTargetExpr::Create(MBB->getSymbol(Ctx),
1133 X86MCTargetExpr::GOTOFF, Ctx);
11361134 }
11371135
11381136 /// getPICJumpTableRelocaBase - Returns relocation base for the given PIC
2222 OS << *Sym;
2323
2424 switch (Kind) {
25 case GOT: OS << "@GOT"; break;
26 case PLT: OS << "@PLT"; break;
25 case Invalid: OS << "@"; break;
26 case GOT: OS << "@GOT"; break;
27 case PLT: OS << "@PLT"; break;
2728 case GOTPCREL: OS << "@GOTPCREL"; break;
29 case GOTOFF: OS << "@GOTOFF"; break;
2830 }
2931 }
3032
3840 Res = MCValue::get(Sym, 0, 0);
3941 return true;
4042 }
41
42 X86MCTargetExpr *foo(MCExpr *A) { return (X86MCTargetExpr*)A; }
1717 class X86MCTargetExpr : public MCTargetExpr {
1818 public:
1919 enum VariantKind {
20 Invalid,
2021 GOT,
2122 PLT,
22 GOTPCREL
23 GOTPCREL,
24 GOTOFF
2325 };
2426 private:
2527 /// Sym - The symbol being referenced.
5454 IsIndirect = true;
5555 IsPCRel = true;
5656
57 // FIXME: Use GetSymbolWithGlobalValueBase.
5758 SmallString<128> Name;
5859 Mang->getNameWithPrefix(Name, GV, false);
5960 const MCSymbol *Sym = getContext().CreateSymbol(Name);