1 //===-- MipsTargetMachine.h - Define TargetMachine for Mips -----*- 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 LLVM_LIB_TARGET_MIPS_MIPSTARGETMACHINE_H
15 #define LLVM_LIB_TARGET_MIPS_MIPSTARGETMACHINE_H
17 #include "MipsSubtarget.h"
18 #include "llvm/CodeGen/Passes.h"
19 #include "llvm/CodeGen/SelectionDAGISel.h"
20 #include "llvm/Target/TargetFrameLowering.h"
21 #include "llvm/Target/TargetMachine.h"
24 class formatted_raw_ostream;
25 class MipsRegisterInfo;
27 class MipsTargetMachine : public LLVMTargetMachine {
29 std::unique_ptr<TargetLoweringObjectFile> TLOF;
30 MipsSubtarget *Subtarget;
31 MipsSubtarget DefaultSubtarget;
32 MipsSubtarget NoMips16Subtarget;
33 MipsSubtarget Mips16Subtarget;
35 mutable StringMap<std::unique_ptr<MipsSubtarget>> SubtargetMap;
38 MipsTargetMachine(const Target &T, StringRef TT, StringRef CPU, StringRef FS,
39 const TargetOptions &Options, Reloc::Model RM,
40 CodeModel::Model CM, CodeGenOpt::Level OL, bool isLittle);
41 ~MipsTargetMachine() override;
43 void addAnalysisPasses(PassManagerBase &PM) override;
45 const MipsSubtarget *getSubtargetImpl() const override {
48 return &DefaultSubtarget;
51 const MipsSubtarget *getSubtargetImpl(const Function &F) const override;
53 /// \brief Reset the subtarget for the Mips target.
54 void resetSubtarget(MachineFunction *MF);
56 // Pass Pipeline Configuration
57 TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
59 TargetLoweringObjectFile *getObjFileLowering() const override {
63 bool isLittleEndian() const { return isLittle; }
66 /// MipsebTargetMachine - Mips32/64 big endian target machine.
68 class MipsebTargetMachine : public MipsTargetMachine {
69 virtual void anchor();
71 MipsebTargetMachine(const Target &T, StringRef TT,
72 StringRef CPU, StringRef FS, const TargetOptions &Options,
73 Reloc::Model RM, CodeModel::Model CM,
74 CodeGenOpt::Level OL);
77 /// MipselTargetMachine - Mips32/64 little endian target machine.
79 class MipselTargetMachine : public MipsTargetMachine {
80 virtual void anchor();
82 MipselTargetMachine(const Target &T, StringRef TT,
83 StringRef CPU, StringRef FS, const TargetOptions &Options,
84 Reloc::Model RM, CodeModel::Model CM,
85 CodeGenOpt::Level OL);
88 } // End llvm namespace