mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-27 14:45:50 +00:00
00e08fcaa0
Add header guards to files that were missing guards. Remove #endif comments as they don't seem common in LLVM (we can easily add them back if we decide they're useful) Changes made by clang-tidy with minor tweaks. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215558 91177308-0d34-0410-b5e6-96231b3b80d8
64 lines
2.2 KiB
C++
64 lines
2.2 KiB
C++
//===-- MipsAnalyzeImmediate.h - Analyze Immediates ------------*- C++ -*--===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
#ifndef LLVM_LIB_TARGET_MIPS_MIPSANALYZEIMMEDIATE_H
|
|
#define LLVM_LIB_TARGET_MIPS_MIPSANALYZEIMMEDIATE_H
|
|
|
|
#include "llvm/ADT/SmallVector.h"
|
|
#include "llvm/Support/DataTypes.h"
|
|
|
|
namespace llvm {
|
|
|
|
class MipsAnalyzeImmediate {
|
|
public:
|
|
struct Inst {
|
|
unsigned Opc, ImmOpnd;
|
|
Inst(unsigned Opc, unsigned ImmOpnd);
|
|
};
|
|
typedef SmallVector<Inst, 7 > InstSeq;
|
|
|
|
/// Analyze - Get an instruction sequence to load immediate Imm. The last
|
|
/// instruction in the sequence must be an ADDiu if LastInstrIsADDiu is
|
|
/// true;
|
|
const InstSeq &Analyze(uint64_t Imm, unsigned Size, bool LastInstrIsADDiu);
|
|
private:
|
|
typedef SmallVector<InstSeq, 5> InstSeqLs;
|
|
|
|
/// AddInstr - Add I to all instruction sequences in SeqLs.
|
|
void AddInstr(InstSeqLs &SeqLs, const Inst &I);
|
|
|
|
/// GetInstSeqLsADDiu - Get instruction sequences which end with an ADDiu to
|
|
/// load immediate Imm
|
|
void GetInstSeqLsADDiu(uint64_t Imm, unsigned RemSize, InstSeqLs &SeqLs);
|
|
|
|
/// GetInstSeqLsORi - Get instrutcion sequences which end with an ORi to
|
|
/// load immediate Imm
|
|
void GetInstSeqLsORi(uint64_t Imm, unsigned RemSize, InstSeqLs &SeqLs);
|
|
|
|
/// GetInstSeqLsSLL - Get instruction sequences which end with a SLL to
|
|
/// load immediate Imm
|
|
void GetInstSeqLsSLL(uint64_t Imm, unsigned RemSize, InstSeqLs &SeqLs);
|
|
|
|
/// GetInstSeqLs - Get instruction sequences to load immediate Imm.
|
|
void GetInstSeqLs(uint64_t Imm, unsigned RemSize, InstSeqLs &SeqLs);
|
|
|
|
/// ReplaceADDiuSLLWithLUi - Replace an ADDiu & SLL pair with a LUi.
|
|
void ReplaceADDiuSLLWithLUi(InstSeq &Seq);
|
|
|
|
/// GetShortestSeq - Find the shortest instruction sequence in SeqLs and
|
|
/// return it in Insts.
|
|
void GetShortestSeq(InstSeqLs &SeqLs, InstSeq &Insts);
|
|
|
|
unsigned Size;
|
|
unsigned ADDiu, ORi, SLL, LUi;
|
|
InstSeq Insts;
|
|
};
|
|
}
|
|
|
|
#endif
|