45 default:
return false;
46 case TargetOpcode::IMPLICIT_DEF:
48 case TargetOpcode::CFI_INSTRUCTION:
50 case TargetOpcode::GC_LABEL:
51 case TargetOpcode::DBG_VALUE:
63 assert(PatchType ==
"prologue-short-redirect" &&
"Only possibility today!");
66 auto &FirstMBB = *MF.
begin();
69 assert(FirstActualI != FirstMBB.end());
72 auto MIB =
BuildMI(FirstMBB, FirstActualI, FirstActualI->getDebugLoc(),
73 TII->get(TargetOpcode::PATCHABLE_OP))
75 .
addImm(FirstActualI->getOpcode());
77 for (
auto &MO : FirstActualI->operands())
80 FirstActualI->eraseFromParent();
88 "Implement the 'patchable-function' attribute",
false,
false)
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
void initializePatchableFunctionPass(PassRegistry &)
Attribute getFnAttribute(Attribute::AttrKind Kind) const
Return the attribute for the given attribute kind.
const Function * getFunction() const
getFunction - Return the LLVM function that this machine code represents
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
const HexagonInstrInfo * TII
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
static bool doesNotGeneratecode(const MachineInstr &MI)
Returns true if instruction MI will not result in actual machine code instructions.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
void ensureAlignment(unsigned A)
ensureAlignment - Make sure the function is at least 1 << A bytes aligned.
EH_LABEL - Represents a label in mid basic block used to track locations needed for debug and excepti...
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
MachineFunctionProperties & set(Property P)
Representation of each machine instruction.
char & PatchableFunctionID
This pass implements the "patchable-function" attribute.
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
StringRef getValueAsString() const
Return the attribute's value as a string.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
virtual const TargetInstrInfo * getInstrInfo() const
const MachineInstrBuilder & addOperand(const MachineOperand &MO) const
StringRef - Represent a constant reference to a string, i.e.
Properties which a MachineFunction may have at a given point in time.