2008-11-07 10:59:00 +00:00
|
|
|
//===-- XCoreTargetMachine.cpp - Define TargetMachine for XCore -----------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "XCoreTargetMachine.h"
|
|
|
|
#include "XCore.h"
|
|
|
|
#include "llvm/Module.h"
|
|
|
|
#include "llvm/PassManager.h"
|
2012-02-03 05:12:41 +00:00
|
|
|
#include "llvm/CodeGen/Passes.h"
|
2011-08-24 18:08:43 +00:00
|
|
|
#include "llvm/Support/TargetRegistry.h"
|
2008-11-07 10:59:00 +00:00
|
|
|
using namespace llvm;
|
|
|
|
|
|
|
|
/// XCoreTargetMachine ctor - Create an ILP32 architecture model
|
|
|
|
///
|
2011-07-19 06:37:02 +00:00
|
|
|
XCoreTargetMachine::XCoreTargetMachine(const Target &T, StringRef TT,
|
2011-07-20 07:51:56 +00:00
|
|
|
StringRef CPU, StringRef FS,
|
2011-12-02 22:16:29 +00:00
|
|
|
const TargetOptions &Options,
|
2011-11-16 08:38:26 +00:00
|
|
|
Reloc::Model RM, CodeModel::Model CM,
|
|
|
|
CodeGenOpt::Level OL)
|
2011-12-02 22:16:29 +00:00
|
|
|
: LLVMTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL),
|
2011-06-30 01:53:36 +00:00
|
|
|
Subtarget(TT, CPU, FS),
|
2008-11-07 10:59:00 +00:00
|
|
|
DataLayout("e-p:32:32:32-a0:0:32-f32:32:32-f64:32:32-i1:8:32-i8:8:32-"
|
2009-11-07 19:07:32 +00:00
|
|
|
"i16:16:32-i32:32:32-i64:32:32-n32"),
|
2008-11-07 10:59:00 +00:00
|
|
|
InstrInfo(),
|
2011-01-10 12:39:04 +00:00
|
|
|
FrameLowering(Subtarget),
|
2010-05-11 17:31:57 +00:00
|
|
|
TLInfo(*this),
|
|
|
|
TSInfo(*this) {
|
2008-11-07 10:59:00 +00:00
|
|
|
}
|
|
|
|
|
2012-02-03 05:12:41 +00:00
|
|
|
namespace {
|
|
|
|
/// XCore Code Generator Pass Configuration Options.
|
|
|
|
class XCorePassConfig : public TargetPassConfig {
|
|
|
|
public:
|
2012-02-04 02:56:59 +00:00
|
|
|
XCorePassConfig(XCoreTargetMachine *TM, PassManagerBase &PM)
|
|
|
|
: TargetPassConfig(TM, PM) {}
|
2012-02-03 05:12:41 +00:00
|
|
|
|
|
|
|
XCoreTargetMachine &getXCoreTargetMachine() const {
|
|
|
|
return getTM<XCoreTargetMachine>();
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool addInstSelector();
|
|
|
|
};
|
|
|
|
} // namespace
|
|
|
|
|
2012-02-04 02:56:59 +00:00
|
|
|
TargetPassConfig *XCoreTargetMachine::createPassConfig(PassManagerBase &PM) {
|
|
|
|
return new XCorePassConfig(this, PM);
|
2012-02-03 05:12:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool XCorePassConfig::addInstSelector() {
|
2012-07-02 19:48:31 +00:00
|
|
|
addPass(createXCoreISelDag(getXCoreTargetMachine(), getOptLevel()));
|
2008-11-07 10:59:00 +00:00
|
|
|
return false;
|
|
|
|
}
|
2009-08-15 12:53:15 +00:00
|
|
|
|
|
|
|
// Force static initialization.
|
|
|
|
extern "C" void LLVMInitializeXCoreTarget() {
|
|
|
|
RegisterTargetMachine<XCoreTargetMachine> X(TheXCoreTarget);
|
|
|
|
}
|