SparcTargetMachine.cpp revision 0c795d61878156817cedbac51ec2921f2634c1a5
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 "SparcTargetAsmInfo.h" 14#include "SparcTargetMachine.h" 15#include "Sparc.h" 16#include "llvm/Module.h" 17#include "llvm/PassManager.h" 18#include "llvm/Target/TargetRegistry.h" 19using namespace llvm; 20 21extern "C" void LLVMInitializeSparcTarget() { 22 // Register the target. 23 RegisterTargetMachine<SparcTargetMachine> X(TheSparcTarget); 24} 25 26const TargetAsmInfo *SparcTargetMachine::createTargetAsmInfo() const { 27 // FIXME: Handle Solaris subtarget someday :) 28 return new SparcELFTargetAsmInfo(*this); 29} 30 31/// SparcTargetMachine ctor - Create an ILP32 architecture model 32/// 33SparcTargetMachine::SparcTargetMachine(const Target &T, const Module &M, 34 const std::string &FS) 35 : LLVMTargetMachine(T), 36 DataLayout("E-p:32:32-f128:128:128"), 37 Subtarget(M, FS), TLInfo(*this), InstrInfo(Subtarget), 38 FrameInfo(TargetFrameInfo::StackGrowsDown, 8, 0) { 39} 40 41bool SparcTargetMachine::addInstSelector(PassManagerBase &PM, 42 CodeGenOpt::Level OptLevel) { 43 PM.add(createSparcISelDag(*this)); 44 return false; 45} 46 47/// addPreEmitPass - This pass may be implemented by targets that want to run 48/// passes immediately before machine code is emitted. This should return 49/// true if -print-machineinstrs should print out the code after the passes. 50bool SparcTargetMachine::addPreEmitPass(PassManagerBase &PM, 51 CodeGenOpt::Level OptLevel){ 52 PM.add(createSparcFPMoverPass(*this)); 53 PM.add(createSparcDelaySlotFillerPass(*this)); 54 return true; 55} 56