LLVM API Documentation

ARMTargetMachine.h

Go to the documentation of this file.
00001 //===-- ARMTargetMachine.h - Define TargetMachine for ARM -------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file declares the ARM specific subclass of TargetMachine.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef ARMTARGETMACHINE_H
00015 #define ARMTARGETMACHINE_H
00016 
00017 #include "llvm/Target/TargetMachine.h"
00018 #include "llvm/Target/TargetData.h"
00019 #include "llvm/Target/TargetFrameInfo.h"
00020 #include "ARMInstrInfo.h"
00021 #include "ARMFrameInfo.h"
00022 #include "ARMJITInfo.h"
00023 #include "ARMSubtarget.h"
00024 #include "ARMISelLowering.h"
00025 
00026 namespace llvm {
00027 
00028 class Module;
00029 
00030 class ARMTargetMachine : public LLVMTargetMachine {
00031   ARMSubtarget      Subtarget;
00032   const TargetData  DataLayout;       // Calculates type size & alignment
00033   ARMInstrInfo      InstrInfo;
00034   ARMFrameInfo      FrameInfo;
00035   ARMJITInfo        JITInfo;
00036   ARMTargetLowering TLInfo;
00037   Reloc::Model      DefRelocModel;    // Reloc model before it's overridden.
00038 
00039 protected:
00040   // To avoid having target depend on the asmprinter stuff libraries, asmprinter
00041   // set this functions to ctor pointer at startup time if they are linked in.
00042   typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o,
00043                                             ARMTargetMachine &tm);
00044   static AsmPrinterCtorFn AsmPrinterCtor;
00045 
00046 public:
00047   ARMTargetMachine(const Module &M, const std::string &FS, bool isThumb = false);
00048 
00049   virtual const ARMInstrInfo     *getInstrInfo() const { return &InstrInfo; }
00050   virtual const ARMFrameInfo     *getFrameInfo() const { return &FrameInfo; }
00051   virtual       ARMJITInfo       *getJITInfo()         { return &JITInfo; }
00052   virtual const ARMRegisterInfo  *getRegisterInfo() const {
00053     return &InstrInfo.getRegisterInfo();
00054   }
00055   virtual const TargetData       *getTargetData() const { return &DataLayout; }
00056   virtual const ARMSubtarget  *getSubtargetImpl() const { return &Subtarget; }
00057   virtual       ARMTargetLowering *getTargetLowering() const {
00058     return const_cast<ARMTargetLowering*>(&TLInfo);
00059   }
00060 
00061   static void registerAsmPrinter(AsmPrinterCtorFn F) {
00062     AsmPrinterCtor = F;
00063   }
00064 
00065   static unsigned getModuleMatchQuality(const Module &M);
00066   static unsigned getJITMatchQuality();
00067 
00068   virtual const TargetAsmInfo *createTargetAsmInfo() const;
00069 
00070   // Pass Pipeline Configuration
00071   virtual bool addInstSelector(PassManagerBase &PM, bool Fast);
00072   virtual bool addPreEmitPass(PassManagerBase &PM, bool Fast);
00073   virtual bool addAssemblyEmitter(PassManagerBase &PM, bool Fast,
00074                                   raw_ostream &Out);
00075   virtual bool addCodeEmitter(PassManagerBase &PM, bool Fast,
00076                               bool DumpAsm, MachineCodeEmitter &MCE);
00077   virtual bool addSimpleCodeEmitter(PassManagerBase &PM, bool Fast,
00078                                     bool DumpAsm, MachineCodeEmitter &MCE);
00079 };
00080 
00081 /// ThumbTargetMachine - Thumb target machine.
00082 ///
00083 class ThumbTargetMachine : public ARMTargetMachine {
00084 public:
00085   ThumbTargetMachine(const Module &M, const std::string &FS);
00086 
00087   static unsigned getJITMatchQuality();
00088   static unsigned getModuleMatchQuality(const Module &M);
00089 };
00090 
00091 } // end namespace llvm
00092 
00093 #endif



This web site is hosted by the Computer Science Department at the University of Illinois at Urbana-Champaign.