25#define DEBUG_TYPE "asm-printer"
28#define PRINT_ALIAS_INSTR
29#include "LanaiGenAsmWriter.inc"
38 OS <<
"\t" << Alias <<
" ";
46 unsigned AluCode =
MI->getOperand(3).getImm();
48 (
MI->getOperand(2).getImm() == AddOffset ||
49 MI->getOperand(2).getImm() == -AddOffset);
53 unsigned AluCode =
MI->getOperand(3).getImm();
58 unsigned AluCode =
MI->getOperand(3).getImm();
63 if (
MI->getOperand(2).getImm() < 0)
68bool LanaiInstPrinter::printMemoryLoadIncrement(
const MCInst *
MI,
79 OS <<
"\t" << Opcode <<
"\t[%"
87bool LanaiInstPrinter::printMemoryStoreIncrement(
const MCInst *
MI,
107 switch (
MI->getOpcode()) {
113 return printMemoryLoadIncrement(
MI,
OS,
"ld", 4);
115 return printMemoryLoadIncrement(
MI,
OS,
"ld.h", 2);
117 return printMemoryLoadIncrement(
MI,
OS,
"uld.h", 2);
119 return printMemoryLoadIncrement(
MI,
OS,
"ld.b", 1);
121 return printMemoryLoadIncrement(
MI,
OS,
"uld.b", 1);
127 return printMemoryStoreIncrement(
MI,
OS,
"st", 4);
129 return printMemoryStoreIncrement(
MI,
OS,
"st.h", 2);
131 return printMemoryStoreIncrement(
MI,
OS,
"st.b", 1);
154 assert(
Op.isExpr() &&
"Expected an expression");
166 assert(
Op.isExpr() &&
"Expected an expression");
180 assert(
Op.isExpr() &&
"Expected an expression");
192 assert(
Op.isExpr() &&
"Expected an expression");
204 assert(
Op.isExpr() &&
"Expected an expression");
211 assert(RegOp.
isReg() &&
"Register operand expected");
221template <
unsigned SizeInBits>
227 assert(isInt<SizeInBits>(
OffsetOp.getImm()) &&
"Constant value truncated");
238 const unsigned AluCode = AluOp.
getImm();
252 const unsigned AluCode = AluOp.
getImm();
272 const unsigned AluCode = AluOp.
getImm();
289 OS << lanaiCondCodeToString(CC);
300 OS <<
"." << lanaiCondCodeToString(CC);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
std::pair< Instruction::BinaryOps, Value * > OffsetOp
Find all possible pairs (BinOp, RHS) that BinOp V, RHS can be simplified.
static bool isPostIncrementForm(const MCInst *MI, int AddOffset)
static StringRef decIncOperator(const MCInst *MI)
static void printMemoryBaseRegister(raw_ostream &OS, const unsigned AluCode, const MCOperand &RegOp)
static bool usesGivenOffset(const MCInst *MI, int AddOffset)
static void printMemoryImmediateOffset(const MCAsmInfo &MAI, const MCOperand &OffsetOp, raw_ostream &OS)
static bool isPreIncrementForm(const MCInst *MI, int AddOffset)
This class represents an Operation in the Expression.
void printMemRrOperand(const MCInst *MI, int OpNo, raw_ostream &O)
static const char * getRegisterName(MCRegister Reg)
bool printAliasInstr(const MCInst *MI, uint64_t Address, raw_ostream &OS)
void printMemImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printMemRiOperand(const MCInst *MI, int OpNo, raw_ostream &O)
void printRegName(raw_ostream &OS, MCRegister Reg) override
Print the assembler register name.
void printHi16AndImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printMemSplsOperand(const MCInst *MI, int OpNo, raw_ostream &O)
void printInst(const MCInst *MI, uint64_t Address, StringRef Annot, const MCSubtargetInfo &STI, raw_ostream &O) override
Print the specified MCInst to the specified raw_ostream.
void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printCCOperand(const MCInst *MI, int OpNo, raw_ostream &O)
void printLo16AndImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printHi16ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O)
void printPredicateOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O)
This class is intended to be used as a base class for asm properties and features specific to the tar...
void printExpr(raw_ostream &, const MCExpr &) const
format_object< int64_t > formatHex(int64_t Value) const
void printAnnotation(raw_ostream &OS, StringRef Annot)
Utility function for printing annotations.
Instances of this class represent a single low-level machine instruction.
Instances of this class represent operands of the MCInst class.
MCRegister getReg() const
Returns the register number.
Wrapper class representing physical registers. Should be passed by value.
Generic base class for all target subtargets.
StringRef - Represent a constant reference to a string, i.e.
LLVM_ABI std::string lower() const
This class implements an extremely fast bulk output stream that can only output to a stream.
static bool isPreOp(unsigned AluOp)
static const char * lanaiAluCodeToString(unsigned AluOp)
static unsigned encodeLanaiAluCode(unsigned AluOp)
static bool isPostOp(unsigned AluOp)
This is an optimization pass for GlobalISel generic memory operations.