Mercurial > hg > CbC > CbC_llvm
comparison lib/Target/Mips/MipsAnalyzeImmediate.h @ 121:803732b1fca8
LLVM 5.0
author | kono |
---|---|
date | Fri, 27 Oct 2017 17:07:41 +0900 |
parents | 54457678186b |
children | c2174574ed3a |
comparison
equal
deleted
inserted
replaced
120:1172e4bd9c6f | 121:803732b1fca8 |
---|---|
1 //===-- MipsAnalyzeImmediate.h - Analyze Immediates ------------*- C++ -*--===// | 1 //===- MipsAnalyzeImmediate.h - Analyze Immediates -------------*- C++ -*--===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 | |
9 #ifndef LLVM_LIB_TARGET_MIPS_MIPSANALYZEIMMEDIATE_H | 10 #ifndef LLVM_LIB_TARGET_MIPS_MIPSANALYZEIMMEDIATE_H |
10 #define LLVM_LIB_TARGET_MIPS_MIPSANALYZEIMMEDIATE_H | 11 #define LLVM_LIB_TARGET_MIPS_MIPSANALYZEIMMEDIATE_H |
11 | 12 |
12 #include "llvm/ADT/SmallVector.h" | 13 #include "llvm/ADT/SmallVector.h" |
13 #include "llvm/Support/DataTypes.h" | 14 #include <cstdint> |
14 | 15 |
15 namespace llvm { | 16 namespace llvm { |
16 | 17 |
17 class MipsAnalyzeImmediate { | 18 class MipsAnalyzeImmediate { |
18 public: | 19 public: |
19 struct Inst { | 20 struct Inst { |
20 unsigned Opc, ImmOpnd; | 21 unsigned Opc, ImmOpnd; |
22 | |
21 Inst(unsigned Opc, unsigned ImmOpnd); | 23 Inst(unsigned Opc, unsigned ImmOpnd); |
22 }; | 24 }; |
23 typedef SmallVector<Inst, 7 > InstSeq; | 25 using InstSeq = SmallVector<Inst, 7>; |
24 | 26 |
25 /// Analyze - Get an instruction sequence to load immediate Imm. The last | 27 /// Analyze - Get an instruction sequence to load immediate Imm. The last |
26 /// instruction in the sequence must be an ADDiu if LastInstrIsADDiu is | 28 /// instruction in the sequence must be an ADDiu if LastInstrIsADDiu is |
27 /// true; | 29 /// true; |
28 const InstSeq &Analyze(uint64_t Imm, unsigned Size, bool LastInstrIsADDiu); | 30 const InstSeq &Analyze(uint64_t Imm, unsigned Size, bool LastInstrIsADDiu); |
31 | |
29 private: | 32 private: |
30 typedef SmallVector<InstSeq, 5> InstSeqLs; | 33 using InstSeqLs = SmallVector<InstSeq, 5>; |
31 | 34 |
32 /// AddInstr - Add I to all instruction sequences in SeqLs. | 35 /// AddInstr - Add I to all instruction sequences in SeqLs. |
33 void AddInstr(InstSeqLs &SeqLs, const Inst &I); | 36 void AddInstr(InstSeqLs &SeqLs, const Inst &I); |
34 | 37 |
35 /// GetInstSeqLsADDiu - Get instruction sequences which end with an ADDiu to | 38 /// GetInstSeqLsADDiu - Get instruction sequences which end with an ADDiu to |
56 | 59 |
57 unsigned Size; | 60 unsigned Size; |
58 unsigned ADDiu, ORi, SLL, LUi; | 61 unsigned ADDiu, ORi, SLL, LUi; |
59 InstSeq Insts; | 62 InstSeq Insts; |
60 }; | 63 }; |
61 } | |
62 | 64 |
63 #endif | 65 } // end namespace llvm |
66 | |
67 #endif // LLVM_LIB_TARGET_MIPS_MIPSANALYZEIMMEDIATE_H |