32#define DEBUG_TYPE "asm-printer"
40 std::unique_ptr<MCStreamer> Streamer)
58void LanaiAsmPrinter::printOperand(
const MachineInstr *
MI,
int OpNum,
90 O << MAI->getPrivateGlobalPrefix() <<
"JTI" << getFunctionNumber() <<
'_'
95 O << MAI->getPrivateGlobalPrefix() <<
"CPI" << getFunctionNumber() <<
'_'
105bool LanaiAsmPrinter::PrintAsmOperand(
const MachineInstr *
MI,
unsigned OpNo,
108 if (ExtraCode && ExtraCode[0]) {
112 switch (ExtraCode[0]) {
118 if (!FlagsOP.
isImm())
121 const unsigned NumVals =
Flags.getNumOperandRegisters();
124 unsigned RegOp = OpNo + 1;
125 if (RegOp >=
MI->getNumOperands())
143void LanaiAsmPrinter::emitCallInstruction(
const MachineInstr *
MI) {
144 assert((
MI->getOpcode() == Lanai::CALL ||
MI->getOpcode() == Lanai::CALLR) &&
145 "Unsupported call function");
168 if (
MI->getOpcode() == Lanai::CALL) {
170 MCInstLowering.Lower(
MI, TmpInst);
172 OutStreamer->emitInstruction(TmpInst, STI);
176 .addReg(
MI->getOperand(0).getReg())
183void LanaiAsmPrinter::customEmitInstruction(
const MachineInstr *
MI) {
187 MCInstLowering.Lower(
MI, TmpInst);
188 OutStreamer->emitInstruction(TmpInst, STI);
192 Lanai_MC::verifyInstructionPredicates(
MI->getOpcode(),
193 getSubtargetInfo().getFeatureBits());
200 emitCallInstruction(&*
I);
204 customEmitInstruction(&*
I);
205 }
while ((++
I != E) &&
I->isInsideBundle());
212bool LanaiAsmPrinter::isBlockOnlyReachableByFallthrough(
220 if (isa<SwitchInst>(
B->getTerminator()))
230 while (
I != Pred->
begin() && !(--
I)->isTerminator()) {
233 return !
I->isBarrier();
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
#define LLVM_EXTERNAL_VISIBILITY
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeLanaiAsmPrinter()
This file declares the MachineConstantPool class which is an abstract constant pool to keep track of ...
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.
virtual bool isBlockOnlyReachableByFallthrough(const MachineBasicBlock *MBB) const
Return true if the basic block has exactly one predecessor and the control transfer mechanism between...
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.
LLVM Basic Block Representation.
static const char * getRegisterName(MCRegister Reg)
MCInstBuilder & addReg(MCRegister Reg)
Add a new register operand.
MCInstBuilder & addImm(int64_t Val)
Add a new integer immediate operand.
Instances of this class represent a single low-level machine instruction.
void setOpcode(unsigned Op)
Generic base class for all target subtargets.
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.
const BasicBlock * getBasicBlock() const
Return the LLVM basic block that this instance corresponded to originally.
pred_iterator pred_begin()
Instructions::const_iterator const_instr_iterator
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.
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
Wrapper class representing virtual and physical registers.
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.
static unsigned makePreOp(unsigned AluOp)
Reg
All possible values of the reg field in the ModR/M byte.
This is an optimization pass for GlobalISel generic memory operations.
Target & getTheLanaiTarget()
RegisterAsmPrinter - Helper template for registering a target specific assembly printer,...