34 #define DEBUG_TYPE "asm-printer" 40 std::unique_ptr<MCStreamer> Streamer)
41 :
AsmPrinter(TM, std::move(Streamer)), BTF(
nullptr) {}
43 StringRef getPassName()
const override {
return "BPF Assembly Printer"; }
44 bool doInitialization(
Module &M)
override;
46 bool PrintAsmOperand(
const MachineInstr *MI,
unsigned OpNo,
48 bool PrintAsmMemoryOperand(
const MachineInstr *MI,
unsigned OpNum,
58 bool BPFAsmPrinter::doInitialization(
Module &M) {
64 Handlers.push_back(HandlerInfo(std::unique_ptr<BTFDebug>(BTF),
"emit",
65 "Debug Info Emission",
"BTF",
110 bool BPFAsmPrinter::PrintAsmOperand(
const MachineInstr *MI,
unsigned OpNo,
112 if (ExtraCode && ExtraCode[0])
119 bool BPFAsmPrinter::PrintAsmMemoryOperand(
const MachineInstr *MI,
120 unsigned OpNum,
const char *ExtraCode,
125 assert(BaseMO.isReg() &&
"Unexpected base pointer for inline asm memory operand.");
126 assert(OffsetMO.
isImm() &&
"Unexpected offset for inline asm memory operand.");
140 void BPFAsmPrinter::EmitInstruction(
const MachineInstr *MI) {
143 if (!BTF || !BTF->InstLower(MI, TmpInst)) {
145 MCInstLowering.
Lower(MI, TmpInst);
147 EmitToStreamer(*OutStreamer, TmpInst);
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
MachineBasicBlock * getMBB() const
This class represents lattice values for constants.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
A Module instance is used to store all the information related to an LLVM module. ...
Address of indexed Jump Table for switch.
MachineBasicBlock reference.
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeBPFAsmPrinter()
This file declares the MachineConstantPool class which is an abstract constant pool to keep track of ...
unsigned getNumOperands() const
Retuns the total number of operands.
Name of external global symbol.
const char * getSymbolName() const
RegisterAsmPrinter - Helper template for registering a target specific assembly printer, for use in the target machine initialization function.
Instances of this class represent a single low-level machine instruction.
Address of a global value.
const GlobalValue * getGlobal() const
Collect and emit BTF information.
This class is intended to be used as a driving class for all asm writers.
Address of a basic block.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
void Lower(const MachineInstr *MI, MCInst &OutMI) const
MachineOperand class - Representation of each machine instruction operand.
virtual bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, const char *ExtraCode, raw_ostream &OS)
Print the specified operand of MI, an INLINEASM instruction, using the specified assembler variant...
#define LLVM_EXTERNAL_VISIBILITY
This file contains support for writing BTF debug info.
static const char * getRegisterName(unsigned RegNo)
Representation of each machine instruction.
static bool printOperand(raw_ostream &OS, const SelectionDAG *G, const SDValue Value)
bool doInitialization(Module &M) override
Set up the AsmPrinter when we are working on a new module.
const BlockAddress * getBlockAddress() const
MCSymbol * getSymbol() const
Return the MCSymbol for this basic block.
iterator_range< debug_compile_units_iterator > debug_compile_units() const
Return an iterator for all DICompileUnits listed in this Module's llvm.dbg.cu named metadata node and...
StringRef getName() const
getName - Get the symbol name.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Target & getTheBPFleTarget()
This class implements an extremely fast bulk output stream that can only output to a stream...
Primary interface to the complete machine description for the target machine.
StringRef - Represent a constant reference to a string, i.e.
Address of indexed Constant in Constant Pool.
Target & getTheBPFbeTarget()
Register getReg() const
getReg - Returns the register number.
const MachineOperand & getOperand(unsigned i) const
MachineOperandType getType() const
getType - Returns the MachineOperandType for this operand.
Target & getTheBPFTarget()