mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +00:00
Change Function::getIntrinsicID() to return an Intrinsic::ID. NFC.
Now that Intrinsic::ID is a typed enum, we can forward declare it and so return it from this method. This updates all users which were either using an unsigned to store it, or had a now unnecessary cast. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237810 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1563a4a416
commit
9584e07a9c
@ -365,7 +365,7 @@ public:
|
||||
// function.
|
||||
NumArgs = F->arg_size();
|
||||
|
||||
if (Intrinsic::ID IID = (Intrinsic::ID)F->getIntrinsicID()) {
|
||||
if (Intrinsic::ID IID = F->getIntrinsicID()) {
|
||||
FunctionType *FTy = F->getFunctionType();
|
||||
SmallVector<Type *, 8> ParamTys(FTy->param_begin(), FTy->param_end());
|
||||
return static_cast<T *>(this)
|
||||
|
@ -144,7 +144,7 @@ public:
|
||||
/// zero to allow easy checking for whether a function is intrinsic or not.
|
||||
/// The particular intrinsic functions which correspond to this value are
|
||||
/// defined in llvm/Intrinsics.h.
|
||||
unsigned getIntrinsicID() const LLVM_READONLY { return IntID; }
|
||||
Intrinsic::ID getIntrinsicID() const LLVM_READONLY { return IntID; }
|
||||
bool isIntrinsic() const { return getName().startswith("llvm."); }
|
||||
|
||||
/// \brief Recalculate the ID for this function if it is an Intrinsic defined
|
||||
|
@ -500,7 +500,7 @@ public:
|
||||
private:
|
||||
/// \brief Create a call to a masked intrinsic with given Id.
|
||||
/// Masked intrinsic has only one overloaded type - data type.
|
||||
CallInst *CreateMaskedIntrinsic(unsigned Id, ArrayRef<Value *> Ops,
|
||||
CallInst *CreateMaskedIntrinsic(Intrinsic::ID Id, ArrayRef<Value *> Ops,
|
||||
Type *DataTy, const Twine &Name = "");
|
||||
|
||||
Value *getCastedInt8PtrValue(Value *Ptr);
|
||||
|
@ -259,7 +259,7 @@ private:
|
||||
// Special helper function to delegate to CallInst subclass visitors.
|
||||
RetTy delegateCallInst(CallInst &I) {
|
||||
if (const Function *F = I.getCalledFunction()) {
|
||||
switch ((Intrinsic::ID)F->getIntrinsicID()) {
|
||||
switch (F->getIntrinsicID()) {
|
||||
default: DELEGATE(IntrinsicInst);
|
||||
case Intrinsic::dbg_declare: DELEGATE(DbgDeclareInst);
|
||||
case Intrinsic::dbg_value: DELEGATE(DbgValueInst);
|
||||
|
@ -42,7 +42,7 @@ namespace llvm {
|
||||
/// getIntrinsicID - Return the intrinsic ID of this intrinsic.
|
||||
///
|
||||
Intrinsic::ID getIntrinsicID() const {
|
||||
return (Intrinsic::ID)getCalledFunction()->getIntrinsicID();
|
||||
return getCalledFunction()->getIntrinsicID();
|
||||
}
|
||||
|
||||
// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
|
@ -775,7 +775,7 @@ BasicAliasAnalysis::getModRefBehavior(const Function *F) {
|
||||
return DoesNotAccessMemory;
|
||||
|
||||
// For intrinsics, we can check the table.
|
||||
if (unsigned iid = F->getIntrinsicID()) {
|
||||
if (Intrinsic::ID iid = F->getIntrinsicID()) {
|
||||
#define GET_INTRINSIC_MODREF_BEHAVIOR
|
||||
#include "llvm/IR/Intrinsics.gen"
|
||||
#undef GET_INTRINSIC_MODREF_BEHAVIOR
|
||||
|
@ -3587,9 +3587,9 @@ static Value *SimplifyCall(Value *V, IterTy ArgBegin, IterTy ArgEnd,
|
||||
if (!F)
|
||||
return nullptr;
|
||||
|
||||
if (unsigned IID = F->getIntrinsicID())
|
||||
if (Intrinsic::ID IID = F->getIntrinsicID())
|
||||
if (Value *Ret =
|
||||
SimplifyIntrinsic((Intrinsic::ID) IID, ArgBegin, ArgEnd, Q, MaxRecurse))
|
||||
SimplifyIntrinsic(IID, ArgBegin, ArgEnd, Q, MaxRecurse))
|
||||
return Ret;
|
||||
|
||||
if (!canConstantFoldCallTo(F))
|
||||
|
@ -142,7 +142,7 @@ static bool CouldBecomeSafePoint(Instruction *I) {
|
||||
// llvm.gcroot is safe because it doesn't do anything at runtime.
|
||||
if (CallInst *CI = dyn_cast<CallInst>(I))
|
||||
if (Function *F = CI->getCalledFunction())
|
||||
if (unsigned IID = F->getIntrinsicID())
|
||||
if (Intrinsic::ID IID = F->getIntrinsicID())
|
||||
if (IID == Intrinsic::gcroot)
|
||||
return false;
|
||||
|
||||
|
@ -5450,7 +5450,7 @@ void SelectionDAGBuilder::visitCall(const CallInst &I) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (unsigned IID = F->getIntrinsicID()) {
|
||||
if (Intrinsic::ID IID = F->getIntrinsicID()) {
|
||||
RenameFn = visitIntrinsicCall(I, IID);
|
||||
if (!RenameFn)
|
||||
return;
|
||||
|
@ -233,9 +233,8 @@ bool llvm::UpgradeIntrinsicFunction(Function *F, Function *&NewFn) {
|
||||
// Upgrade intrinsic attributes. This does not change the function.
|
||||
if (NewFn)
|
||||
F = NewFn;
|
||||
if (unsigned id = F->getIntrinsicID())
|
||||
F->setAttributes(Intrinsic::getAttributes(F->getContext(),
|
||||
(Intrinsic::ID)id));
|
||||
if (Intrinsic::ID id = F->getIntrinsicID())
|
||||
F->setAttributes(Intrinsic::getAttributes(F->getContext(), id));
|
||||
return Upgraded;
|
||||
}
|
||||
|
||||
|
@ -235,13 +235,13 @@ CallInst *IRBuilderBase::CreateMaskedStore(Value *Val, Value *Ptr,
|
||||
|
||||
/// Create a call to a Masked intrinsic, with given intrinsic Id,
|
||||
/// an array of operands - Ops, and one overloaded type - DataTy
|
||||
CallInst *IRBuilderBase::CreateMaskedIntrinsic(unsigned Id,
|
||||
CallInst *IRBuilderBase::CreateMaskedIntrinsic(Intrinsic::ID Id,
|
||||
ArrayRef<Value *> Ops,
|
||||
Type *DataTy,
|
||||
const Twine &Name) {
|
||||
Module *M = BB->getParent()->getParent();
|
||||
Type *OverloadedTypes[] = { DataTy };
|
||||
Value *TheFn = Intrinsic::getDeclaration(M, (Intrinsic::ID)Id, OverloadedTypes);
|
||||
Value *TheFn = Intrinsic::getDeclaration(M, Id, OverloadedTypes);
|
||||
return createCallHelper(TheFn, Ops, this, Name);
|
||||
}
|
||||
|
||||
|
@ -2390,7 +2390,7 @@ void Verifier::visitCallInst(CallInst &CI) {
|
||||
verifyMustTailCall(CI);
|
||||
|
||||
if (Function *F = CI.getCalledFunction())
|
||||
if (Intrinsic::ID ID = (Intrinsic::ID)F->getIntrinsicID())
|
||||
if (Intrinsic::ID ID = F->getIntrinsicID())
|
||||
visitIntrinsicFunctionCall(ID, CI);
|
||||
}
|
||||
|
||||
|
@ -3269,7 +3269,7 @@ bool AArch64FastISel::foldXALUIntrinsic(AArch64CC::CondCode &CC,
|
||||
std::swap(LHS, RHS);
|
||||
|
||||
// Simplify multiplies.
|
||||
unsigned IID = II->getIntrinsicID();
|
||||
Intrinsic::ID IID = II->getIntrinsicID();
|
||||
switch (IID) {
|
||||
default:
|
||||
break;
|
||||
@ -3537,7 +3537,7 @@ bool AArch64FastISel::fastLowerIntrinsicCall(const IntrinsicInst *II) {
|
||||
std::swap(LHS, RHS);
|
||||
|
||||
// Simplify multiplies.
|
||||
unsigned IID = II->getIntrinsicID();
|
||||
Intrinsic::ID IID = II->getIntrinsicID();
|
||||
switch (IID) {
|
||||
default:
|
||||
break;
|
||||
|
@ -239,7 +239,7 @@ ARCInstKind llvm::objcarc::GetARCInstKind(const Value *V) {
|
||||
ARCInstKind Class = GetFunctionClass(F);
|
||||
if (Class != ARCInstKind::CallOrUser)
|
||||
return Class;
|
||||
unsigned ID = F->getIntrinsicID();
|
||||
Intrinsic::ID ID = F->getIntrinsicID();
|
||||
if (isInertIntrinsic(ID))
|
||||
return ARCInstKind::None;
|
||||
if (isUseOnlyIntrinsic(ID))
|
||||
|
@ -973,7 +973,7 @@ Value *LibCallSimplifier::optimizeUnaryDoubleFP(CallInst *CI, IRBuilder<> &B,
|
||||
// floor((double)floatval) -> (double)floorf(floatval)
|
||||
if (Callee->isIntrinsic()) {
|
||||
Module *M = CI->getParent()->getParent()->getParent();
|
||||
Intrinsic::ID IID = (Intrinsic::ID) Callee->getIntrinsicID();
|
||||
Intrinsic::ID IID = Callee->getIntrinsicID();
|
||||
Function *F = Intrinsic::getDeclaration(M, IID, B.getFloatTy());
|
||||
V = B.CreateCall(F, V);
|
||||
} else {
|
||||
|
@ -662,7 +662,7 @@ namespace {
|
||||
Function *F = I->getCalledFunction();
|
||||
if (!F) return false;
|
||||
|
||||
Intrinsic::ID IID = (Intrinsic::ID) F->getIntrinsicID();
|
||||
Intrinsic::ID IID = F->getIntrinsicID();
|
||||
if (!IID) return false;
|
||||
|
||||
switch(IID) {
|
||||
@ -1098,7 +1098,7 @@ namespace {
|
||||
CallInst *CI = dyn_cast<CallInst>(I);
|
||||
Function *FI;
|
||||
if (CI && (FI = CI->getCalledFunction())) {
|
||||
Intrinsic::ID IID = (Intrinsic::ID) FI->getIntrinsicID();
|
||||
Intrinsic::ID IID = FI->getIntrinsicID();
|
||||
if (IID == Intrinsic::powi || IID == Intrinsic::ctlz ||
|
||||
IID == Intrinsic::cttz) {
|
||||
Value *A1I = CI->getArgOperand(1),
|
||||
@ -2770,7 +2770,7 @@ namespace {
|
||||
continue;
|
||||
} else if (isa<CallInst>(I)) {
|
||||
Function *F = cast<CallInst>(I)->getCalledFunction();
|
||||
Intrinsic::ID IID = (Intrinsic::ID) F->getIntrinsicID();
|
||||
Intrinsic::ID IID = F->getIntrinsicID();
|
||||
if (o == NumOperands-1) {
|
||||
BasicBlock &BB = *I->getParent();
|
||||
|
||||
|
@ -2382,7 +2382,7 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E) {
|
||||
Intrinsic::ID IID = Intrinsic::not_intrinsic;
|
||||
Value *ScalarArg = nullptr;
|
||||
if (CI && (FI = CI->getCalledFunction())) {
|
||||
IID = (Intrinsic::ID) FI->getIntrinsicID();
|
||||
IID = FI->getIntrinsicID();
|
||||
}
|
||||
std::vector<Value *> OpVecs;
|
||||
for (int j = 0, e = CI->getNumArgOperands(); j < e; ++j) {
|
||||
|
Loading…
Reference in New Issue
Block a user