Skip to content

Commit 7c3ce2a

Browse files
committed
Move helper function to TargetLoweringBase
1 parent bac7223 commit 7c3ce2a

File tree

4 files changed

+14
-17
lines changed

4 files changed

+14
-17
lines changed

llvm/include/llvm/Analysis/TargetLibraryInfo.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#define LLVM_ANALYSIS_TARGETLIBRARYINFO_H
1111

1212
#include "llvm/ADT/DenseMap.h"
13-
#include "llvm/CodeGen/ISDOpcodes.h"
1413
#include "llvm/IR/Constants.h"
1514
#include "llvm/IR/InstrTypes.h"
1615
#include "llvm/IR/Module.h"
@@ -458,21 +457,6 @@ class TargetLibraryInfo {
458457
return Impl->CustomNames.find(F)->second;
459458
}
460459

461-
static unsigned getISDNode(Intrinsic::ID ID) {
462-
unsigned Node;
463-
switch (ID) {
464-
case Intrinsic::exp:
465-
Node = ISD::FEXP;
466-
break;
467-
case Intrinsic::exp2:
468-
Node = ISD::FEXP2;
469-
break;
470-
default:
471-
llvm_unreachable("Intrinsic ID not supported yet");
472-
}
473-
return Node;
474-
}
475-
476460
static void initExtensionsForTriple(bool &ShouldExtI32Param,
477461
bool &ShouldExtI32Return,
478462
bool &ShouldSignExtI32Param,

llvm/include/llvm/CodeGen/TargetLowering.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2123,6 +2123,9 @@ class TargetLoweringBase {
21232123
/// Get the ISD node that corresponds to the Instruction class opcode.
21242124
int InstructionOpcodeToISD(unsigned Opcode) const;
21252125

2126+
/// Get the ISD node that corresponds to the Intrinsic ID.
2127+
int IntrinsicIDToISD(Intrinsic::ID ID) const;
2128+
21262129
/// @}
21272130

21282131
//===--------------------------------------------------------------------===//

llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ bool PreISelIntrinsicLowering::lowerIntrinsics(Module &M) const {
461461
if (!isa<ScalableVectorType>(Ty))
462462
return false;
463463
const TargetLowering *TL = TM->getSubtargetImpl(F)->getTargetLowering();
464-
unsigned Op = TargetLibraryInfo::getISDNode(F.getIntrinsicID());
464+
unsigned Op = TL->IntrinsicIDToISD(F.getIntrinsicID());
465465
if (!TL->isOperationExpand(Op, EVT::getEVT(Ty)))
466466
return false;
467467
return lowerUnaryVectorIntrinsicAsLoop(M, CI);

llvm/lib/CodeGen/TargetLoweringBase.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1841,6 +1841,16 @@ int TargetLoweringBase::InstructionOpcodeToISD(unsigned Opcode) const {
18411841
llvm_unreachable("Unknown instruction type encountered!");
18421842
}
18431843

1844+
int TargetLoweringBase::IntrinsicIDToISD(Intrinsic::ID ID) const {
1845+
switch (ID) {
1846+
case Intrinsic::exp:
1847+
return ISD::FEXP;
1848+
case Intrinsic::exp2:
1849+
return ISD::FEXP2;
1850+
}
1851+
llvm_unreachable("Unsupported Intrinsic ID encountered!");
1852+
}
1853+
18441854
Value *
18451855
TargetLoweringBase::getDefaultSafeStackPointerLocation(IRBuilderBase &IRB,
18461856
bool UseTLS) const {

0 commit comments

Comments
 (0)