1 //===-- MipsTargetMachine.h - Define TargetMachine for Mips -----*- 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 Mips specific subclass of TargetMachine. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #ifndef MIPSTARGETMACHINE_H 15 #define MIPSTARGETMACHINE_H 16 17 #include "MipsFrameLowering.h" 18 #include "MipsInstrInfo.h" 19 #include "MipsISelLowering.h" 20 #include "MipsJITInfo.h" 21 #include "MipsSelectionDAGInfo.h" 22 #include "MipsSubtarget.h" 23 #include "llvm/Target/TargetMachine.h" 24 #include "llvm/Target/TargetData.h" 25 #include "llvm/Target/TargetFrameLowering.h" 26 27 namespace llvm { 28 class formatted_raw_ostream; 29 class MipsRegisterInfo; 30 31 class MipsTargetMachine : public LLVMTargetMachine { 32 MipsSubtarget Subtarget; 33 const TargetData DataLayout; // Calculates type size & alignment 34 const MipsInstrInfo *InstrInfo; 35 const MipsFrameLowering *FrameLowering; 36 MipsTargetLowering TLInfo; 37 MipsSelectionDAGInfo TSInfo; 38 MipsJITInfo JITInfo; 39 40 public: 41 MipsTargetMachine(const Target &T, StringRef TT, 42 StringRef CPU, StringRef FS, const TargetOptions &Options, 43 Reloc::Model RM, CodeModel::Model CM, 44 CodeGenOpt::Level OL, 45 bool isLittle); 46 47 virtual ~MipsTargetMachine() { delete InstrInfo; } 48 49 virtual const MipsInstrInfo *getInstrInfo() const 50 { return InstrInfo; } 51 virtual const TargetFrameLowering *getFrameLowering() const 52 { return FrameLowering; } 53 virtual const MipsSubtarget *getSubtargetImpl() const 54 { return &Subtarget; } 55 virtual const TargetData *getTargetData() const 56 { return &DataLayout;} 57 virtual MipsJITInfo *getJITInfo() 58 { return &JITInfo; } 59 60 virtual const MipsRegisterInfo *getRegisterInfo() const { 61 return &InstrInfo->getRegisterInfo(); 62 } 63 64 virtual const MipsTargetLowering *getTargetLowering() const { 65 return &TLInfo; 66 } 67 68 virtual const MipsSelectionDAGInfo* getSelectionDAGInfo() const { 69 return &TSInfo; 70 } 71 72 // Pass Pipeline Configuration 73 virtual TargetPassConfig *createPassConfig(PassManagerBase &PM); 74 virtual bool addCodeEmitter(PassManagerBase &PM, JITCodeEmitter &JCE); 75 }; 76 77 /// MipsebTargetMachine - Mips32/64 big endian target machine. 78 /// 79 class MipsebTargetMachine : public MipsTargetMachine { 80 virtual void anchor(); 81 public: 82 MipsebTargetMachine(const Target &T, StringRef TT, 83 StringRef CPU, StringRef FS, const TargetOptions &Options, 84 Reloc::Model RM, CodeModel::Model CM, 85 CodeGenOpt::Level OL); 86 }; 87 88 /// MipselTargetMachine - Mips32/64 little endian target machine. 89 /// 90 class MipselTargetMachine : public MipsTargetMachine { 91 virtual void anchor(); 92 public: 93 MipselTargetMachine(const Target &T, StringRef TT, 94 StringRef CPU, StringRef FS, const TargetOptions &Options, 95 Reloc::Model RM, CodeModel::Model CM, 96 CodeGenOpt::Level OL); 97 }; 98 99 } // End llvm namespace 100 101 #endif 102