[llvm] r198720 - [x86] Kill gratuitous X86_{32, 64}TargetMachine subclasses, use X86TargetMachine
David Woodhouse
dwmw2 at infradead.org
Tue Jan 7 16:08:51 PST 2014
Author: dwmw2
Date: Tue Jan 7 18:08:50 2014
New Revision: 198720
URL: http://llvm.org/viewvc/llvm-project?rev=198720&view=rev
Log:
[x86] Kill gratuitous X86_{32,64}TargetMachine subclasses, use X86TargetMachine
Modified:
llvm/trunk/lib/Target/X86/X86Subtarget.cpp
llvm/trunk/lib/Target/X86/X86Subtarget.h
llvm/trunk/lib/Target/X86/X86TargetMachine.cpp
llvm/trunk/lib/Target/X86/X86TargetMachine.h
Modified: llvm/trunk/lib/Target/X86/X86Subtarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.cpp?rev=198720&r1=198719&r2=198720&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86Subtarget.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86Subtarget.cpp Tue Jan 7 18:08:50 2014
@@ -551,14 +551,14 @@ void X86Subtarget::initializeEnvironment
X86Subtarget::X86Subtarget(const std::string &TT, const std::string &CPU,
const std::string &FS,
- unsigned StackAlignOverride, bool is64Bit)
+ unsigned StackAlignOverride)
: X86GenSubtargetInfo(TT, CPU, FS)
, X86ProcFamily(Others)
, PICStyle(PICStyles::None)
, TargetTriple(TT)
, StackAlignOverride(StackAlignOverride)
- , In64BitMode(is64Bit)
- , In32BitMode(!is64Bit)
+ , In64BitMode(TargetTriple.getArch() == Triple::x86_64)
+ , In32BitMode(TargetTriple.getArch() == Triple::x86)
, In16BitMode(false) {
initializeEnvironment();
resetSubtargetFeatures(CPU, FS);
Modified: llvm/trunk/lib/Target/X86/X86Subtarget.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.h?rev=198720&r1=198719&r2=198720&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86Subtarget.h (original)
+++ llvm/trunk/lib/Target/X86/X86Subtarget.h Tue Jan 7 18:08:50 2014
@@ -220,7 +220,7 @@ public:
///
X86Subtarget(const std::string &TT, const std::string &CPU,
const std::string &FS,
- unsigned StackAlignOverride, bool is64Bit);
+ unsigned StackAlignOverride);
/// getStackAlignment - Returns the minimum alignment known to hold of the
/// stack frame on entry to the function and which must be maintained by every
Modified: llvm/trunk/lib/Target/X86/X86TargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.cpp?rev=198720&r1=198719&r2=198720&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86TargetMachine.cpp Tue Jan 7 18:08:50 2014
@@ -24,11 +24,11 @@ using namespace llvm;
extern "C" void LLVMInitializeX86Target() {
// Register the target.
- RegisterTargetMachine<X86_32TargetMachine> X(TheX86_32Target);
- RegisterTargetMachine<X86_64TargetMachine> Y(TheX86_64Target);
+ RegisterTargetMachine<X86TargetMachine> X(TheX86_32Target);
+ RegisterTargetMachine<X86TargetMachine> Y(TheX86_64Target);
}
-void X86_32TargetMachine::anchor() { }
+void X86TargetMachine::anchor() { }
static std::string computeDataLayout(const X86Subtarget &ST) {
// X86 is little endian
@@ -69,49 +69,22 @@ static std::string computeDataLayout(con
return Ret;
}
-X86_32TargetMachine::X86_32TargetMachine(const Target &T, StringRef TT,
- StringRef CPU, StringRef FS,
- const TargetOptions &Options,
- Reloc::Model RM, CodeModel::Model CM,
- CodeGenOpt::Level OL)
- : X86TargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, false),
- DL(computeDataLayout(*getSubtargetImpl())),
- InstrInfo(*this),
- TLInfo(*this),
- TSInfo(*this),
- JITInfo(*this) {
- initAsmInfo();
-}
-
-void X86_64TargetMachine::anchor() { }
-
-X86_64TargetMachine::X86_64TargetMachine(const Target &T, StringRef TT,
- StringRef CPU, StringRef FS,
- const TargetOptions &Options,
- Reloc::Model RM, CodeModel::Model CM,
- CodeGenOpt::Level OL)
- : X86TargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, true),
- // The x32 ABI dictates the ILP32 programming model for x64.
- DL(computeDataLayout(*getSubtargetImpl())),
- InstrInfo(*this),
- TLInfo(*this),
- TSInfo(*this),
- JITInfo(*this) {
- initAsmInfo();
-}
-
/// X86TargetMachine ctor - Create an X86 target.
///
X86TargetMachine::X86TargetMachine(const Target &T, StringRef TT,
StringRef CPU, StringRef FS,
const TargetOptions &Options,
Reloc::Model RM, CodeModel::Model CM,
- CodeGenOpt::Level OL,
- bool is64Bit)
+ CodeGenOpt::Level OL)
: LLVMTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL),
- Subtarget(TT, CPU, FS, Options.StackAlignmentOverride, is64Bit),
+ Subtarget(TT, CPU, FS, Options.StackAlignmentOverride),
FrameLowering(*this, Subtarget),
- InstrItins(Subtarget.getInstrItineraryData()){
+ InstrItins(Subtarget.getInstrItineraryData()),
+ DL(computeDataLayout(*getSubtargetImpl())),
+ InstrInfo(*this),
+ TLInfo(*this),
+ TSInfo(*this),
+ JITInfo(*this) {
// Determine the PICStyle based on the target selected.
if (getRelocationModel() == Reloc::Static) {
// Unless we're in PIC or DynamicNoPIC mode, set the PIC style to None.
@@ -135,6 +108,8 @@ X86TargetMachine::X86TargetMachine(const
// default to hard float ABI
if (Options.FloatABIType == FloatABI::Default)
this->Options.FloatABIType = FloatABI::Hard;
+
+ initAsmInfo();
}
//===----------------------------------------------------------------------===//
Modified: llvm/trunk/lib/Target/X86/X86TargetMachine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.h?rev=198720&r1=198719&r2=198720&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetMachine.h (original)
+++ llvm/trunk/lib/Target/X86/X86TargetMachine.h Tue Jan 7 18:08:50 2014
@@ -30,32 +30,38 @@ namespace llvm {
class StringRef;
class X86TargetMachine : public LLVMTargetMachine {
+ virtual void anchor();
X86Subtarget Subtarget;
X86FrameLowering FrameLowering;
InstrItineraryData InstrItins;
+ const DataLayout DL; // Calculates type size & alignment
+ X86InstrInfo InstrInfo;
+ X86TargetLowering TLInfo;
+ X86SelectionDAGInfo TSInfo;
+ X86JITInfo JITInfo;
public:
X86TargetMachine(const Target &T, StringRef TT,
StringRef CPU, StringRef FS, const TargetOptions &Options,
Reloc::Model RM, CodeModel::Model CM,
- CodeGenOpt::Level OL,
- bool is64Bit);
+ CodeGenOpt::Level OL);
+ virtual const DataLayout *getDataLayout() const { return &DL; }
virtual const X86InstrInfo *getInstrInfo() const {
- llvm_unreachable("getInstrInfo not implemented");
+ return &InstrInfo;
}
virtual const TargetFrameLowering *getFrameLowering() const {
return &FrameLowering;
}
virtual X86JITInfo *getJITInfo() {
- llvm_unreachable("getJITInfo not implemented");
+ return &JITInfo;
}
virtual const X86Subtarget *getSubtargetImpl() const{ return &Subtarget; }
virtual const X86TargetLowering *getTargetLowering() const {
- llvm_unreachable("getTargetLowering not implemented");
+ return &TLInfo;
}
virtual const X86SelectionDAGInfo *getSelectionDAGInfo() const {
- llvm_unreachable("getSelectionDAGInfo not implemented");
+ return &TSInfo;
}
virtual const X86RegisterInfo *getRegisterInfo() const {
return &getInstrInfo()->getRegisterInfo();
@@ -74,64 +80,6 @@ public:
JITCodeEmitter &JCE);
};
-/// X86_32TargetMachine - X86 32-bit target machine.
-///
-class X86_32TargetMachine : public X86TargetMachine {
- virtual void anchor();
- const DataLayout DL; // Calculates type size & alignment
- X86InstrInfo InstrInfo;
- X86TargetLowering TLInfo;
- X86SelectionDAGInfo TSInfo;
- X86JITInfo JITInfo;
-public:
- X86_32TargetMachine(const Target &T, StringRef TT,
- StringRef CPU, StringRef FS, const TargetOptions &Options,
- Reloc::Model RM, CodeModel::Model CM,
- CodeGenOpt::Level OL);
- virtual const DataLayout *getDataLayout() const { return &DL; }
- virtual const X86TargetLowering *getTargetLowering() const {
- return &TLInfo;
- }
- virtual const X86SelectionDAGInfo *getSelectionDAGInfo() const {
- return &TSInfo;
- }
- virtual const X86InstrInfo *getInstrInfo() const {
- return &InstrInfo;
- }
- virtual X86JITInfo *getJITInfo() {
- return &JITInfo;
- }
-};
-
-/// X86_64TargetMachine - X86 64-bit target machine.
-///
-class X86_64TargetMachine : public X86TargetMachine {
- virtual void anchor();
- const DataLayout DL; // Calculates type size & alignment
- X86InstrInfo InstrInfo;
- X86TargetLowering TLInfo;
- X86SelectionDAGInfo TSInfo;
- X86JITInfo JITInfo;
-public:
- X86_64TargetMachine(const Target &T, StringRef TT,
- StringRef CPU, StringRef FS, const TargetOptions &Options,
- Reloc::Model RM, CodeModel::Model CM,
- CodeGenOpt::Level OL);
- virtual const DataLayout *getDataLayout() const { return &DL; }
- virtual const X86TargetLowering *getTargetLowering() const {
- return &TLInfo;
- }
- virtual const X86SelectionDAGInfo *getSelectionDAGInfo() const {
- return &TSInfo;
- }
- virtual const X86InstrInfo *getInstrInfo() const {
- return &InstrInfo;
- }
- virtual X86JITInfo *getJITInfo() {
- return &JITInfo;
- }
-};
-
} // End llvm namespace
#endif
More information about the llvm-commits
mailing list