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 // Register the target
23 extern Target TheIA64Target;
24 static RegisterTarget<IA64TargetMachine> X(TheIA64Target, "ia64",
25 "IA-64 (Itanium) [experimental]");
27 // No assembler printer by default
28 IA64TargetMachine::AsmPrinterCtorFn IA64TargetMachine::AsmPrinterCtor = 0;
30 // Force static initialization.
31 extern "C" void LLVMInitializeIA64Target() { }
33 const TargetAsmInfo *IA64TargetMachine::createTargetAsmInfo() const {
34 return new IA64TargetAsmInfo(*this);
37 unsigned IA64TargetMachine::getModuleMatchQuality(const Module &M) {
38 // we match [iI][aA]*64
40 std::string TT = M.getTargetTriple();
43 if( (TT[0]=='i' || TT[0]=='I') &&
44 (TT[1]=='a' || TT[1]=='A') ) {
45 for(unsigned int i=2; i<(TT.size()-1); i++)
46 if(TT[i]=='6' && TT[i+1]=='4')
51 return 20; // strong match
53 // If the target triple is something non-ia64, we don't match.
54 if (!TT.empty()) return 0;
56 #if defined(__ia64__) || defined(__IA64__)
63 /// IA64TargetMachine ctor - Create an LP64 architecture model
65 IA64TargetMachine::IA64TargetMachine(const Target &T, const Module &M,
66 const std::string &FS)
67 : LLVMTargetMachine(T),
68 DataLayout("e-f80:128:128"),
69 FrameInfo(TargetFrameInfo::StackGrowsDown, 16, 0),
70 TLInfo(*this) { // FIXME? check this stuff
74 //===----------------------------------------------------------------------===//
75 // Pass Pipeline Configuration
76 //===----------------------------------------------------------------------===//
78 bool IA64TargetMachine::addInstSelector(PassManagerBase &PM,
79 CodeGenOpt::Level OptLevel) {
80 PM.add(createIA64DAGToDAGInstructionSelector(*this));
84 bool IA64TargetMachine::addPreEmitPass(PassManagerBase &PM,
85 CodeGenOpt::Level OptLevel) {
86 // Make sure everything is bundled happily
87 PM.add(createIA64BundlingPass(*this));
90 bool IA64TargetMachine::addAssemblyEmitter(PassManagerBase &PM,
91 CodeGenOpt::Level OptLevel,
93 formatted_raw_ostream &Out) {
94 // Output assembly language.
95 assert(AsmPrinterCtor && "AsmPrinter was not linked in");
97 PM.add(AsmPrinterCtor(Out, *this, Verbose));