Merge branch 'master' into msp430
[llvm/msp430.git] / lib / Target / ARM / ARMTargetMachine.h
blob3f65f71bbeb35982f327cbdb9582c67edd62b4e4
1 //===-- ARMTargetMachine.h - Define TargetMachine for ARM -------*- C++ -*-===//
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 declares the ARM specific subclass of TargetMachine.
12 //===----------------------------------------------------------------------===//
14 #ifndef ARMTARGETMACHINE_H
15 #define ARMTARGETMACHINE_H
17 #include "llvm/Target/TargetMachine.h"
18 #include "llvm/Target/TargetData.h"
19 #include "llvm/Target/TargetFrameInfo.h"
20 #include "ARMInstrInfo.h"
21 #include "ARMFrameInfo.h"
22 #include "ARMJITInfo.h"
23 #include "ARMSubtarget.h"
24 #include "ARMISelLowering.h"
26 namespace llvm {
28 class Module;
30 class ARMTargetMachine : public LLVMTargetMachine {
31 ARMSubtarget Subtarget;
32 const TargetData DataLayout; // Calculates type size & alignment
33 ARMInstrInfo InstrInfo;
34 ARMFrameInfo FrameInfo;
35 ARMJITInfo JITInfo;
36 ARMTargetLowering TLInfo;
37 Reloc::Model DefRelocModel; // Reloc model before it's overridden.
39 protected:
40 // To avoid having target depend on the asmprinter stuff libraries, asmprinter
41 // set this functions to ctor pointer at startup time if they are linked in.
42 typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o,
43 ARMTargetMachine &tm,
44 CodeGenOpt::Level OptLevel,
45 bool verbose);
46 static AsmPrinterCtorFn AsmPrinterCtor;
48 public:
49 ARMTargetMachine(const Module &M, const std::string &FS, bool isThumb = false);
51 virtual const ARMInstrInfo *getInstrInfo() const { return &InstrInfo; }
52 virtual const ARMFrameInfo *getFrameInfo() const { return &FrameInfo; }
53 virtual ARMJITInfo *getJITInfo() { return &JITInfo; }
54 virtual const ARMRegisterInfo *getRegisterInfo() const {
55 return &InstrInfo.getRegisterInfo();
57 virtual const TargetData *getTargetData() const { return &DataLayout; }
58 virtual const ARMSubtarget *getSubtargetImpl() const { return &Subtarget; }
59 virtual ARMTargetLowering *getTargetLowering() const {
60 return const_cast<ARMTargetLowering*>(&TLInfo);
63 static void registerAsmPrinter(AsmPrinterCtorFn F) {
64 AsmPrinterCtor = F;
67 static unsigned getModuleMatchQuality(const Module &M);
68 static unsigned getJITMatchQuality();
70 virtual const TargetAsmInfo *createTargetAsmInfo() const;
72 // Pass Pipeline Configuration
73 virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
74 virtual bool addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
75 virtual bool addAssemblyEmitter(PassManagerBase &PM,
76 CodeGenOpt::Level OptLevel,
77 bool Verbose, raw_ostream &Out);
78 virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
79 bool DumpAsm, MachineCodeEmitter &MCE);
80 virtual bool addSimpleCodeEmitter(PassManagerBase &PM,
81 CodeGenOpt::Level OptLevel,
82 bool DumpAsm,
83 MachineCodeEmitter &MCE);
86 /// ThumbTargetMachine - Thumb target machine.
87 ///
88 class ThumbTargetMachine : public ARMTargetMachine {
89 public:
90 ThumbTargetMachine(const Module &M, const std::string &FS);
92 static unsigned getJITMatchQuality();
93 static unsigned getModuleMatchQuality(const Module &M);
96 } // end namespace llvm
98 #endif