]>
Commit | Line | Data |
---|---|---|
223e47cc LB |
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 | ||
1a4d82fc JJ |
14 | #ifndef LLVM_LIB_TARGET_MIPS_MIPSTARGETMACHINE_H |
15 | #define LLVM_LIB_TARGET_MIPS_MIPSTARGETMACHINE_H | |
16 | ||
223e47cc | 17 | #include "MipsSubtarget.h" |
1a4d82fc JJ |
18 | #include "llvm/CodeGen/Passes.h" |
19 | #include "llvm/CodeGen/SelectionDAGISel.h" | |
223e47cc | 20 | #include "llvm/Target/TargetFrameLowering.h" |
970d7e83 | 21 | #include "llvm/Target/TargetMachine.h" |
223e47cc LB |
22 | |
23 | namespace llvm { | |
24 | class formatted_raw_ostream; | |
25 | class MipsRegisterInfo; | |
26 | ||
27 | class MipsTargetMachine : public LLVMTargetMachine { | |
1a4d82fc | 28 | bool isLittle; |
85aaf69f | 29 | std::unique_ptr<TargetLoweringObjectFile> TLOF; |
1a4d82fc JJ |
30 | MipsSubtarget *Subtarget; |
31 | MipsSubtarget DefaultSubtarget; | |
32 | MipsSubtarget NoMips16Subtarget; | |
33 | MipsSubtarget Mips16Subtarget; | |
34 | ||
35 | mutable StringMap<std::unique_ptr<MipsSubtarget>> SubtargetMap; | |
223e47cc LB |
36 | |
37 | public: | |
1a4d82fc JJ |
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); | |
85aaf69f | 41 | ~MipsTargetMachine() override; |
223e47cc | 42 | |
1a4d82fc | 43 | void addAnalysisPasses(PassManagerBase &PM) override; |
223e47cc | 44 | |
1a4d82fc JJ |
45 | const MipsSubtarget *getSubtargetImpl() const override { |
46 | if (Subtarget) | |
47 | return Subtarget; | |
48 | return &DefaultSubtarget; | |
223e47cc LB |
49 | } |
50 | ||
1a4d82fc JJ |
51 | const MipsSubtarget *getSubtargetImpl(const Function &F) const override; |
52 | ||
53 | /// \brief Reset the subtarget for the Mips target. | |
54 | void resetSubtarget(MachineFunction *MF); | |
223e47cc | 55 | |
223e47cc | 56 | // Pass Pipeline Configuration |
1a4d82fc | 57 | TargetPassConfig *createPassConfig(PassManagerBase &PM) override; |
85aaf69f SL |
58 | |
59 | TargetLoweringObjectFile *getObjFileLowering() const override { | |
60 | return TLOF.get(); | |
61 | } | |
62 | ||
63 | bool isLittleEndian() const { return isLittle; } | |
223e47cc LB |
64 | }; |
65 | ||
66 | /// MipsebTargetMachine - Mips32/64 big endian target machine. | |
67 | /// | |
68 | class MipsebTargetMachine : public MipsTargetMachine { | |
69 | virtual void anchor(); | |
70 | public: | |
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); | |
75 | }; | |
76 | ||
77 | /// MipselTargetMachine - Mips32/64 little endian target machine. | |
78 | /// | |
79 | class MipselTargetMachine : public MipsTargetMachine { | |
80 | virtual void anchor(); | |
81 | public: | |
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); | |
86 | }; | |
87 | ||
88 | } // End llvm namespace | |
89 | ||
90 | #endif |