38#define DEBUG_TYPE "asm-printer"
46 std::unique_ptr<MCStreamer> Streamer)
64void LanaiAsmPrinter::printOperand(
const MachineInstr *
MI,
int OpNum,
96 O << MAI->getPrivateGlobalPrefix() <<
"JTI" << getFunctionNumber() <<
'_'
101 O << MAI->getPrivateGlobalPrefix() <<
"CPI" << getFunctionNumber() <<
'_'
111bool LanaiAsmPrinter::PrintAsmOperand(
const MachineInstr *
MI,
unsigned OpNo,
114 if (ExtraCode && ExtraCode[0]) {
118 switch (ExtraCode[0]) {
124 if (!FlagsOP.
isImm())
127 const unsigned NumVals =
Flags.getNumOperandRegisters();
130 unsigned RegOp = OpNo + 1;
131 if (RegOp >=
MI->getNumOperands())
149void LanaiAsmPrinter::emitCallInstruction(
const MachineInstr *
MI) {
150 assert((
MI->getOpcode() == Lanai::CALL ||
MI->getOpcode() == Lanai::CALLR) &&
151 "Unsupported call function");
174 if (
MI->getOpcode() == Lanai::CALL) {
176 MCInstLowering.Lower(
MI, TmpInst);
178 OutStreamer->emitInstruction(TmpInst, STI);
182 .addReg(
MI->getOperand(0).getReg())
189void LanaiAsmPrinter::customEmitInstruction(
const MachineInstr *
MI) {
193 MCInstLowering.Lower(
MI, TmpInst);
194 OutStreamer->emitInstruction(TmpInst, STI);
198 Lanai_MC::verifyInstructionPredicates(
MI->getOpcode(),
199 getSubtargetInfo().getFeatureBits());
206 emitCallInstruction(&*
I);
210 customEmitInstruction(&*
I);
211 }
while ((++
I != E) &&
I->isInsideBundle());
218bool LanaiAsmPrinter::isBlockOnlyReachableByFallthrough(
226 if (isa<SwitchInst>(
B->getTerminator()))
236 while (
I != Pred->
begin() && !(--
I)->isTerminator()) {
239 return !
I->isBarrier();
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
#define LLVM_EXTERNAL_VISIBILITY
This file contains the declarations for the subclasses of Constant, which represent the different fla...
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 ...
Module.h This file contains the declarations for the Module class.
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(unsigned 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,...