本文整理汇总了C++中StackMaps::recordStatepoint方法的典型用法代码示例。如果您正苦于以下问题:C++ StackMaps::recordStatepoint方法的具体用法?C++ StackMaps::recordStatepoint怎么用?C++ StackMaps::recordStatepoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StackMaps
的用法示例。
在下文中一共展示了StackMaps::recordStatepoint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LowerSTATEPOINT
static void LowerSTATEPOINT(MCStreamer &OS, StackMaps &SM,
const MachineInstr &MI, bool Is64Bit,
const TargetMachine& TM,
const MCSubtargetInfo& STI,
X86MCInstLower &MCInstLowering) {
assert(Is64Bit && "Statepoint currently only supports X86-64");
// Lower call target and choose correct opcode
const MachineOperand &call_target = StatepointOpers(&MI).getCallTarget();
MCOperand call_target_mcop;
unsigned call_opcode;
switch (call_target.getType()) {
case MachineOperand::MO_GlobalAddress:
case MachineOperand::MO_ExternalSymbol:
call_target_mcop = MCInstLowering.LowerSymbolOperand(
call_target,
MCInstLowering.GetSymbolFromOperand(call_target));
call_opcode = X86::CALL64pcrel32;
// Currently, we only support relative addressing with statepoints.
// Otherwise, we'll need a scratch register to hold the target
// address. You'll fail asserts during load & relocation if this
// symbol is to far away. (TODO: support non-relative addressing)
break;
case MachineOperand::MO_Immediate:
call_target_mcop = MCOperand::CreateImm(call_target.getImm());
call_opcode = X86::CALL64pcrel32;
// Currently, we only support relative addressing with statepoints.
// Otherwise, we'll need a scratch register to hold the target
// immediate. You'll fail asserts during load & relocation if this
// address is to far away. (TODO: support non-relative addressing)
break;
case MachineOperand::MO_Register:
call_target_mcop = MCOperand::CreateReg(call_target.getReg());
call_opcode = X86::CALL64r;
break;
default:
llvm_unreachable("Unsupported operand type in statepoint call target");
break;
}
// Emit call
MCInst call_inst;
call_inst.setOpcode(call_opcode);
call_inst.addOperand(call_target_mcop);
OS.EmitInstruction(call_inst, STI);
// Record our statepoint node in the same section used by STACKMAP
// and PATCHPOINT
SM.recordStatepoint(MI);
}