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