LLVM API Documentation
00001 //===-- IA64TargetMachine.cpp - Define TargetMachine for IA64 -------------===// 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 // This file implements the IA64 specific subclass of TargetMachine. 00011 // 00012 //===----------------------------------------------------------------------===// 00013 00014 #include "IA64TargetAsmInfo.h" 00015 #include "IA64TargetMachine.h" 00016 #include "IA64.h" 00017 #include "llvm/Module.h" 00018 #include "llvm/PassManager.h" 00019 #include "llvm/Target/TargetMachineRegistry.h" 00020 using namespace llvm; 00021 00022 /// IA64TargetMachineModule - Note that this is used on hosts that cannot link 00023 /// in a library unless there are references into the library. In particular, 00024 /// it seems that it is not possible to get things to work on Win32 without 00025 /// this. Though it is unused, do not remove it. 00026 extern "C" int IA64TargetMachineModule; 00027 int IA64TargetMachineModule = 0; 00028 00029 static RegisterTarget<IA64TargetMachine> X("ia64", 00030 "IA-64 (Itanium) [experimental]"); 00031 00032 const TargetAsmInfo *IA64TargetMachine::createTargetAsmInfo() const { 00033 return new IA64TargetAsmInfo(*this); 00034 } 00035 00036 unsigned IA64TargetMachine::getModuleMatchQuality(const Module &M) { 00037 // we match [iI][aA]*64 00038 bool seenIA64=false; 00039 std::string TT = M.getTargetTriple(); 00040 00041 if (TT.size() >= 4) { 00042 if( (TT[0]=='i' || TT[0]=='I') && 00043 (TT[1]=='a' || TT[1]=='A') ) { 00044 for(unsigned int i=2; i<(TT.size()-1); i++) 00045 if(TT[i]=='6' && TT[i+1]=='4') 00046 seenIA64=true; 00047 } 00048 00049 if (seenIA64) 00050 return 20; // strong match 00051 } 00052 // If the target triple is something non-ia64, we don't match. 00053 if (!TT.empty()) return 0; 00054 00055 #if defined(__ia64__) || defined(__IA64__) 00056 return 5; 00057 #else 00058 return 0; 00059 #endif 00060 } 00061 00062 /// IA64TargetMachine ctor - Create an LP64 architecture model 00063 /// 00064 IA64TargetMachine::IA64TargetMachine(const Module &M, const std::string &FS) 00065 : DataLayout("e-f80:128:128"), 00066 FrameInfo(TargetFrameInfo::StackGrowsDown, 16, 0), 00067 TLInfo(*this) { // FIXME? check this stuff 00068 } 00069 00070 00071 //===----------------------------------------------------------------------===// 00072 // Pass Pipeline Configuration 00073 //===----------------------------------------------------------------------===// 00074 00075 bool IA64TargetMachine::addInstSelector(PassManagerBase &PM, bool Fast) { 00076 PM.add(createIA64DAGToDAGInstructionSelector(*this)); 00077 return false; 00078 } 00079 00080 bool IA64TargetMachine::addPreEmitPass(PassManagerBase &PM, bool Fast) { 00081 // Make sure everything is bundled happily 00082 PM.add(createIA64BundlingPass(*this)); 00083 return true; 00084 } 00085 bool IA64TargetMachine::addAssemblyEmitter(PassManagerBase &PM, bool Fast, 00086 raw_ostream &Out) { 00087 PM.add(createIA64CodePrinterPass(Out, *this)); 00088 return false; 00089 } 00090
This web site is hosted by the Computer Science Department at the University of Illinois at Urbana-Champaign.