[llvm-commits] [llvm] r95593 - in /llvm/trunk/lib/Target/X86: AsmPrinter/X86MCInstLower.cpp X86ISelLowering.cpp X86MCTargetExpr.cpp X86MCTargetExpr.h X86TargetObjectFile.cpp
Chris Lattner
sabre at nondot.org
Mon Feb 8 14:33:56 PST 2010
Author: lattner
Date: Mon Feb 8 16:33:55 2010
New Revision: 95593
URL: http://llvm.org/viewvc/llvm-project?rev=95593&view=rev
Log:
switch ELF @GOTOFF references to use X86MCTargetExpr.
Modified:
llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/lib/Target/X86/X86MCTargetExpr.cpp
llvm/trunk/lib/Target/X86/X86MCTargetExpr.h
llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp
Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp?rev=95593&r1=95592&r2=95593&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp Mon Feb 8 16:33:55 2010
@@ -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 @@
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 @@
case X86II::MO_GOTOFF: Name += "@GOTOFF"; break;
case X86II::MO_PLT: Name += "@PLT"; break;
}
-
+
return Ctx.GetOrCreateSymbol(Name.str());
}
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=95593&r1=95592&r2=95593&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Feb 8 16:33:55 2010
@@ -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 @@
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
Modified: llvm/trunk/lib/Target/X86/X86MCTargetExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCTargetExpr.cpp?rev=95593&r1=95592&r2=95593&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86MCTargetExpr.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86MCTargetExpr.cpp Mon Feb 8 16:33:55 2010
@@ -23,9 +23,11 @@
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 @@
Res = MCValue::get(Sym, 0, 0);
return true;
}
-
-X86MCTargetExpr *foo(MCExpr *A) { return (X86MCTargetExpr*)A; }
\ No newline at end of file
Modified: llvm/trunk/lib/Target/X86/X86MCTargetExpr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCTargetExpr.h?rev=95593&r1=95592&r2=95593&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86MCTargetExpr.h (original)
+++ llvm/trunk/lib/Target/X86/X86MCTargetExpr.h Mon Feb 8 16:33:55 2010
@@ -18,9 +18,11 @@
class X86MCTargetExpr : public MCTargetExpr {
public:
enum VariantKind {
+ Invalid,
GOT,
PLT,
- GOTPCREL
+ GOTPCREL,
+ GOTOFF
};
private:
/// Sym - The symbol being referenced.
Modified: llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp?rev=95593&r1=95592&r2=95593&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp Mon Feb 8 16:33:55 2010
@@ -55,6 +55,7 @@
IsIndirect = true;
IsPCRel = true;
+ // FIXME: Use GetSymbolWithGlobalValueBase.
SmallString<128> Name;
Mang->getNameWithPrefix(Name, GV, false);
const MCSymbol *Sym = getContext().CreateSymbol(Name);
More information about the llvm-commits
mailing list