1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

Remove the target independent TargetMachine::getSubtarget and

TargetMachine::getSubtargetImpl routines.

This keeps the target independent code free of bare subtarget
calls while the remainder of the backends are migrated, or not
if they don't wish to support per-function subtargets as would
be needed for function multiversioning or LTO of disparate
cpu subarchitecture types, e.g.

clang -msse4.2 -c foo.c -emit-llvm -o foo.bc
clang -c bar.c -emit-llvm -o bar.bc
llvm-link foo.bc bar.bc -o baz.bc
llc baz.bc

and get appropriate code for what the command lines requested.

llvm-svn: 232885
This commit is contained in:
Eric Christopher 2015-03-21 04:22:23 +00:00
parent e8e68a5117
commit c777d8d845
12 changed files with 25 additions and 25 deletions

View File

@ -108,11 +108,8 @@ public:
/// getSubtargetImpl - virtual method implemented by subclasses that returns
/// a reference to that target's TargetSubtargetInfo-derived member variable.
virtual const TargetSubtargetInfo *getSubtargetImpl() const {
return nullptr;
}
virtual const TargetSubtargetInfo *getSubtargetImpl(const Function &) const {
return getSubtargetImpl();
return nullptr;
}
virtual TargetLoweringObjectFile *getObjFileLowering() const {
return nullptr;
@ -121,9 +118,6 @@ public:
/// getSubtarget - This method returns a pointer to the specified type of
/// TargetSubtargetInfo. In debug builds, it verifies that the object being
/// returned is of the correct type.
template<typename STC> const STC &getSubtarget() const {
return *static_cast<const STC*>(getSubtargetImpl());
}
template <typename STC> const STC &getSubtarget(const Function &F) const {
return *static_cast<const STC*>(getSubtargetImpl(F));
}

View File

@ -44,7 +44,7 @@ public:
bool isLittle);
~ARMBaseTargetMachine() override;
const ARMSubtarget *getSubtargetImpl() const override { return &Subtarget; }
const ARMSubtarget *getSubtargetImpl() const { return &Subtarget; }
const ARMSubtarget *getSubtargetImpl(const Function &F) const override;
bool isLittleEndian() const { return isLittle; }

View File

@ -27,7 +27,10 @@ public:
const TargetOptions &Options, Reloc::Model RM,
CodeModel::Model CM, CodeGenOpt::Level OL);
const BPFSubtarget *getSubtargetImpl() const override { return &Subtarget; }
const BPFSubtarget *getSubtargetImpl() const { return &Subtarget; }
const BPFSubtarget *getSubtargetImpl(const Function &) const override {
return &Subtarget;
}
TargetPassConfig *createPassConfig(PassManagerBase &PM) override;

View File

@ -22,20 +22,13 @@ namespace llvm {
class formatted_raw_ostream;
class CPPSubtarget : public TargetSubtargetInfo {
};
struct CPPTargetMachine : public TargetMachine {
CPPTargetMachine(const Target &T, StringRef TT, StringRef CPU, StringRef FS,
const TargetOptions &Options, Reloc::Model RM,
CodeModel::Model CM, CodeGenOpt::Level OL)
: TargetMachine(T, "", TT, CPU, FS, Options), Subtarget() {}
private:
CPPSubtarget Subtarget;
: TargetMachine(T, "", TT, CPU, FS, Options) {}
public:
const CPPSubtarget *getSubtargetImpl() const override { return &Subtarget; }
bool addPassesToEmitFile(PassManagerBase &PM, formatted_raw_ostream &Out,
CodeGenFileType FileType, bool DisableVerify,
AnalysisID StartAfter,

View File

@ -32,7 +32,7 @@ public:
Reloc::Model RM, CodeModel::Model CM,
CodeGenOpt::Level OL);
~HexagonTargetMachine() override;
const HexagonSubtarget *getSubtargetImpl() const override {
const HexagonSubtarget *getSubtargetImpl(const Function &) const override {
return &Subtarget;
}
static unsigned getModuleMatchQuality(const Module &M);

View File

@ -34,7 +34,7 @@ public:
CodeGenOpt::Level OL);
~MSP430TargetMachine() override;
const MSP430Subtarget *getSubtargetImpl() const override {
const MSP430Subtarget *getSubtargetImpl(const Function &F) const override {
return &Subtarget;
}
TargetPassConfig *createPassConfig(PassManagerBase &PM) override;

View File

@ -46,7 +46,7 @@ public:
TargetIRAnalysis getTargetIRAnalysis() override;
const MipsSubtarget *getSubtargetImpl() const override {
const MipsSubtarget *getSubtargetImpl() const {
if (Subtarget)
return Subtarget;
return &DefaultSubtarget;

View File

@ -39,7 +39,10 @@ public:
CodeModel::Model CM, CodeGenOpt::Level OP, bool is64bit);
~NVPTXTargetMachine() override;
const NVPTXSubtarget *getSubtargetImpl() const override { return &Subtarget; }
const NVPTXSubtarget *getSubtargetImpl(const Function &) const override {
return &Subtarget;
}
const NVPTXSubtarget *getSubtargetImpl() const { return &Subtarget; }
bool is64Bit() const { return is64bit; }
NVPTX::DrvInterface getDrvInterface() const { return drvInterface; }
ManagedStringPool *getManagedStrPool() const {

View File

@ -42,7 +42,8 @@ public:
CodeModel::Model CM, CodeGenOpt::Level OL);
~AMDGPUTargetMachine();
const AMDGPUSubtarget *getSubtargetImpl() const override {
const AMDGPUSubtarget *getSubtargetImpl() const { return &Subtarget; }
const AMDGPUSubtarget *getSubtargetImpl(const Function &) const override {
return &Subtarget;
}
const AMDGPUIntrinsicInfo *getIntrinsicInfo() const override {

View File

@ -30,7 +30,9 @@ public:
CodeGenOpt::Level OL, bool is64bit);
~SparcTargetMachine() override;
const SparcSubtarget *getSubtargetImpl() const override { return &Subtarget; }
const SparcSubtarget *getSubtargetImpl(const Function &) const override {
return &Subtarget;
}
// Pass Pipeline Configuration
TargetPassConfig *createPassConfig(PassManagerBase &PM) override;

View File

@ -33,7 +33,8 @@ public:
CodeGenOpt::Level OL);
~SystemZTargetMachine() override;
const SystemZSubtarget *getSubtargetImpl() const override {
const SystemZSubtarget *getSubtargetImpl() const { return &Subtarget; }
const SystemZSubtarget *getSubtargetImpl(const Function &) const override {
return &Subtarget;
}
// Override LLVMTargetMachine

View File

@ -29,7 +29,10 @@ public:
CodeGenOpt::Level OL);
~XCoreTargetMachine() override;
const XCoreSubtarget *getSubtargetImpl() const override { return &Subtarget; }
const XCoreSubtarget *getSubtargetImpl() const { return &Subtarget; }
const XCoreSubtarget *getSubtargetImpl(const Function &) const override {
return &Subtarget;
}
// Pass Pipeline Configuration
TargetPassConfig *createPassConfig(PassManagerBase &PM) override;