23#define DEBUG_TYPE "asm-printer"
26#include "BPFGenAsmWriter.inc"
38 if (
const MCBinaryExpr *BE = dyn_cast<MCBinaryExpr>(Expr))
39 SRE = dyn_cast<MCSymbolRefExpr>(BE->getLHS());
41 SRE = dyn_cast<MCSymbolRefExpr>(Expr);
55 assert((Modifier ==
nullptr || Modifier[0] == 0) &&
"No modifiers supported");
59 }
else if (
Op.isImm()) {
62 assert(
Op.isExpr() &&
"Expected an expression");
68 const char *Modifier) {
70 const MCOperand &OffsetOp =
MI->getOperand(OpNo + 1);
73 assert(RegOp.
isReg() &&
"Register operand not a register");
77 if (OffsetOp.
isImm()) {
78 auto Imm = OffsetOp.
getImm();
84 assert(0 &&
"Expected an immediate");
103 if (
MI->getOpcode() == BPF::JMPL) {
104 int32_t Imm =
Op.getImm();
105 O << ((Imm >= 0) ?
"+" :
"") <<
formatImm(Imm);
107 int16_t Imm =
Op.getImm();
108 O << ((Imm >= 0) ?
"+" :
"") <<
formatImm(Imm);
110 }
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.
MCRegister 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