[PATCH] D121820: [SelectionDAG][NFC] Clean up SDCallSiteDbgInfo accessors
Marco Elver via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 16 09:29:31 PDT 2022
melver created this revision.
Herald added subscribers: ecnelises, hiraditya, MatzeB.
Herald added a project: All.
melver requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
- Consistent naming: addCallSiteInfo vs. getCallSiteInfo;
- Use ternary operator to reduce verbosity;
- const'ify getters;
- Add comments;
NFCI.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D121820
Files:
llvm/include/llvm/CodeGen/SelectionDAG.h
llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
Index: llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
+++ llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
@@ -883,7 +883,7 @@
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);
Index: llvm/include/llvm/CodeGen/SelectionDAG.h
===================================================================
--- llvm/include/llvm/CodeGen/SelectionDAG.h
+++ llvm/include/llvm/CodeGen/SelectionDAG.h
@@ -2119,39 +2119,34 @@
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) const {
+ 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) {
+ /// Return HeapAllocSite associated with Node, or nullptr if none exists.
+ MDNode *getHeapAllocSite(const SDNode *Node) const {
auto It = SDCallSiteDbgInfo.find(Node);
- if (It == SDCallSiteDbgInfo.end())
- return nullptr;
- return It->second.HeapAllocSite;
+ return It != SDCallSiteDbgInfo.end() ? It->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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121820.415866.patch
Type: text/x-patch
Size: 3080 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220316/69367e9f/attachment.bin>
More information about the llvm-commits
mailing list