aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/TargetLoweringBase.cpp
diff options
context:
space:
mode:
authorRoger Ferrer Ibáñez <rofirrim@gmail.com>2024-05-30 14:55:32 +0200
committerGitHub <noreply@github.com>2024-05-30 14:55:32 +0200
commit05e6bb40ebfd285cc87f7ce326b7ba76c3c7f870 (patch)
tree8df6fcee6176cbd297b3364da805d77727919012 /llvm/lib/CodeGen/TargetLoweringBase.cpp
parent191e64ffa9061e9c0d5387b38bd2d5a9ffebb0fb (diff)
downloadllvm-05e6bb40ebfd285cc87f7ce326b7ba76c3c7f870.zip
llvm-05e6bb40ebfd285cc87f7ce326b7ba76c3c7f870.tar.gz
llvm-05e6bb40ebfd285cc87f7ce326b7ba76c3c7f870.tar.bz2
[SelectionDAG] Add an ISD::CLEAR_CACHE node to lower llvm.clear_cache (#93795)
The current way of lowering `llvm.clear_cache` is a bit unusual. As suggested by Matt Arsenault we are better off using an ISD node. This change introduces a new `ISD::CLEAR_CACHE`, registers a new libcall by default named `__clear_cache` and the default legalisation is a libcall. This is preparatory work for a custom lowering of `ISD::CLEAR_CACHE` needed by RISC-V on some platforms.
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringBase.cpp')
-rw-r--r--llvm/lib/CodeGen/TargetLoweringBase.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp
index f2e4632..3aec704 100644
--- a/llvm/lib/CodeGen/TargetLoweringBase.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp
@@ -1035,6 +1035,10 @@ void TargetLoweringBase::initActions() {
setOperationAction(ISD::SET_FPMODE, VT, Expand);
}
setOperationAction(ISD::RESET_FPMODE, MVT::Other, Expand);
+
+ // This one by default will call __clear_cache unless the target
+ // wants something different.
+ setOperationAction(ISD::CLEAR_CACHE, MVT::Other, LibCall);
}
MVT TargetLoweringBase::getScalarShiftAmountTy(const DataLayout &DL,