LLVM API Documentation
00001 //===-- SparcTargetMachine.cpp - Define TargetMachine for Sparc -----------===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // 00011 //===----------------------------------------------------------------------===// 00012 00013 #include "SparcTargetAsmInfo.h" 00014 #include "SparcTargetMachine.h" 00015 #include "Sparc.h" 00016 #include "llvm/PassManager.h" 00017 #include "llvm/Target/TargetRegistry.h" 00018 using namespace llvm; 00019 00020 extern "C" void LLVMInitializeSparcTarget() { 00021 // Register the target. 00022 RegisterTargetMachine<SparcTargetMachine> X(TheSparcTarget); 00023 RegisterAsmInfo<SparcELFTargetAsmInfo> Y(TheSparcTarget); 00024 00025 } 00026 00027 /// SparcTargetMachine ctor - Create an ILP32 architecture model 00028 /// 00029 SparcTargetMachine::SparcTargetMachine(const Target &T, const std::string &TT, 00030 const std::string &FS) 00031 : LLVMTargetMachine(T, TT), 00032 DataLayout("E-p:32:32-f128:128:128"), 00033 Subtarget(TT, FS), TLInfo(*this), InstrInfo(Subtarget), 00034 FrameInfo(TargetFrameInfo::StackGrowsDown, 8, 0) { 00035 } 00036 00037 bool SparcTargetMachine::addInstSelector(PassManagerBase &PM, 00038 CodeGenOpt::Level OptLevel) { 00039 PM.add(createSparcISelDag(*this)); 00040 return false; 00041 } 00042 00043 /// addPreEmitPass - This pass may be implemented by targets that want to run 00044 /// passes immediately before machine code is emitted. This should return 00045 /// true if -print-machineinstrs should print out the code after the passes. 00046 bool SparcTargetMachine::addPreEmitPass(PassManagerBase &PM, 00047 CodeGenOpt::Level OptLevel){ 00048 PM.add(createSparcFPMoverPass(*this)); 00049 PM.add(createSparcDelaySlotFillerPass(*this)); 00050 return true; 00051 }