Add a dummy subtarget to the CPP backend target machine. This will

allow us to forward all of the standard TargetMachine calls to the
subtarget and still return null as we were before.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214727 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Christopher 2014-08-04 16:40:55 +00:00
parent 977b978f93
commit 986a9fa1b9

View File

@ -16,24 +16,30 @@
#include "llvm/IR/DataLayout.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetSubtargetInfo.h"
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) {}
: TargetMachine(T, TT, CPU, FS, Options), Subtarget() {}
private:
CPPSubtarget Subtarget;
public:
const CPPSubtarget *getSubtargetImpl() const override { return &Subtarget; }
bool addPassesToEmitFile(PassManagerBase &PM, formatted_raw_ostream &Out,
CodeGenFileType FileType, bool DisableVerify,
AnalysisID StartAfter,
AnalysisID StopAfter) override;
const DataLayout *getDataLayout() const override { return nullptr; }
};
extern Target TheCppBackendTarget;