58 lines
1.7 KiB
C++
58 lines
1.7 KiB
C++
#include "Foot.h"
|
|
#include "FootTargetMachine.h"
|
|
#include "TargetInfo/FootTargetInfo.h"
|
|
#include "FootTargetObjectFile.h"
|
|
#include "llvm/CodeGen/GlobalISel/IRTranslator.h"
|
|
#include "llvm/MC/TargetRegistry.h"
|
|
using namespace llvm;
|
|
|
|
static const char* FootDataLayoutStr =
|
|
"e-"
|
|
"p:16:32-"
|
|
"n8:16:32-"
|
|
"i64:64:64-i32:32:32-i16:16:32-"
|
|
"f32:32:32-"
|
|
"v32:32:32";
|
|
|
|
using namespace llvm;
|
|
|
|
FootTargetMachine::FootTargetMachine(const Target &T, const Triple &TT,
|
|
StringRef CPU, StringRef FS,
|
|
const TargetOptions &Options,
|
|
std::optional<Reloc::Model> RM,
|
|
std::optional<CodeModel::Model> CM,
|
|
CodeGenOptLevel OL,
|
|
bool JIT)
|
|
: CodeGenTargetMachineImpl(T, FootDataLayoutStr, TT, CPU, FS, Options, RM ? *RM : Reloc::Static, CM ? *CM : CodeModel::Small, OL) {
|
|
initAsmInfo();
|
|
}
|
|
|
|
FootTargetMachine::~FootTargetMachine() = default;
|
|
|
|
TargetPassConfig *FootTargetMachine::createPassConfig(PassManagerBase &PM) {
|
|
return new FootPassConfig(*this, PM);
|
|
}
|
|
|
|
TargetLoweringObjectFile *FootTargetMachine::getObjFileLowering() const {
|
|
static FootTargetObjectFileELF TLOF;
|
|
|
|
return &TLOF;
|
|
}
|
|
|
|
FootPassConfig::FootPassConfig(TargetMachine &TM, PassManagerBase &PM) :
|
|
TargetPassConfig(TM, PM) {}
|
|
|
|
bool FootPassConfig::addInstSelector() {
|
|
addPass(createFootISelDAG(getFootTargetMachine()));
|
|
return false;
|
|
}
|
|
|
|
void FootPassConfig::addIRPasses() {
|
|
TargetPassConfig::addIRPasses();
|
|
}
|
|
|
|
extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeFootTarget()
|
|
{
|
|
RegisterTargetMachine<FootTargetMachine> X(getTheFootTarget());
|
|
}
|