forked from OSchip/llvm-project
[MachineInstr] Add isCandidateForCallSiteEntry predicate
Add the isCandidateForCallSiteEntry predicate to MachineInstr to determine whether a DWARF call site entry should be created for an instruction. For now, it's enough to have any call instruction that doesn't belong to a blacklisted set of opcodes. For these opcodes, a call site entry isn't meaningful. Differential Revision: https://reviews.llvm.org/D74159
This commit is contained in:
parent
e21b39a86d
commit
0d0ef315cb
|
@ -983,10 +983,14 @@ public:
|
|||
return VariableDbgInfos;
|
||||
}
|
||||
|
||||
/// Start tracking the arguments passed to the call \p CallI.
|
||||
void addCallArgsForwardingRegs(const MachineInstr *CallI,
|
||||
CallSiteInfoImpl &&CallInfo) {
|
||||
assert(CallI->isCall());
|
||||
CallSitesInfo[CallI] = std::move(CallInfo);
|
||||
assert(CallI->isCandidateForCallSiteEntry());
|
||||
bool Inserted =
|
||||
CallSitesInfo.try_emplace(CallI, std::move(CallInfo)).second;
|
||||
(void)Inserted;
|
||||
assert(Inserted && "Call site info not unique");
|
||||
}
|
||||
|
||||
const CallSiteInfoMap &getCallSitesInfo() const {
|
||||
|
|
|
@ -683,6 +683,10 @@ public:
|
|||
return hasProperty(MCID::Call, Type);
|
||||
}
|
||||
|
||||
/// Return true if this is a call instruction that may have an associated
|
||||
/// call site entry in the debug info.
|
||||
bool isCandidateForCallSiteEntry() const;
|
||||
|
||||
/// Returns true if the specified instruction stops control flow
|
||||
/// from executing the instruction immediately following it. Examples include
|
||||
/// unconditional branches and return instructions.
|
||||
|
|
|
@ -764,7 +764,7 @@ void DwarfDebug::constructCallSiteEntryDIEs(const DISubprogram &SP,
|
|||
|
||||
// Skip instructions which aren't calls. Both calls and tail-calling jump
|
||||
// instructions (e.g TAILJMPd64) are classified correctly here.
|
||||
if (!MI.isCall())
|
||||
if (!MI.isCandidateForCallSiteEntry())
|
||||
continue;
|
||||
|
||||
// TODO: Add support for targets with delay slots (see: beginInstruction).
|
||||
|
|
|
@ -696,6 +696,20 @@ void MachineInstr::eraseFromBundle() {
|
|||
getParent()->erase_instr(this);
|
||||
}
|
||||
|
||||
bool MachineInstr::isCandidateForCallSiteEntry() const {
|
||||
if (!isCall(MachineInstr::IgnoreBundle))
|
||||
return false;
|
||||
switch (getOpcode()) {
|
||||
case TargetOpcode::PATCHABLE_EVENT_CALL:
|
||||
case TargetOpcode::PATCHABLE_TYPED_EVENT_CALL:
|
||||
case TargetOpcode::PATCHPOINT:
|
||||
case TargetOpcode::STACKMAP:
|
||||
case TargetOpcode::STATEPOINT:
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
unsigned MachineInstr::getNumExplicitOperands() const {
|
||||
unsigned NumOperands = MCID->getNumOperands();
|
||||
if (!MCID->isVariadic())
|
||||
|
|
|
@ -863,7 +863,8 @@ EmitSchedule(MachineBasicBlock::iterator &InsertPos) {
|
|||
MI = &*std::next(Before);
|
||||
}
|
||||
|
||||
if (MI->isCall() && DAG->getTarget().Options.EnableDebugEntryValues)
|
||||
if (MI->isCandidateForCallSiteEntry() &&
|
||||
DAG->getTarget().Options.EnableDebugEntryValues)
|
||||
MF.addCallArgsForwardingRegs(MI, DAG->getSDCallSiteInfo(Node));
|
||||
|
||||
return MI;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; RUN: llc < %s -mtriple=arm64-apple-darwin | FileCheck %s
|
||||
; RUN: llc < %s -debug-entry-values -mtriple=arm64-apple-darwin | FileCheck %s
|
||||
|
||||
; Stackmap Header: no constants - 6 callsites
|
||||
; CHECK-LABEL: .section __LLVM_STACKMAPS,__llvm_stackmaps
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
; RUN: llc -mtriple=arm64-apple-darwin -enable-misched=0 -mcpu=cyclone < %s | FileCheck %s
|
||||
; RUN: llc -mtriple=arm64-apple-darwin -enable-misched=0 -mcpu=cyclone -fast-isel -fast-isel-abort=1 < %s | FileCheck %s
|
||||
; RUN: llc -mtriple=arm64-apple-darwin -debug-entry-values -enable-misched=0 -mcpu=cyclone < %s | FileCheck %s
|
||||
; RUN: llc -mtriple=arm64-apple-darwin -debug-entry-values -enable-misched=0 -mcpu=cyclone -fast-isel -fast-isel-abort=1 < %s | FileCheck %s
|
||||
|
||||
; Trivial patchpoint codegen
|
||||
;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
||||
; RUN: llc -verify-machineinstrs < %s | FileCheck %s
|
||||
; RUN: llc -verify-machineinstrs -debug-entry-values < %s | FileCheck %s
|
||||
; Check that we can lower a use of an alloca both as a deopt value (where the
|
||||
; exact meaning is up to the consumer of the stackmap) and as an explicit spill
|
||||
; slot used for GC.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
; RUN: llc -verify-machineinstrs -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
|
||||
; RUN: llc -verify-machineinstrs -filetype=asm -o - \
|
||||
; RUN: llc -verify-machineinstrs -debug-entry-values -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
|
||||
; RUN: llc -verify-machineinstrs -debug-entry-values -filetype=asm -o - \
|
||||
; RUN: -mtriple=x86_64-unknown-linux-gnu -relocation-model=pic < %s | FileCheck %s -check-prefix=PIC
|
||||
|
||||
define i32 @fn() nounwind noinline uwtable "function-instrument"="xray-always" {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
; RUN: llc -verify-machineinstrs -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
|
||||
; RUN: llc -verify-machineinstrs -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu \
|
||||
; RUN: llc -verify-machineinstrs -debug-entry-values -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
|
||||
; RUN: llc -verify-machineinstrs -debug-entry-values -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu \
|
||||
; RUN: -relocation-model=pic < %s | FileCheck %s -check-prefix=PIC
|
||||
|
||||
define i32 @fn() nounwind noinline uwtable "function-instrument"="xray-always" {
|
||||
|
|
Loading…
Reference in New Issue