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"
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)(raw_ostream &o,
41 MipsTargetMachine &tm,
43 static AsmPrinterCtorFn AsmPrinterCtor;
46 MipsTargetMachine(const Module &M, const std::string &FS, bool isLittle);
48 static void registerAsmPrinter(AsmPrinterCtorFn F) {
52 virtual const MipsInstrInfo *getInstrInfo() const
53 { return &InstrInfo; }
54 virtual const TargetFrameInfo *getFrameInfo() const
55 { return &FrameInfo; }
56 virtual const MipsSubtarget *getSubtargetImpl() const
57 { return &Subtarget; }
58 virtual const TargetData *getTargetData() const
59 { return &DataLayout;}
61 virtual const MipsRegisterInfo *getRegisterInfo() const {
62 return &InstrInfo.getRegisterInfo();
65 virtual MipsTargetLowering *getTargetLowering() const {
66 return const_cast<MipsTargetLowering*>(&TLInfo);
69 static unsigned getModuleMatchQuality(const Module &M);
71 // Pass Pipeline Configuration
72 virtual bool addInstSelector(PassManagerBase &PM,
73 CodeGenOpt::Level OptLevel);
74 virtual bool addPreEmitPass(PassManagerBase &PM,
75 CodeGenOpt::Level OptLevel);
76 virtual bool addAssemblyEmitter(PassManagerBase &PM,
77 CodeGenOpt::Level OptLevel,
78 bool Verbose, raw_ostream &Out);
81 /// MipselTargetMachine - Mipsel target machine.
83 class MipselTargetMachine : public MipsTargetMachine {
85 MipselTargetMachine(const Module &M, const std::string &FS);
87 static unsigned getModuleMatchQuality(const Module &M);
90 } // End llvm namespace