Go to the documentation of this file.
32 #define DEBUG_TYPE "m68k-mc-inst-lower"
35 : Ctx(MF.getContext()), MF(MF),
TM(MF.getTarget()), MAI(*
TM.getMCAsmInfo()),
41 "Isn't a symbol reference");
44 if (MO.
isGlobal() && TT.isOSBinFormatELF())
54 Name +=
DL.getPrivateGlobalPrefix();
61 }
else if (MO.
isMBB()) {
77 const MCExpr *Expr =
nullptr;
113 std::optional<MCOperand>
146 unsigned Opcode =
MI->getOpcode();
149 for (
unsigned i = 0,
e =
MI->getNumOperands();
i !=
e; ++
i) {
153 if (MCOp.has_value() && MCOp.value().isValid())
158 if (Opcode == M68k::TAILJMPj || Opcode == M68k::TAILJMPq) {
162 Opcode = M68k::JMP32j;
@ MO_BlockAddress
Address of a basic block.
@ MO_Immediate
Immediate operand.
This is an optimization pass for GlobalISel generic memory operations.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
A parsed version of the target data layout string in and methods for querying it.
static MCOperand createExpr(const MCExpr *Val)
const GlobalValue * getGlobal() const
static MCOperand createImm(int64_t Val)
M68kMCInstLower(MachineFunction &MF, M68kAsmPrinter &AP)
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false, unsigned SizeInBytes=0)
const BlockAddress * getBlockAddress() const
MCSymbol * GetSymbolFromOperand(const MachineOperand &MO) const
Lower an MO_GlobalAddress or MO_ExternalSymbol operand to an MCSymbol.
void getNameWithPrefix(SmallVectorImpl< char > &Name, const GlobalValue *GV) const
bool isSymbol() const
isSymbol - Tests if this is a MO_ExternalSymbol operand.
bool isJTI() const
isJTI - Tests if this is a MO_JumpTableIndex operand.
@ MO_PLT
On a symbol operand this indicates that the immediate is offset to the PLT entry of symbol name from ...
@ MO_GOT
On a symbol operand this indicates that the immediate is the offset to the GOT entry for the symbol n...
Instances of this class represent a single low-level machine instruction.
@ MO_PC_RELATIVE_ADDRESS
On a symbol operand this indicates that the immediate is the pc-relative address of the symbol.
int64_t getOffset() const
Return the offset from the symbol in this operand.
unsigned getNumOperands() const
void Lower(const MachineInstr *MI, MCInst &OutMI) const
MCSymbol * getMCSymbol() const
@ MO_Register
Register operand.
void setOpcode(unsigned Op)
MCSymbol * getSymbol() const
Return the MCSymbol for this basic block.
MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
@ MO_GOTOFF
On a symbol operand this indicates that the immediate is the offset to the location of the symbol nam...
@ MO_GlobalAddress
Address of a global value.
MCOperand LowerSymbolOperand(const MachineOperand &MO, MCSymbol *Sym) const
bool isMBB() const
isMBB - Tests if this is a MO_MachineBasicBlock operand.
void getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV, bool CannotUsePrivateLabel) const
Print the appropriate prefix and the specified global variable's name.
MachineOperand class - Representation of each machine instruction operand.
void addOperand(const MCOperand Op)
constexpr bool empty() const
empty - Check if the string is empty.
unsigned getTargetFlags() const
virtual MCSymbol * GetCPISymbol(unsigned CPID) const
Return the symbol for the specified constant pool entry.
Representation of each machine instruction.
MCSymbol * GetBlockAddressSymbol(const BlockAddress *BA) const
Return the MCSymbol used to satisfy BlockAddress uses of the specified basic block.
MCSymbol * getSymbolPreferLocal(const GlobalValue &GV) const
Similar to getSymbol() but preferred for references.
@ MO_MCSymbol
MCSymbol reference (for debug/eh info)
MachineOperandType getType() const
getType - Returns the MachineOperandType for this operand.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
std::optional< MCOperand > LowerOperand(const MachineInstr *MI, const MachineOperand &MO) const
Register getReg() const
getReg - Returns the register number.
@ MO_JumpTableIndex
Address of indexed Jump Table for switch.
static const MCBinaryExpr * createAdd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
@ MO_ABSOLUTE_ADDRESS
On a symbol operand this indicates that the immediate is the absolute address of the symbol.
MachineBasicBlock * getMBB() const
StringRef - Represent a constant reference to a string, i.e.
MCSymbol * GetJTISymbol(unsigned JTID, bool isLinkerPrivate=false) const
Return the symbol for the specified jump table entry.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
static MCOperand createReg(unsigned Reg)
@ MO_MachineBasicBlock
MachineBasicBlock reference.
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
@ MO_ExternalSymbol
Name of external global symbol.
This class is intended to be used as a driving class for all asm writers.
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
const char * getSymbolName() const
const Triple & getTargetTriple() const
const DataLayout & getDataLayout() const
Return the DataLayout attached to the Module associated to this MF.
@ MO_GOTPCREL
On a symbol operand this indicates that the immediate is offset to the GOT entry for the symbol name ...
const char LLVMTargetMachineRef TM
Instances of this class represent operands of the MCInst class.
@ MO_RegisterMask
Mask of preserved registers.
Base class for the full range of assembler expressions which are needed for parsing.
bool isGlobal() const
isGlobal - Tests if this is a MO_GlobalAddress operand.
@ MO_ConstantPoolIndex
Address of indexed Constant in Constant Pool.