]> git.proxmox.com Git - rustc.git/blame - src/llvm/lib/Target/Mips/MipsAnalyzeImmediate.h
Imported Upstream version 1.0.0+dfsg1
[rustc.git] / src / llvm / lib / Target / Mips / MipsAnalyzeImmediate.h
CommitLineData
223e47cc
LB
1//===-- MipsAnalyzeImmediate.h - Analyze Immediates ------------*- 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//===----------------------------------------------------------------------===//
1a4d82fc
JJ
9#ifndef LLVM_LIB_TARGET_MIPS_MIPSANALYZEIMMEDIATE_H
10#define LLVM_LIB_TARGET_MIPS_MIPSANALYZEIMMEDIATE_H
223e47cc
LB
11
12#include "llvm/ADT/SmallVector.h"
13#include "llvm/Support/DataTypes.h"
14
15namespace llvm {
16
17 class MipsAnalyzeImmediate {
18 public:
19 struct Inst {
20 unsigned Opc, ImmOpnd;
21 Inst(unsigned Opc, unsigned ImmOpnd);
22 };
23 typedef SmallVector<Inst, 7 > InstSeq;
24
1a4d82fc 25 /// Analyze - Get an instruction sequence to load immediate Imm. The last
223e47cc
LB
26 /// instruction in the sequence must be an ADDiu if LastInstrIsADDiu is
27 /// true;
28 const InstSeq &Analyze(uint64_t Imm, unsigned Size, bool LastInstrIsADDiu);
29 private:
30 typedef SmallVector<InstSeq, 5> InstSeqLs;
31
32 /// AddInstr - Add I to all instruction sequences in SeqLs.
33 void AddInstr(InstSeqLs &SeqLs, const Inst &I);
34
1a4d82fc 35 /// GetInstSeqLsADDiu - Get instruction sequences which end with an ADDiu to
223e47cc
LB
36 /// load immediate Imm
37 void GetInstSeqLsADDiu(uint64_t Imm, unsigned RemSize, InstSeqLs &SeqLs);
38
1a4d82fc 39 /// GetInstSeqLsORi - Get instrutcion sequences which end with an ORi to
223e47cc
LB
40 /// load immediate Imm
41 void GetInstSeqLsORi(uint64_t Imm, unsigned RemSize, InstSeqLs &SeqLs);
42
1a4d82fc 43 /// GetInstSeqLsSLL - Get instruction sequences which end with a SLL to
223e47cc
LB
44 /// load immediate Imm
45 void GetInstSeqLsSLL(uint64_t Imm, unsigned RemSize, InstSeqLs &SeqLs);
46
1a4d82fc 47 /// GetInstSeqLs - Get instruction sequences to load immediate Imm.
223e47cc
LB
48 void GetInstSeqLs(uint64_t Imm, unsigned RemSize, InstSeqLs &SeqLs);
49
50 /// ReplaceADDiuSLLWithLUi - Replace an ADDiu & SLL pair with a LUi.
51 void ReplaceADDiuSLLWithLUi(InstSeq &Seq);
52
53 /// GetShortestSeq - Find the shortest instruction sequence in SeqLs and
54 /// return it in Insts.
55 void GetShortestSeq(InstSeqLs &SeqLs, InstSeq &Insts);
56
57 unsigned Size;
58 unsigned ADDiu, ORi, SLL, LUi;
59 InstSeq Insts;
60 };
61}
62
63#endif