Added -print-emitted-asm to print out JIT generated asm to cerr.
[oota-llvm.git] / lib / Target / ARM / ARMTargetMachine.h
1 //===-- ARMTargetMachine.h - Define TargetMachine for ARM -------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by the "Instituto Nokia de Tecnologia" and
6 // is distributed under the University of Illinois Open Source
7 // License. See LICENSE.TXT for details.
8 //
9 //===----------------------------------------------------------------------===//
10 //
11 // This file declares the ARM specific subclass of TargetMachine.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef ARMTARGETMACHINE_H
16 #define ARMTARGETMACHINE_H
17
18 #include "llvm/Target/TargetMachine.h"
19 #include "llvm/Target/TargetData.h"
20 #include "llvm/Target/TargetFrameInfo.h"
21 #include "ARMInstrInfo.h"
22 #include "ARMFrameInfo.h"
23 #include "ARMJITInfo.h"
24 #include "ARMSubtarget.h"
25 #include "ARMISelLowering.h"
26
27 namespace llvm {
28
29 class Module;
30
31 class ARMTargetMachine : public LLVMTargetMachine {
32   ARMSubtarget      Subtarget;
33   const TargetData  DataLayout;       // Calculates type size & alignment
34   ARMInstrInfo      InstrInfo;
35   ARMFrameInfo      FrameInfo;
36   ARMJITInfo        JITInfo;
37   ARMTargetLowering TLInfo;
38
39 public:
40   ARMTargetMachine(const Module &M, const std::string &FS, bool isThumb = false);
41
42   virtual const ARMInstrInfo *getInstrInfo() const { return &InstrInfo; }
43   virtual const TargetFrameInfo  *getFrameInfo() const { return &FrameInfo; }
44   virtual       TargetJITInfo    *getJITInfo()         { return &JITInfo; }
45   virtual const MRegisterInfo *getRegisterInfo() const {
46     return &InstrInfo.getRegisterInfo();
47   }
48   virtual const TargetData       *getTargetData() const { return &DataLayout; }
49   virtual const ARMSubtarget  *getSubtargetImpl() const { return &Subtarget; }
50   virtual       ARMTargetLowering *getTargetLowering() const { 
51     return const_cast<ARMTargetLowering*>(&TLInfo); 
52   }
53   static unsigned getModuleMatchQuality(const Module &M);
54   static unsigned getJITMatchQuality();
55
56   virtual const TargetAsmInfo *createTargetAsmInfo() const;
57   
58   // Pass Pipeline Configuration
59   virtual bool addInstSelector(FunctionPassManager &PM, bool Fast);
60   virtual bool addPreEmitPass(FunctionPassManager &PM, bool Fast);
61   virtual bool addAssemblyEmitter(FunctionPassManager &PM, bool Fast, 
62                                   std::ostream &Out);
63   virtual bool addCodeEmitter(FunctionPassManager &PM, bool Fast,
64                               bool DumpAsm, MachineCodeEmitter &MCE);
65   virtual bool addSimpleCodeEmitter(FunctionPassManager &PM, bool Fast,
66                                     bool DumpAsm, MachineCodeEmitter &MCE);
67 };
68
69 /// ThumbTargetMachine - Thumb target machine.
70 ///
71 class ThumbTargetMachine : public ARMTargetMachine {
72 public:
73   ThumbTargetMachine(const Module &M, const std::string &FS);
74
75   static unsigned getJITMatchQuality();
76   static unsigned getModuleMatchQuality(const Module &M);
77 };
78
79 } // end namespace llvm
80
81 #endif