mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-15 05:24:01 +00:00
Added TargetPassConfig. The first little step toward configuring codegen passes.
Allows command line overrides to be centralized in LLVMTargetMachine.cpp. LLVMTargetMachine can intercept common passes and give precedence to command line overrides. Allows adding "internal" target configuration options without touching TargetOptions. Encapsulates the PassManager. Provides a good point to initialize all CodeGen passes so that Pass ID's can be used in APIs. Allows modifying the target configuration hooks without rebuilding the world. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149672 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -14,6 +14,7 @@
|
||||
#include "XCore.h"
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm/CodeGen/Passes.h"
|
||||
#include "llvm/Support/TargetRegistry.h"
|
||||
using namespace llvm;
|
||||
|
||||
@ -34,8 +35,29 @@ XCoreTargetMachine::XCoreTargetMachine(const Target &T, StringRef TT,
|
||||
TSInfo(*this) {
|
||||
}
|
||||
|
||||
bool XCoreTargetMachine::addInstSelector(PassManagerBase &PM) {
|
||||
PM.add(createXCoreISelDag(*this, getOptLevel()));
|
||||
namespace {
|
||||
/// XCore Code Generator Pass Configuration Options.
|
||||
class XCorePassConfig : public TargetPassConfig {
|
||||
public:
|
||||
XCorePassConfig(XCoreTargetMachine *TM, PassManagerBase &PM,
|
||||
bool DisableVerifyFlag)
|
||||
: TargetPassConfig(TM, PM, DisableVerifyFlag) {}
|
||||
|
||||
XCoreTargetMachine &getXCoreTargetMachine() const {
|
||||
return getTM<XCoreTargetMachine>();
|
||||
}
|
||||
|
||||
virtual bool addInstSelector();
|
||||
};
|
||||
} // namespace
|
||||
|
||||
TargetPassConfig *XCoreTargetMachine::createPassConfig(PassManagerBase &PM,
|
||||
bool DisableVerify) {
|
||||
return new XCorePassConfig(this, PM, DisableVerify);
|
||||
}
|
||||
|
||||
bool XCorePassConfig::addInstSelector() {
|
||||
PM.add(createXCoreISelDag(getXCoreTargetMachine(), getOptLevel()));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user