1 //===-- ARMTargetMachine.h - Define TargetMachine for ARM -------*- C++ -*-===//
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 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"
30 class ARMTargetMachine : public LLVMTargetMachine {
31 ARMSubtarget Subtarget;
32 const TargetData DataLayout; // Calculates type size & alignment
33 ARMInstrInfo InstrInfo;
34 ARMFrameInfo FrameInfo;
36 ARMTargetLowering TLInfo;
39 // To avoid having target depend on the asmprinter stuff libraries, asmprinter
40 // set this functions to ctor pointer at startup time if they are linked in.
41 typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o,
42 ARMTargetMachine &tm);
43 static AsmPrinterCtorFn AsmPrinterCtor;
46 ARMTargetMachine(const Module &M, const std::string &FS, bool isThumb = false);
48 virtual const ARMInstrInfo *getInstrInfo() const { return &InstrInfo; }
49 virtual const ARMFrameInfo *getFrameInfo() const { return &FrameInfo; }
50 virtual ARMJITInfo *getJITInfo() { return &JITInfo; }
51 virtual const ARMRegisterInfo *getRegisterInfo() const {
52 return &InstrInfo.getRegisterInfo();
54 virtual const TargetData *getTargetData() const { return &DataLayout; }
55 virtual const ARMSubtarget *getSubtargetImpl() const { return &Subtarget; }
56 virtual ARMTargetLowering *getTargetLowering() const {
57 return const_cast<ARMTargetLowering*>(&TLInfo);
60 static void registerAsmPrinter(AsmPrinterCtorFn F) {
64 static unsigned getModuleMatchQuality(const Module &M);
65 static unsigned getJITMatchQuality();
67 virtual const TargetAsmInfo *createTargetAsmInfo() const;
69 // Pass Pipeline Configuration
70 virtual bool addInstSelector(PassManagerBase &PM, bool Fast);
71 virtual bool addPreEmitPass(PassManagerBase &PM, bool Fast);
72 virtual bool addAssemblyEmitter(PassManagerBase &PM, bool Fast,
74 virtual bool addCodeEmitter(PassManagerBase &PM, bool Fast,
75 bool DumpAsm, MachineCodeEmitter &MCE);
76 virtual bool addSimpleCodeEmitter(PassManagerBase &PM, bool Fast,
77 bool DumpAsm, MachineCodeEmitter &MCE);
80 /// ThumbTargetMachine - Thumb target machine.
82 class ThumbTargetMachine : public ARMTargetMachine {
84 ThumbTargetMachine(const Module &M, const std::string &FS);
86 static unsigned getJITMatchQuality();
87 static unsigned getModuleMatchQuality(const Module &M);
90 } // end namespace llvm