Skip to content

Commit f8a77f3

Browse files
authored
Hexagon: Add runtime libcall entries for volatile memcpy call (#156561)
This pass currently doesn't have TargetLoweringInfo, but technically it should verify the call is available from a future RuntimeLibcallsInfo analysis.
1 parent e43b334 commit f8a77f3

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

llvm/include/llvm/IR/RuntimeLibcalls.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,7 @@ def AEABI_MEMCLR8 : RuntimeLibcall;
446446

447447
// Hexagon calls
448448
def HEXAGON_MEMCPY_LIKELY_ALIGNED_MIN32BYTES_MULT8BYTES : RuntimeLibcall;
449+
def HEXAGON_VOLATILE_MEMCPY : RuntimeLibcall;
449450

450451
// XCore calls
451452
def MEMCPY_ALIGN_4 : RuntimeLibcall;
@@ -1875,6 +1876,8 @@ def __hexagon_fast2_sqrtdf2 : RuntimeLibcallImpl<FAST_SQRT_F64>;
18751876

18761877
def __hexagon_memcpy_likely_aligned_min32bytes_mult8bytes
18771878
: RuntimeLibcallImpl<HEXAGON_MEMCPY_LIKELY_ALIGNED_MIN32BYTES_MULT8BYTES>;
1879+
1880+
def hexagon_memcpy_forward_vp4cp4n2 : RuntimeLibcallImpl<HEXAGON_VOLATILE_MEMCPY>;
18781881
}
18791882

18801883
def isHexagon : RuntimeLibcallPredicate<"TT.getArch() == Triple::hexagon">;

llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include "llvm/IR/Module.h"
4343
#include "llvm/IR/PassManager.h"
4444
#include "llvm/IR/PatternMatch.h"
45+
#include "llvm/IR/RuntimeLibcalls.h"
4546
#include "llvm/IR/Type.h"
4647
#include "llvm/IR/User.h"
4748
#include "llvm/IR/Value.h"
@@ -104,9 +105,6 @@ static cl::opt<bool> HexagonVolatileMemcpy(
104105
static cl::opt<unsigned> SimplifyLimit("hlir-simplify-limit", cl::init(10000),
105106
cl::Hidden, cl::desc("Maximum number of simplification steps in HLIR"));
106107

107-
static const char *HexagonVolatileMemcpyName
108-
= "hexagon_memcpy_forward_vp4cp4n2";
109-
110108
namespace {
111109

112110
class HexagonLoopIdiomRecognize {
@@ -2246,6 +2244,11 @@ bool HexagonLoopIdiomRecognize::processCopyingStore(Loop *CurLoop,
22462244
Type *PtrTy = PointerType::get(Ctx, 0);
22472245
Type *VoidTy = Type::getVoidTy(Ctx);
22482246
Module *M = Func->getParent();
2247+
2248+
// FIXME: This should check if the call is supported
2249+
StringRef HexagonVolatileMemcpyName =
2250+
RTLIB::RuntimeLibcallsInfo::getLibcallImplName(
2251+
RTLIB::impl_hexagon_memcpy_forward_vp4cp4n2);
22492252
FunctionCallee Fn = M->getOrInsertFunction(
22502253
HexagonVolatileMemcpyName, VoidTy, PtrTy, PtrTy, Int32Ty);
22512254

0 commit comments

Comments
 (0)