Remove old style hacks to register AsmPrinter into TargetMachine.
[oota-llvm.git] / lib / Target / IA64 / IA64TargetMachine.cpp
1 //===-- IA64TargetMachine.cpp - Define TargetMachine for IA64 -------------===//
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 // This file implements the IA64 specific subclass of TargetMachine.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "IA64TargetAsmInfo.h"
15 #include "IA64TargetMachine.h"
16 #include "IA64.h"
17 #include "llvm/Module.h"
18 #include "llvm/PassManager.h"
19 #include "llvm/Target/TargetMachineRegistry.h"
20 using namespace llvm;
21
22 // Register the target
23 extern Target TheIA64Target;
24 static RegisterTarget<IA64TargetMachine> X(TheIA64Target, "ia64",
25                                            "IA-64 (Itanium) [experimental]");
26
27 // Force static initialization.
28 extern "C" void LLVMInitializeIA64Target() { }
29
30 const TargetAsmInfo *IA64TargetMachine::createTargetAsmInfo() const {
31   return new IA64TargetAsmInfo(*this);
32 }
33
34 /// IA64TargetMachine ctor - Create an LP64 architecture model
35 ///
36 IA64TargetMachine::IA64TargetMachine(const Target &T, const Module &M, 
37                                      const std::string &FS)
38   : LLVMTargetMachine(T),
39     DataLayout("e-f80:128:128"),
40     FrameInfo(TargetFrameInfo::StackGrowsDown, 16, 0),
41     TLInfo(*this) { // FIXME? check this stuff
42 }
43
44
45 //===----------------------------------------------------------------------===//
46 // Pass Pipeline Configuration
47 //===----------------------------------------------------------------------===//
48
49 bool IA64TargetMachine::addInstSelector(PassManagerBase &PM,
50                                         CodeGenOpt::Level OptLevel) {
51   PM.add(createIA64DAGToDAGInstructionSelector(*this));
52   return false;
53 }
54
55 bool IA64TargetMachine::addPreEmitPass(PassManagerBase &PM,
56                                        CodeGenOpt::Level OptLevel) {
57   // Make sure everything is bundled happily
58   PM.add(createIA64BundlingPass(*this));
59   return true;
60 }
61 bool IA64TargetMachine::addAssemblyEmitter(PassManagerBase &PM,
62                                            CodeGenOpt::Level OptLevel,
63                                            bool Verbose,
64                                            formatted_raw_ostream &Out) {
65   FunctionPass *Printer = getTarget().createAsmPrinter(Out, *this, Verbose);
66   if (!Printer)
67     llvm_report_error("unable to create assembly printer");
68   PM.add(Printer);
69   return false;
70 }