1 //===-- IA64TargetMachine.cpp - Define TargetMachine for IA64 -------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file implements the IA64 specific subclass of TargetMachine.
12 //===----------------------------------------------------------------------===//
14 #include "IA64TargetAsmInfo.h"
15 #include "IA64TargetMachine.h"
17 #include "llvm/Module.h"
18 #include "llvm/PassManager.h"
19 #include "llvm/Target/TargetMachineRegistry.h"
22 /// IA64TargetMachineModule - Note that this is used on hosts that cannot link
23 /// in a library unless there are references into the library. In particular,
24 /// it seems that it is not possible to get things to work on Win32 without
25 /// this. Though it is unused, do not remove it.
26 extern "C" int IA64TargetMachineModule;
27 int IA64TargetMachineModule = 0;
29 static RegisterTarget<IA64TargetMachine> X("ia64",
30 "IA-64 (Itanium) [experimental]");
32 // Force static initialization when called from llvm/InitializeAllTargets.h
34 void InitializeIA64Target() { }
37 const TargetAsmInfo *IA64TargetMachine::createTargetAsmInfo() const {
38 return new IA64TargetAsmInfo(*this);
41 unsigned IA64TargetMachine::getModuleMatchQuality(const Module &M) {
42 // we match [iI][aA]*64
44 std::string TT = M.getTargetTriple();
47 if( (TT[0]=='i' || TT[0]=='I') &&
48 (TT[1]=='a' || TT[1]=='A') ) {
49 for(unsigned int i=2; i<(TT.size()-1); i++)
50 if(TT[i]=='6' && TT[i+1]=='4')
55 return 20; // strong match
57 // If the target triple is something non-ia64, we don't match.
58 if (!TT.empty()) return 0;
60 #if defined(__ia64__) || defined(__IA64__)
67 /// IA64TargetMachine ctor - Create an LP64 architecture model
69 IA64TargetMachine::IA64TargetMachine(const Module &M, const std::string &FS)
70 : DataLayout("e-f80:128:128"),
71 FrameInfo(TargetFrameInfo::StackGrowsDown, 16, 0),
72 TLInfo(*this) { // FIXME? check this stuff
76 //===----------------------------------------------------------------------===//
77 // Pass Pipeline Configuration
78 //===----------------------------------------------------------------------===//
80 bool IA64TargetMachine::addInstSelector(PassManagerBase &PM,
81 CodeGenOpt::Level OptLevel){
82 PM.add(createIA64DAGToDAGInstructionSelector(*this));
86 bool IA64TargetMachine::addPreEmitPass(PassManagerBase &PM,
87 CodeGenOpt::Level OptLevel) {
88 // Make sure everything is bundled happily
89 PM.add(createIA64BundlingPass(*this));
92 bool IA64TargetMachine::addAssemblyEmitter(PassManagerBase &PM,
93 CodeGenOpt::Level OptLevel,
96 PM.add(createIA64CodePrinterPass(Out, *this, OptLevel, Verbose));