diff options
author | Rahul Joshi <rjoshi@nvidia.com> | 2024-10-01 06:55:35 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-01 06:55:35 -0700 |
commit | 2469d7e361a2b7c8c814665a69dba09a4b17813a (patch) | |
tree | b403403be0eb91a33f4938205d2e79a0a0f32806 /llvm/lib/IR/IntrinsicInst.cpp | |
parent | 9d95e2614e425f154cb5720d9eb276c25a26524e (diff) | |
download | llvm-2469d7e361a2b7c8c814665a69dba09a4b17813a.zip llvm-2469d7e361a2b7c8c814665a69dba09a4b17813a.tar.gz llvm-2469d7e361a2b7c8c814665a69dba09a4b17813a.tar.bz2 |
[NFC] Add a new Intrinsics.cpp file for intrinsic code (#110078)
Add new file Intrinsics.cpp and move all functions in the `Intrinsic`
namespace to it.
Diffstat (limited to 'llvm/lib/IR/IntrinsicInst.cpp')
-rw-r--r-- | llvm/lib/IR/IntrinsicInst.cpp | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/llvm/lib/IR/IntrinsicInst.cpp b/llvm/lib/IR/IntrinsicInst.cpp index 5654a3a..0a6c93f 100644 --- a/llvm/lib/IR/IntrinsicInst.cpp +++ b/llvm/lib/IR/IntrinsicInst.cpp @@ -236,48 +236,6 @@ void DbgAssignIntrinsic::setValue(Value *V) { MetadataAsValue::get(getContext(), ValueAsMetadata::get(V))); } -int llvm::Intrinsic::lookupLLVMIntrinsicByName(ArrayRef<const char *> NameTable, - StringRef Name, - StringRef Target) { - assert(Name.starts_with("llvm.") && "Unexpected intrinsic prefix"); - assert(Name.drop_front(5).starts_with(Target) && "Unexpected target"); - - // Do successive binary searches of the dotted name components. For - // "llvm.gc.experimental.statepoint.p1i8.p1i32", we will find the range of - // intrinsics starting with "llvm.gc", then "llvm.gc.experimental", then - // "llvm.gc.experimental.statepoint", and then we will stop as the range is - // size 1. During the search, we can skip the prefix that we already know is - // identical. By using strncmp we consider names with differing suffixes to - // be part of the equal range. - size_t CmpEnd = 4; // Skip the "llvm" component. - if (!Target.empty()) - CmpEnd += 1 + Target.size(); // skip the .target component. - - const char *const *Low = NameTable.begin(); - const char *const *High = NameTable.end(); - const char *const *LastLow = Low; - while (CmpEnd < Name.size() && High - Low > 0) { - size_t CmpStart = CmpEnd; - CmpEnd = Name.find('.', CmpStart + 1); - CmpEnd = CmpEnd == StringRef::npos ? Name.size() : CmpEnd; - auto Cmp = [CmpStart, CmpEnd](const char *LHS, const char *RHS) { - return strncmp(LHS + CmpStart, RHS + CmpStart, CmpEnd - CmpStart) < 0; - }; - LastLow = Low; - std::tie(Low, High) = std::equal_range(Low, High, Name.data(), Cmp); - } - if (High - Low > 0) - LastLow = Low; - - if (LastLow == NameTable.end()) - return -1; - StringRef NameFound = *LastLow; - if (Name == NameFound || - (Name.starts_with(NameFound) && Name[NameFound.size()] == '.')) - return LastLow - NameTable.begin(); - return -1; -} - ConstantInt *InstrProfCntrInstBase::getNumCounters() const { if (InstrProfValueProfileInst::classof(this)) llvm_unreachable("InstrProfValueProfileInst does not have counters!"); |