35#define DEBUG_TYPE "asm-printer"
41 std::unique_ptr<MCStreamer> Streamer)
42 :
AsmPrinter(TM, std::move(Streamer)), BTF(
nullptr) {}
59bool BPFAsmPrinter::doInitialization(
Module &M) {
63 if (MAI->doesSupportDebugInformation() && !
M.debug_compile_units().empty()) {
65 DebugHandlers.push_back(std::unique_ptr<BTFDebug>(BTF));
109bool BPFAsmPrinter::PrintAsmOperand(
const MachineInstr *
MI,
unsigned OpNo,
111 if (ExtraCode && ExtraCode[0])
119 unsigned OpNum,
const char *ExtraCode,
121 assert(OpNum + 1 <
MI->getNumOperands() &&
"Insufficient operands");
124 assert(BaseMO.
isReg() &&
"Unexpected base pointer for inline asm memory operand.");
125 assert(OffsetMO.
isImm() &&
"Unexpected offset for inline asm memory operand.");
140 BPF_MC::verifyInstructionPredicates(
MI->getOpcode(),
141 getSubtargetInfo().getFeatureBits());
145 if (!BTF || !BTF->InstLower(
MI, TmpInst)) {
147 MCInstLowering.Lower(
MI, TmpInst);
149 EmitToStreamer(*OutStreamer, TmpInst);
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeBPFAsmPrinter()
This file contains support for writing BTF debug info.
#define LLVM_EXTERNAL_VISIBILITY
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
This file declares the MachineConstantPool class which is an abstract constant pool to keep track of ...
Module.h This file contains the declarations for the Module class.
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static bool printOperand(raw_ostream &OS, const SelectionDAG *G, const SDValue Value)
This class is intended to be used as a driving class for all asm writers.
virtual void emitInstruction(const MachineInstr *)
Targets should implement this to emit instructions.
bool doInitialization(Module &M) override
Set up the AsmPrinter when we are working on a new module.
virtual bool PrintAsmMemoryOperand(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 as...
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.
static const char * getRegisterName(MCRegister Reg)
Collect and emit BTF information.
Instances of this class represent a single low-level machine instruction.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
StringRef getName() const
getName - Get the symbol name.
MCSymbol * getSymbol() const
Return the MCSymbol for this basic block.
Representation of each machine instruction.
MachineOperand class - Representation of each machine instruction operand.
const GlobalValue * getGlobal() const
bool isReg() const
isReg - Tests if this is a MO_Register operand.
MachineBasicBlock * getMBB() const
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
const BlockAddress * getBlockAddress() const
MachineOperandType getType() const
getType - Returns the MachineOperandType for this operand.
const char * getSymbolName() const
Register getReg() const
getReg - Returns the register number.
@ MO_Immediate
Immediate operand.
@ MO_ConstantPoolIndex
Address of indexed Constant in Constant Pool.
@ MO_GlobalAddress
Address of a global value.
@ MO_BlockAddress
Address of a basic block.
@ MO_MachineBasicBlock
MachineBasicBlock reference.
@ MO_Register
Register operand.
@ MO_ExternalSymbol
Name of external global symbol.
@ MO_JumpTableIndex
Address of indexed Jump Table for switch.
A Module instance is used to store all the information related to an LLVM module.
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
StringRef - Represent a constant reference to a string, i.e.
Primary interface to the complete machine description for the target machine.
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.
Target & getTheBPFleTarget()
Target & getTheBPFbeTarget()
Target & getTheBPFTarget()
RegisterAsmPrinter - Helper template for registering a target specific assembly printer,...