opnsense-src/contrib/llvm/lib/Target/Sparc/SparcTargetMachine.cpp

68 lines
2.4 KiB
C++
Raw Normal View History

2009-06-02 13:52:33 -04:00
//===-- SparcTargetMachine.cpp - Define TargetMachine for Sparc -----------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
//
//===----------------------------------------------------------------------===//
#include "Sparc.h"
2009-10-14 13:57:32 -04:00
#include "SparcMCAsmInfo.h"
2009-06-02 13:52:33 -04:00
#include "SparcTargetMachine.h"
#include "llvm/PassManager.h"
2009-10-14 13:57:32 -04:00
#include "llvm/Target/TargetRegistry.h"
2009-06-02 13:52:33 -04:00
using namespace llvm;
2009-10-14 13:57:32 -04:00
extern "C" void LLVMInitializeSparcTarget() {
// Register the target.
2010-02-16 04:30:23 -05:00
RegisterTargetMachine<SparcV8TargetMachine> X(TheSparcTarget);
RegisterTargetMachine<SparcV9TargetMachine> Y(TheSparcV9Target);
RegisterAsmInfo<SparcELFMCAsmInfo> A(TheSparcTarget);
RegisterAsmInfo<SparcELFMCAsmInfo> B(TheSparcV9Target);
2009-06-02 13:52:33 -04:00
}
/// SparcTargetMachine ctor - Create an ILP32 architecture model
///
2009-10-14 13:57:32 -04:00
SparcTargetMachine::SparcTargetMachine(const Target &T, const std::string &TT,
2010-02-16 04:30:23 -05:00
const std::string &FS, bool is64bit)
2009-10-14 13:57:32 -04:00
: LLVMTargetMachine(T, TT),
2010-02-16 04:30:23 -05:00
Subtarget(TT, FS, is64bit),
DataLayout(Subtarget.getDataLayout()),
TLInfo(*this), TSInfo(*this), InstrInfo(Subtarget),
FrameLowering(Subtarget) {
2009-06-02 13:52:33 -04:00
}
bool SparcTargetMachine::addInstSelector(PassManagerBase &PM,
CodeGenOpt::Level OptLevel) {
PM.add(createSparcISelDag(*this));
return false;
}
/// addPreEmitPass - This pass may be implemented by targets that want to run
/// passes immediately before machine code is emitted. This should return
/// true if -print-machineinstrs should print out the code after the passes.
bool SparcTargetMachine::addPreEmitPass(PassManagerBase &PM,
CodeGenOpt::Level OptLevel){
PM.add(createSparcFPMoverPass(*this));
PM.add(createSparcDelaySlotFillerPass(*this));
return true;
}
2010-02-16 04:30:23 -05:00
SparcV8TargetMachine::SparcV8TargetMachine(const Target &T,
const std::string &TT,
const std::string &FS)
: SparcTargetMachine(T, TT, FS, false) {
}
SparcV9TargetMachine::SparcV9TargetMachine(const Target &T,
const std::string &TT,
const std::string &FS)
: SparcTargetMachine(T, TT, FS, true) {
}