[SelectionDAG][NFC] Clean up SDCallSiteDbgInfo accessors

* Consistent naming: addCallSiteInfo vs. getCallSiteInfo;
* Use ternary operator to reduce verbosity;
* const'ify getters;
* Add comments;

NFCI.

Differential Revision: https://reviews.llvm.org/D121820
This commit is contained in:
Marco Elver 2022-03-16 17:35:10 +01:00
parent 9990395859
commit 555df03012
2 changed files with 18 additions and 23 deletions

View File

@ -2119,39 +2119,34 @@ public:
isConstantFPBuildVectorOrConstantFP(N);
}
void addCallSiteInfo(const SDNode *CallNode, CallSiteInfoImpl &&CallInfo) {
SDCallSiteDbgInfo[CallNode].CSInfo = std::move(CallInfo);
/// Set CallSiteInfo to be associated with Node.
void addCallSiteInfo(const SDNode *Node, CallSiteInfoImpl &&CallInfo) {
SDCallSiteDbgInfo[Node].CSInfo = std::move(CallInfo);
}
CallSiteInfo getSDCallSiteInfo(const SDNode *CallNode) {
auto I = SDCallSiteDbgInfo.find(CallNode);
if (I != SDCallSiteDbgInfo.end())
return std::move(I->second).CSInfo;
return CallSiteInfo();
/// Return CallSiteInfo associated with Node, or a default if none exists.
CallSiteInfo getCallSiteInfo(const SDNode *Node) {
auto I = SDCallSiteDbgInfo.find(Node);
return I != SDCallSiteDbgInfo.end() ? std::move(I->second).CSInfo
: CallSiteInfo();
}
/// Set HeapAllocSite to be associated with Node.
void addHeapAllocSite(const SDNode *Node, MDNode *MD) {
SDCallSiteDbgInfo[Node].HeapAllocSite = MD;
}
/// Return the HeapAllocSite type associated with the SDNode, if it exists.
MDNode *getHeapAllocSite(const SDNode *Node) {
auto It = SDCallSiteDbgInfo.find(Node);
if (It == SDCallSiteDbgInfo.end())
return nullptr;
return It->second.HeapAllocSite;
/// Return HeapAllocSite associated with Node, or nullptr if none exists.
MDNode *getHeapAllocSite(const SDNode *Node) const {
auto I = SDCallSiteDbgInfo.find(Node);
return I != SDCallSiteDbgInfo.end() ? I->second.HeapAllocSite : nullptr;
}
/// Set NoMergeSiteInfo to be associated with Node if NoMerge is true.
void addNoMergeSiteInfo(const SDNode *Node, bool NoMerge) {
if (NoMerge)
SDCallSiteDbgInfo[Node].NoMerge = NoMerge;
}
bool getNoMergeSiteInfo(const SDNode *Node) {
/// Return NoMerge info associated with Node.
bool getNoMergeSiteInfo(const SDNode *Node) const {
auto I = SDCallSiteDbgInfo.find(Node);
if (I == SDCallSiteDbgInfo.end())
return false;
return I->second.NoMerge;
return I != SDCallSiteDbgInfo.end() ? I->second.NoMerge : false;
}
/// Return the current function's default denormal handling kind for the given

View File

@ -883,7 +883,7 @@ EmitSchedule(MachineBasicBlock::iterator &InsertPos) {
if (MI->isCandidateForCallSiteEntry() &&
DAG->getTarget().Options.EmitCallSiteInfo)
MF.addCallArgsForwardingRegs(MI, DAG->getSDCallSiteInfo(Node));
MF.addCallArgsForwardingRegs(MI, DAG->getCallSiteInfo(Node));
if (DAG->getNoMergeSiteInfo(Node)) {
MI->setFlag(MachineInstr::MIFlag::NoMerge);