26#define DEBUG_TYPE "asm-printer"
28#include "XtensaGenAsmWriter.inc"
34 if (!(SRE = cast<MCSymbolRefExpr>(Expr)))
35 assert(
false &&
"Unexpected MCExpr type.");
86void XtensaInstPrinter::printMemOperand(
const MCInst *
MI,
int OpNum,
93void XtensaInstPrinter::printBranchTarget(
const MCInst *
MI,
int OpNum,
96 if (
MI->getOperand(OpNum).isImm()) {
97 int64_t Val = MC.
getImm() + 4;
108void XtensaInstPrinter::printJumpTarget(
const MCInst *
MI,
int OpNum,
112 int64_t Val = MC.
getImm() + 4;
124void XtensaInstPrinter::printCallOperand(
const MCInst *
MI,
int OpNum,
128 int64_t Val = MC.
getImm() + 4;
139void XtensaInstPrinter::printL32RTarget(
const MCInst *
MI,
int OpNum,
143 int64_t
Value =
MI->getOperand(OpNum).getImm();
144 int64_t InstrOff =
Value & 0x3;
147 "Invalid argument, value must be in ranges [-262144,-4]");
148 Value += ((InstrOff + 0x3) & 0x4) - InstrOff;
157void XtensaInstPrinter::printImm8_AsmOperand(
const MCInst *
MI,
int OpNum,
159 if (
MI->getOperand(OpNum).isImm()) {
160 int64_t
Value =
MI->getOperand(OpNum).getImm();
162 "Invalid argument, value must be in ranges [-128,127]");
169void XtensaInstPrinter::printImm8_sh8_AsmOperand(
const MCInst *
MI,
int OpNum,
171 if (
MI->getOperand(OpNum).isImm()) {
172 int64_t
Value =
MI->getOperand(OpNum).getImm();
174 "Invalid argument, value must be multiples of 256 in range "
181void XtensaInstPrinter::printImm12_AsmOperand(
const MCInst *
MI,
int OpNum,
183 if (
MI->getOperand(OpNum).isImm()) {
184 int64_t
Value =
MI->getOperand(OpNum).getImm();
186 "Invalid argument, value must be in ranges [-2048,2047]");
192void XtensaInstPrinter::printImm12m_AsmOperand(
const MCInst *
MI,
int OpNum,
194 if (
MI->getOperand(OpNum).isImm()) {
195 int64_t
Value =
MI->getOperand(OpNum).getImm();
197 "Invalid argument, value must be in ranges [-2048,2047]");
203void XtensaInstPrinter::printUimm4_AsmOperand(
const MCInst *
MI,
int OpNum,
205 if (
MI->getOperand(OpNum).isImm()) {
206 int64_t
Value =
MI->getOperand(OpNum).getImm();
213void XtensaInstPrinter::printUimm5_AsmOperand(
const MCInst *
MI,
int OpNum,
215 if (
MI->getOperand(OpNum).isImm()) {
216 int64_t
Value =
MI->getOperand(OpNum).getImm();
223void XtensaInstPrinter::printShimm1_31_AsmOperand(
const MCInst *
MI,
int OpNum,
225 if (
MI->getOperand(OpNum).isImm()) {
226 int64_t
Value =
MI->getOperand(OpNum).getImm();
228 "Invalid argument, value must be in range [1,31]");
234void XtensaInstPrinter::printImm1_16_AsmOperand(
const MCInst *
MI,
int OpNum,
236 if (
MI->getOperand(OpNum).isImm()) {
237 int64_t
Value =
MI->getOperand(OpNum).getImm();
239 "Invalid argument, value must be in range [1,16]");
245void XtensaInstPrinter::printImm1n_15_AsmOperand(
const MCInst *
MI,
int OpNum,
247 if (
MI->getOperand(OpNum).isImm()) {
248 int64_t
Value =
MI->getOperand(OpNum).getImm();
250 "Invalid argument, value must be in ranges <-1,-1> or <1,15>");
256void XtensaInstPrinter::printImm32n_95_AsmOperand(
const MCInst *
MI,
int OpNum,
258 if (
MI->getOperand(OpNum).isImm()) {
259 int64_t
Value =
MI->getOperand(OpNum).getImm();
261 "Invalid argument, value must be in ranges <-32,95>");
267void XtensaInstPrinter::printOffset8m8_AsmOperand(
const MCInst *
MI,
int OpNum,
269 if (
MI->getOperand(OpNum).isImm()) {
270 int64_t
Value =
MI->getOperand(OpNum).getImm();
272 "Invalid argument, value must be in range [0,255]");
278void XtensaInstPrinter::printOffset8m16_AsmOperand(
const MCInst *
MI,
int OpNum,
280 if (
MI->getOperand(OpNum).isImm()) {
281 int64_t
Value =
MI->getOperand(OpNum).getImm();
283 "Invalid argument, value must be multiples of two in range [0,510]");
289void XtensaInstPrinter::printOffset8m32_AsmOperand(
const MCInst *
MI,
int OpNum,
291 if (
MI->getOperand(OpNum).isImm()) {
292 int64_t
Value =
MI->getOperand(OpNum).getImm();
295 "Invalid argument, value must be multiples of four in range [0,1020]");
301void XtensaInstPrinter::printOffset4m32_AsmOperand(
const MCInst *
MI,
int OpNum,
303 if (
MI->getOperand(OpNum).isImm()) {
304 int64_t
Value =
MI->getOperand(OpNum).getImm();
306 "Invalid argument, value must be multiples of four in range [0,60]");
312void XtensaInstPrinter::printB4const_AsmOperand(
const MCInst *
MI,
int OpNum,
314 if (
MI->getOperand(OpNum).isImm()) {
315 int64_t
Value =
MI->getOperand(OpNum).getImm();
336 assert((0) &&
"Invalid B4const argument");
343void XtensaInstPrinter::printB4constu_AsmOperand(
const MCInst *
MI,
int OpNum,
345 if (
MI->getOperand(OpNum).isImm()) {
346 int64_t
Value =
MI->getOperand(OpNum).getImm();
367 assert((0) &&
"Invalid B4constu argument");
static void printExpr(const MCExpr *Expr, const MCAsmInfo *MAI, raw_ostream &OS)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static void printExpr(const MCExpr *Expr, raw_ostream &OS)
Base class for the full range of assembler expressions which are needed for parsing.
void print(raw_ostream &OS, const MCAsmInfo *MAI, bool InParens=false) 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.
const MCExpr * getExpr() const
Wrapper class representing physical registers. Should be passed by value.
Generic base class for all target subtargets.
Represent a reference to a symbol from inside an expression.
const MCSymbol & getSymbol() const
VariantKind getKind() const
StringRef - Represent a constant reference to a string, i.e.
LLVM Value Representation.
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 printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O)
static const char * getRegisterName(MCRegister Reg)
void printRegName(raw_ostream &O, MCRegister Reg) override
Print the assembler register name.
static void printOperand(const MCOperand &MO, raw_ostream &O)
This class implements an extremely fast bulk output stream that can only output to a stream.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.