1 //===-- MipsTargetMachine.h - Define TargetMachine for Mips -00--*- 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 Mips specific subclass of TargetMachine.
12 //===----------------------------------------------------------------------===//
14 #ifndef MIPSTARGETMACHINE_H
15 #define MIPSTARGETMACHINE_H
17 #include "MipsSubtarget.h"
18 #include "MipsInstrInfo.h"
19 #include "MipsISelLowering.h"
20 #include "llvm/Target/TargetMachine.h"
21 #include "llvm/Target/TargetData.h"
22 #include "llvm/Target/TargetFrameInfo.h"
25 class formatted_raw_ostream;
27 class MipsTargetMachine : public LLVMTargetMachine {
28 MipsSubtarget Subtarget;
29 const TargetData DataLayout; // Calculates type size & alignment
30 MipsInstrInfo InstrInfo;
31 TargetFrameInfo FrameInfo;
32 MipsTargetLowering TLInfo;
35 virtual const TargetAsmInfo *createTargetAsmInfo() const;
37 // To avoid having target depend on the asmprinter stuff libraries,
38 // asmprinter set this functions to ctor pointer at startup time if they are
40 typedef FunctionPass *(*AsmPrinterCtorFn)(formatted_raw_ostream &o,
43 static AsmPrinterCtorFn AsmPrinterCtor;
46 MipsTargetMachine(const Target &T, const Module &M, const std::string &FS,
49 static void registerAsmPrinter(AsmPrinterCtorFn F) {
53 virtual const MipsInstrInfo *getInstrInfo() const
54 { return &InstrInfo; }
55 virtual const TargetFrameInfo *getFrameInfo() const
56 { return &FrameInfo; }
57 virtual const MipsSubtarget *getSubtargetImpl() const
58 { return &Subtarget; }
59 virtual const TargetData *getTargetData() const
60 { return &DataLayout;}
62 virtual const MipsRegisterInfo *getRegisterInfo() const {
63 return &InstrInfo.getRegisterInfo();
66 virtual MipsTargetLowering *getTargetLowering() const {
67 return const_cast<MipsTargetLowering*>(&TLInfo);
70 // Pass Pipeline Configuration
71 virtual bool addInstSelector(PassManagerBase &PM,
72 CodeGenOpt::Level OptLevel);
73 virtual bool addPreEmitPass(PassManagerBase &PM,
74 CodeGenOpt::Level OptLevel);
75 virtual bool addAssemblyEmitter(PassManagerBase &PM,
76 CodeGenOpt::Level OptLevel,
77 bool Verbose, formatted_raw_ostream &Out);
80 /// MipselTargetMachine - Mipsel target machine.
82 class MipselTargetMachine : public MipsTargetMachine {
84 MipselTargetMachine(const Target &T, const Module &M, const std::string &FS);
86 static unsigned getModuleMatchQuality(const Module &M);
89 } // End llvm namespace