mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-28 15:33:16 +00:00
switch ELF @GOTOFF references to use X86MCTargetExpr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95593 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
54e72eca0c
commit
017ec35e28
@ -14,8 +14,9 @@
|
||||
|
||||
#include "X86MCInstLower.h"
|
||||
#include "X86AsmPrinter.h"
|
||||
#include "X86MCAsmInfo.h"
|
||||
#include "X86COFFMachineModuleInfo.h"
|
||||
#include "X86MCAsmInfo.h"
|
||||
#include "X86MCTargetExpr.h"
|
||||
#include "llvm/Analysis/DebugInfo.h"
|
||||
#include "llvm/CodeGen/MachineModuleInfoImpls.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
@ -67,6 +68,8 @@ GetGlobalAddressSymbol(const MachineOperand &MO) const {
|
||||
COFFMMI.DecorateCygMingName(Name, GV, *AsmPrinter.TM.getTargetData());
|
||||
}
|
||||
|
||||
//X86MCTargetExpr::VariantKind Kind = X86MCTargetExpr::Invalid;
|
||||
|
||||
switch (MO.getTargetFlags()) {
|
||||
default: llvm_unreachable("Unknown target flag on GV operand");
|
||||
case X86II::MO_NO_FLAG: // No flag.
|
||||
@ -115,7 +118,7 @@ GetGlobalAddressSymbol(const MachineOperand &MO) const {
|
||||
case X86II::MO_GOTOFF: Name += "@GOTOFF"; break;
|
||||
case X86II::MO_PLT: Name += "@PLT"; break;
|
||||
}
|
||||
|
||||
|
||||
return Ctx.GetOrCreateSymbol(Name.str());
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "X86.h"
|
||||
#include "X86InstrBuilder.h"
|
||||
#include "X86ISelLowering.h"
|
||||
#include "X86MCTargetExpr.h"
|
||||
#include "X86TargetMachine.h"
|
||||
#include "X86TargetObjectFile.h"
|
||||
#include "llvm/CallingConv.h"
|
||||
@ -36,7 +37,6 @@
|
||||
#include "llvm/CodeGen/PseudoSourceValue.h"
|
||||
#include "llvm/MC/MCAsmInfo.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
#include "llvm/MC/MCExpr.h"
|
||||
#include "llvm/MC/MCSymbol.h"
|
||||
#include "llvm/ADT/BitVector.h"
|
||||
#include "llvm/ADT/SmallSet.h"
|
||||
@ -1130,10 +1130,8 @@ X86TargetLowering::LowerCustomJumpTableEntry(const MachineJumpTableInfo *MJTI,
|
||||
Subtarget->isPICStyleGOT());
|
||||
// In 32-bit ELF systems, our jump table entries are formed with @GOTOFF
|
||||
// entries.
|
||||
|
||||
// FIXME: @GOTOFF should be a property of MCSymbolRefExpr not in the MCSymbol.
|
||||
std::string Name = MBB->getSymbol(Ctx)->getName() + "@GOTOFF";
|
||||
return MCSymbolRefExpr::Create(Ctx.GetOrCreateSymbol(StringRef(Name)), Ctx);
|
||||
return X86MCTargetExpr::Create(MBB->getSymbol(Ctx),
|
||||
X86MCTargetExpr::GOTOFF, Ctx);
|
||||
}
|
||||
|
||||
/// getPICJumpTableRelocaBase - Returns relocation base for the given PIC
|
||||
|
@ -23,9 +23,11 @@ void X86MCTargetExpr::PrintImpl(raw_ostream &OS) const {
|
||||
OS << *Sym;
|
||||
|
||||
switch (Kind) {
|
||||
case GOT: OS << "@GOT"; break;
|
||||
case PLT: OS << "@PLT"; break;
|
||||
case Invalid: OS << "@<invalid>"; break;
|
||||
case GOT: OS << "@GOT"; break;
|
||||
case PLT: OS << "@PLT"; break;
|
||||
case GOTPCREL: OS << "@GOTPCREL"; break;
|
||||
case GOTOFF: OS << "@GOTOFF"; break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,5 +41,3 @@ bool X86MCTargetExpr::EvaluateAsRelocatableImpl(MCValue &Res) const {
|
||||
Res = MCValue::get(Sym, 0, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
X86MCTargetExpr *foo(MCExpr *A) { return (X86MCTargetExpr*)A; }
|
@ -18,9 +18,11 @@ namespace llvm {
|
||||
class X86MCTargetExpr : public MCTargetExpr {
|
||||
public:
|
||||
enum VariantKind {
|
||||
Invalid,
|
||||
GOT,
|
||||
PLT,
|
||||
GOTPCREL
|
||||
GOTPCREL,
|
||||
GOTOFF
|
||||
};
|
||||
private:
|
||||
/// Sym - The symbol being referenced.
|
||||
|
@ -55,6 +55,7 @@ getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
|
||||
IsIndirect = true;
|
||||
IsPCRel = true;
|
||||
|
||||
// FIXME: Use GetSymbolWithGlobalValueBase.
|
||||
SmallString<128> Name;
|
||||
Mang->getNameWithPrefix(Name, GV, false);
|
||||
const MCSymbol *Sym = getContext().CreateSymbol(Name);
|
||||
|
Loading…
Reference in New Issue
Block a user