45 default:
return false;
46 case TargetOpcode::IMPLICIT_DEF:
48 case TargetOpcode::CFI_INSTRUCTION:
50 case TargetOpcode::GC_LABEL:
51 case TargetOpcode::DBG_VALUE:
52 case TargetOpcode::DBG_LABEL:
64 assert(PatchType ==
"prologue-short-redirect" &&
"Only possibility today!");
67 auto &FirstMBB = *MF.
begin();
70 assert(FirstActualI != FirstMBB.end());
73 auto MIB =
BuildMI(FirstMBB, FirstActualI, FirstActualI->getDebugLoc(),
74 TII->get(TargetOpcode::PATCHABLE_OP))
76 .
addImm(FirstActualI->getOpcode());
78 for (
auto &MO : FirstActualI->operands())
81 FirstActualI->eraseFromParent();
89 "Implement the 'patchable-function' attribute",
false,
false)
const MachineInstrBuilder & add(const MachineOperand &MO) const
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
This class represents lattice values for constants.
void initializePatchableFunctionPass(PassRegistry &)
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
const HexagonInstrInfo * TII
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
static bool doesNotGeneratecode(const MachineInstr &MI)
Returns true if instruction MI will not result in actual machine code instructions.
virtual const TargetInstrInfo * getInstrInfo() const
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
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)
const Function & getFunction() const
Return the LLVM function that this machine code represents.
MachineFunctionProperties & set(Property P)
Representation of each machine instruction.
char & PatchableFunctionID
This pass implements the "patchable-function" attribute.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
StringRef getValueAsString() const
Return the attribute's value as a string.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Attribute getFnAttribute(Attribute::AttrKind Kind) const
Return the attribute for the given attribute kind.
StringRef - Represent a constant reference to a string, i.e.
Properties which a MachineFunction may have at a given point in time.