26#define DEBUG_TYPE "asm-printer"
29#include "BPFGenAsmWriter.inc"
41 if (
const MCBinaryExpr *BE = dyn_cast<MCBinaryExpr>(Expr))
42 SRE = dyn_cast<MCSymbolRefExpr>(BE->getLHS());
44 SRE = dyn_cast<MCSymbolRefExpr>(Expr);
58 assert((Modifier ==
nullptr || Modifier[0] == 0) &&
"No modifiers supported");
62 }
else if (
Op.isImm()) {
65 assert(
Op.isExpr() &&
"Expected an expression");
71 const char *Modifier) {
73 const MCOperand &OffsetOp =
MI->getOperand(OpNo + 1);
76 assert(RegOp.
isReg() &&
"Register operand not a register");
80 if (OffsetOp.
isImm()) {
81 auto Imm = OffsetOp.
getImm();
87 assert(0 &&
"Expected an immediate");
106 if (
MI->getOpcode() == BPF::JMPL) {
107 int32_t Imm =
Op.getImm();
108 O << ((Imm >= 0) ?
"+" :
"") <<
formatImm(Imm);
110 int16_t Imm =
Op.getImm();
111 O << ((Imm >= 0) ?
"+" :
"") <<
formatImm(Imm);
113 }
else if (
Op.isExpr()) {
static void printExpr(const MCExpr *Expr, const MCAsmInfo *MAI, raw_ostream &OS)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void printBrTargetOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O)
static const char * getRegisterName(MCRegister Reg)
void printImm64Operand(const MCInst *MI, unsigned 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 printMemOperand(const MCInst *MI, int OpNo, raw_ostream &O, const char *Modifier=nullptr)
void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O, const char *Modifier=nullptr)
This class represents an Operation in the Expression.
Binary assembler expressions.
Base class for the full range of assembler expressions which are needed for parsing.
void printAnnotation(raw_ostream &OS, StringRef Annot)
Utility function for printing annotations.
format_object< int64_t > formatImm(int64_t Value) const
Utility function to print immediates in decimal or hex.
Instances of this class represent a single low-level machine instruction.
Instances of this class represent operands of the MCInst class.
unsigned getReg() const
Returns the register number.
Generic base class for all target subtargets.
Represent a reference to a symbol from inside an expression.
VariantKind getKind() const
StringRef - Represent a constant reference to a string, i.e.
This class implements an extremely fast bulk output stream that can only output to a stream.
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.
DWARFExpression::Operation Op