33#define DEBUG_TYPE "asm-printer" 
   41                           std::unique_ptr<MCStreamer> Streamer)
 
   44  StringRef getPassName()
 const override { 
return "Lanai Assembly Printer"; }
 
   50  bool isBlockOnlyReachableByFallthrough(
 
   62void LanaiAsmPrinter::printOperand(
const MachineInstr *
MI, 
int OpNum,
 
   64  const MachineOperand &MO = 
MI->getOperand(OpNum);
 
   94    O << MAI->getPrivateGlobalPrefix() << 
"JTI" << getFunctionNumber() << 
'_' 
   99    O << MAI->getPrivateGlobalPrefix() << 
"CPI" << getFunctionNumber() << 
'_' 
  109bool LanaiAsmPrinter::PrintAsmOperand(
const MachineInstr *
MI, 
unsigned OpNo,
 
  110                                      const char *ExtraCode, raw_ostream &O) {
 
  112  if (ExtraCode && ExtraCode[0]) {
 
  116    switch (ExtraCode[0]) {
 
  121      const MachineOperand &FlagsOP = 
MI->getOperand(OpNo - 1);
 
  122      if (!FlagsOP.
isImm())
 
  125      const unsigned NumVals = 
Flags.getNumOperandRegisters();
 
  128      unsigned RegOp = OpNo + 1;
 
  129      if (RegOp >= 
MI->getNumOperands())
 
  131      const MachineOperand &MO = 
MI->getOperand(RegOp);
 
  147void LanaiAsmPrinter::emitCallInstruction(
const MachineInstr *
MI) {
 
  148  assert((
MI->getOpcode() == Lanai::CALL || 
MI->getOpcode() == Lanai::CALLR) &&
 
  149         "Unsupported call function");
 
  151  LanaiMCInstLower MCInstLowering(OutContext, *
this);
 
  152  MCSubtargetInfo STI = getSubtargetInfo();
 
  156  OutStreamer->emitInstruction(MCInstBuilder(Lanai::ADD_I_LO)
 
  164  OutStreamer->emitInstruction(MCInstBuilder(Lanai::SW_RI)
 
  172  if (
MI->getOpcode() == Lanai::CALL) {
 
  174    MCInstLowering.Lower(
MI, TmpInst);
 
  176    OutStreamer->emitInstruction(TmpInst, STI);
 
  178    OutStreamer->emitInstruction(MCInstBuilder(Lanai::ADD_R)
 
  180                                     .addReg(
MI->getOperand(0).getReg())
 
  187void LanaiAsmPrinter::customEmitInstruction(
const MachineInstr *
MI) {
 
  188  LanaiMCInstLower MCInstLowering(OutContext, *
this);
 
  189  MCSubtargetInfo STI = getSubtargetInfo();
 
  191  MCInstLowering.Lower(
MI, TmpInst);
 
  192  OutStreamer->emitInstruction(TmpInst, STI);
 
  195void LanaiAsmPrinter::emitInstruction(
const MachineInstr *
MI) {
 
  196  Lanai_MC::verifyInstructionPredicates(
MI->getOpcode(),
 
  197                                        getSubtargetInfo().getFeatureBits());
 
  204      emitCallInstruction(&*
I);
 
  208    customEmitInstruction(&*
I);
 
  209  } 
while ((++
I != 
E) && 
I->isInsideBundle());
 
  216bool LanaiAsmPrinter::isBlockOnlyReachableByFallthrough(
 
  217    const MachineBasicBlock *
MBB)
 const {
 
  234  while (
I != Pred->
begin() && !(--
I)->isTerminator()) {
 
  237  return !
I->isBarrier();
 
  240char LanaiAsmPrinter::ID = 0;
 
  247LLVMInitializeLanaiAsmPrinter() {
 
 
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
 
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
 
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
 
#define LLVM_EXTERNAL_VISIBILITY
 
This file declares the MachineConstantPool class which is an abstract constant pool to keep track of ...
 
Promote Memory to Register
 
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
 
static bool printOperand(raw_ostream &OS, const SelectionDAG *G, const SDValue Value)
 
static TableGen::Emitter::OptClass< SkeletonEmitter > X("gen-skeleton-class", "Generate example skeleton class")
 
This class is intended to be used as a driving class for all asm writers.
 
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.
 
static const char * getRegisterName(MCRegister Reg)
 
void setOpcode(unsigned Op)
 
StringRef getName() const
getName - Get the symbol name.
 
MachineInstrBundleIterator< const MachineInstr > const_iterator
 
LLVM_ABI 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.
 
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.
 
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.
 
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
 
static unsigned makePreOp(unsigned AluOp)
 
This is an optimization pass for GlobalISel generic memory operations.
 
Target & getTheLanaiTarget()
 
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
 
RegisterAsmPrinter - Helper template for registering a target specific assembly printer,...