Re-sort #include lines using my handy dandy ./utils/sort_includes.py
[oota-llvm.git] / lib / Target / Mips / MipsTargetMachine.h
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 LLVM_LIB_TARGET_MIPS_MIPSTARGETMACHINE_H
15 #define LLVM_LIB_TARGET_MIPS_MIPSTARGETMACHINE_H
16
17 #include "MCTargetDesc/MipsABIInfo.h"
18 #include "MipsSubtarget.h"
19 #include "llvm/CodeGen/BasicTTIImpl.h"
20 #include "llvm/CodeGen/Passes.h"
21 #include "llvm/CodeGen/SelectionDAGISel.h"
22 #include "llvm/Target/TargetFrameLowering.h"
23 #include "llvm/Target/TargetMachine.h"
24
25 namespace llvm {
26 class formatted_raw_ostream;
27 class MipsRegisterInfo;
28
29 class MipsTargetMachine : public LLVMTargetMachine {
30   bool isLittle;
31   std::unique_ptr<TargetLoweringObjectFile> TLOF;
32   // Selected ABI
33   MipsABIInfo ABI;
34   const DataLayout DL; // Calculates type size & alignment
35   MipsSubtarget *Subtarget;
36   MipsSubtarget DefaultSubtarget;
37   MipsSubtarget NoMips16Subtarget;
38   MipsSubtarget Mips16Subtarget;
39
40   mutable StringMap<std::unique_ptr<MipsSubtarget>> SubtargetMap;
41
42 public:
43   MipsTargetMachine(const Target &T, StringRef TT, StringRef CPU, StringRef FS,
44                     const TargetOptions &Options, Reloc::Model RM,
45                     CodeModel::Model CM, CodeGenOpt::Level OL, bool isLittle);
46   ~MipsTargetMachine() override;
47
48   TargetIRAnalysis getTargetIRAnalysis() override;
49
50   const DataLayout *getDataLayout() const override { return &DL; }
51   const MipsSubtarget *getSubtargetImpl() const override {
52     if (Subtarget)
53       return Subtarget;
54     return &DefaultSubtarget;
55   }
56
57   const MipsSubtarget *getSubtargetImpl(const Function &F) const override;
58
59   /// \brief Reset the subtarget for the Mips target.
60   void resetSubtarget(MachineFunction *MF);
61
62   // Pass Pipeline Configuration
63   TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
64
65   TargetLoweringObjectFile *getObjFileLowering() const override {
66     return TLOF.get();
67   }
68
69   bool isLittleEndian() const { return isLittle; }
70   const MipsABIInfo &getABI() const { return ABI; }
71 };
72
73 /// MipsebTargetMachine - Mips32/64 big endian target machine.
74 ///
75 class MipsebTargetMachine : public MipsTargetMachine {
76   virtual void anchor();
77 public:
78   MipsebTargetMachine(const Target &T, StringRef TT,
79                       StringRef CPU, StringRef FS, const TargetOptions &Options,
80                       Reloc::Model RM, CodeModel::Model CM,
81                       CodeGenOpt::Level OL);
82 };
83
84 /// MipselTargetMachine - Mips32/64 little endian target machine.
85 ///
86 class MipselTargetMachine : public MipsTargetMachine {
87   virtual void anchor();
88 public:
89   MipselTargetMachine(const Target &T, StringRef TT,
90                       StringRef CPU, StringRef FS, const TargetOptions &Options,
91                       Reloc::Model RM, CodeModel::Model CM,
92                       CodeGenOpt::Level OL);
93 };
94
95 } // End llvm namespace
96
97 #endif