SparcTargetMachine.cpp revision 1abf2cb59b8d63415780a03329307c0997b2670c
1//===-- SparcTargetMachine.cpp - Define TargetMachine for Sparc -----------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9// 10// 11//===----------------------------------------------------------------------===// 12 13#include "Sparc.h" 14#include "SparcTargetMachine.h" 15#include "llvm/PassManager.h" 16#include "llvm/Target/TargetRegistry.h" 17using namespace llvm; 18 19extern "C" void LLVMInitializeSparcTarget() { 20 // Register the target. 21 RegisterTargetMachine<SparcV8TargetMachine> X(TheSparcTarget); 22 RegisterTargetMachine<SparcV9TargetMachine> Y(TheSparcV9Target); 23} 24 25/// SparcTargetMachine ctor - Create an ILP32 architecture model 26/// 27SparcTargetMachine::SparcTargetMachine(const Target &T, const std::string &TT, 28 const std::string &CPU, 29 const std::string &FS, bool is64bit) 30 : LLVMTargetMachine(T, TT, CPU, FS), 31 Subtarget(TT, CPU, FS, is64bit), 32 DataLayout(Subtarget.getDataLayout()), 33 TLInfo(*this), TSInfo(*this), InstrInfo(Subtarget), 34 FrameLowering(Subtarget) { 35} 36 37bool SparcTargetMachine::addInstSelector(PassManagerBase &PM, 38 CodeGenOpt::Level OptLevel) { 39 PM.add(createSparcISelDag(*this)); 40 return false; 41} 42 43/// addPreEmitPass - This pass may be implemented by targets that want to run 44/// passes immediately before machine code is emitted. This should return 45/// true if -print-machineinstrs should print out the code after the passes. 46bool SparcTargetMachine::addPreEmitPass(PassManagerBase &PM, 47 CodeGenOpt::Level OptLevel){ 48 PM.add(createSparcFPMoverPass(*this)); 49 PM.add(createSparcDelaySlotFillerPass(*this)); 50 return true; 51} 52 53SparcV8TargetMachine::SparcV8TargetMachine(const Target &T, 54 const std::string &TT, 55 const std::string &CPU, 56 const std::string &FS) 57 : SparcTargetMachine(T, TT, CPU, FS, false) { 58} 59 60SparcV9TargetMachine::SparcV9TargetMachine(const Target &T, 61 const std::string &TT, 62 const std::string &CPU, 63 const std::string &FS) 64 : SparcTargetMachine(T, TT, CPU, FS, true) { 65} 66