mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 04:02:41 +01:00
ae65e281f3
to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
67 lines
2.2 KiB
C++
67 lines
2.2 KiB
C++
//===- MipsAnalyzeImmediate.h - Analyze Immediates -------------*- C++ -*--===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLVM_LIB_TARGET_MIPS_MIPSANALYZEIMMEDIATE_H
|
|
#define LLVM_LIB_TARGET_MIPS_MIPSANALYZEIMMEDIATE_H
|
|
|
|
#include "llvm/ADT/SmallVector.h"
|
|
#include <cstdint>
|
|
|
|
namespace llvm {
|
|
|
|
class MipsAnalyzeImmediate {
|
|
public:
|
|
struct Inst {
|
|
unsigned Opc, ImmOpnd;
|
|
|
|
Inst(unsigned Opc, unsigned ImmOpnd);
|
|
};
|
|
using InstSeq = SmallVector<Inst, 7>;
|
|
|
|
/// 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:
|
|
using InstSeqLs = SmallVector<InstSeq, 5>;
|
|
|
|
/// 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;
|
|
};
|
|
|
|
} // end namespace llvm
|
|
|
|
#endif // LLVM_LIB_TARGET_MIPS_MIPSANALYZEIMMEDIATE_H
|