本文整理汇总了C++中FunctionType::getNumParams方法的典型用法代码示例。如果您正苦于以下问题:C++ FunctionType::getNumParams方法的具体用法?C++ FunctionType::getNumParams怎么用?C++ FunctionType::getNumParams使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FunctionType
的用法示例。
在下文中一共展示了FunctionType::getNumParams方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getNameWithPrefix
void Mangler::getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV,
bool CannotUsePrivateLabel) const {
ManglerPrefixTy PrefixTy = Default;
if (GV->hasPrivateLinkage()) {
if (CannotUsePrivateLabel)
PrefixTy = LinkerPrivate;
else
PrefixTy = Private;
}
const DataLayout &DL = GV->getParent()->getDataLayout();
if (!GV->hasName()) {
// Get the ID for the global, assigning a new one if we haven't got one
// already.
unsigned &ID = AnonGlobalIDs[GV];
if (ID == 0)
ID = AnonGlobalIDs.size();
// Must mangle the global into a unique ID.
getNameWithPrefixImpl(OS, "__unnamed_" + Twine(ID), DL, PrefixTy);
return;
}
StringRef Name = GV->getName();
char Prefix = DL.getGlobalPrefix();
// Mangle functions with Microsoft calling conventions specially. Only do
// this mangling for x86_64 vectorcall and 32-bit x86.
const Function *MSFunc = dyn_cast<Function>(GV);
if (Name.startswith("\01"))
MSFunc = nullptr; // Don't mangle when \01 is present.
CallingConv::ID CC =
MSFunc ? MSFunc->getCallingConv() : (unsigned)CallingConv::C;
if (!DL.hasMicrosoftFastStdCallMangling() &&
CC != CallingConv::X86_VectorCall)
MSFunc = nullptr;
if (MSFunc) {
if (CC == CallingConv::X86_FastCall)
Prefix = '@'; // fastcall functions have an @ prefix instead of _.
else if (CC == CallingConv::X86_VectorCall)
Prefix = '\0'; // vectorcall functions have no prefix.
}
getNameWithPrefixImpl(OS, Name, PrefixTy, DL, Prefix);
if (!MSFunc)
return;
// If we are supposed to add a microsoft-style suffix for stdcall, fastcall,
// or vectorcall, add it. These functions have a suffix of @N where N is the
// cumulative byte size of all of the parameters to the function in decimal.
if (CC == CallingConv::X86_VectorCall)
OS << '@'; // vectorcall functions use a double @ suffix.
FunctionType *FT = MSFunc->getFunctionType();
if (hasByteCountSuffix(CC) &&
// "Pure" variadic functions do not receive @0 suffix.
(!FT->isVarArg() || FT->getNumParams() == 0 ||
(FT->getNumParams() == 1 && MSFunc->hasStructRetAttr())))
addByteCountSuffix(OS, MSFunc, DL);
}
示例2: getNameWithPrefix
void Mangler::getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV,
bool CannotUsePrivateLabel) const {
ManglerPrefixTy PrefixTy = Mangler::Default;
if (GV->hasPrivateLinkage()) {
if (CannotUsePrivateLabel)
PrefixTy = Mangler::LinkerPrivate;
else
PrefixTy = Mangler::Private;
}
if (!GV->hasName()) {
// Get the ID for the global, assigning a new one if we haven't got one
// already.
unsigned &ID = AnonGlobalIDs[GV];
if (ID == 0)
ID = NextAnonGlobalID++;
// Must mangle the global into a unique ID.
getNameWithPrefix(OS, "__unnamed_" + Twine(ID), PrefixTy);
return;
}
StringRef Name = GV->getName();
// No need to do anything special if the global has the special "do not
// mangle" flag in the name.
if (Name[0] == '\1') {
OS << Name.substr(1);
return;
}
bool UseAt = false;
const Function *MSFunc = nullptr;
CallingConv::ID CC;
if (DL->hasMicrosoftFastStdCallMangling()) {
if ((MSFunc = dyn_cast<Function>(GV))) {
CC = MSFunc->getCallingConv();
// fastcall functions need to start with @ instead of _.
if (CC == CallingConv::X86_FastCall)
UseAt = true;
}
}
getNameWithPrefixx(OS, Name, PrefixTy, *DL, UseAt);
if (!MSFunc)
return;
// If we are supposed to add a microsoft-style suffix for stdcall/fastcall,
// add it.
// fastcall and stdcall functions usually need @42 at the end to specify
// the argument info.
FunctionType *FT = MSFunc->getFunctionType();
if ((CC == CallingConv::X86_FastCall || CC == CallingConv::X86_StdCall) &&
// "Pure" variadic functions do not receive @0 suffix.
(!FT->isVarArg() || FT->getNumParams() == 0 ||
(FT->getNumParams() == 1 && MSFunc->hasStructRetAttr())))
AddFastCallStdCallSuffix(OS, MSFunc, *DL);
}
示例3: getNameWithPrefix
/// getNameWithPrefix - Fill OutName with the name of the appropriate prefix
/// and the specified global variable's name. If the global variable doesn't
/// have a name, this fills in a unique name for the global.
void Mangler::getNameWithPrefix(SmallVectorImpl<char> &OutName,
const GlobalValue *GV) {
ManglerPrefixTy PrefixTy = Mangler::Default;
if (GV->hasPrivateLinkage())
PrefixTy = Mangler::Private;
else if (GV->hasLinkerPrivateLinkage() || GV->hasLinkerPrivateWeakLinkage())
PrefixTy = Mangler::LinkerPrivate;
// If this global has a name, handle it simply.
if (GV->hasName()) {
StringRef Name = GV->getName();
getNameWithPrefix(OutName, Name, PrefixTy);
// No need to do anything else if the global has the special "do not mangle"
// flag in the name.
if (Name[0] == 1)
return;
} else {
// Get the ID for the global, assigning a new one if we haven't got one
// already.
unsigned &ID = AnonGlobalIDs[GV];
if (ID == 0) ID = NextAnonGlobalID++;
// Must mangle the global into a unique ID.
getNameWithPrefix(OutName, "__unnamed_" + Twine(ID), PrefixTy);
}
// If we are supposed to add a microsoft-style suffix for stdcall/fastcall,
// add it.
if (DL->hasMicrosoftFastStdCallMangling()) {
if (const Function *F = dyn_cast<Function>(GV)) {
CallingConv::ID CC = F->getCallingConv();
// fastcall functions need to start with @.
// FIXME: This logic seems unlikely to be right.
if (CC == CallingConv::X86_FastCall) {
if (OutName[0] == '_')
OutName[0] = '@';
else
OutName.insert(OutName.begin(), '@');
}
// fastcall and stdcall functions usually need @42 at the end to specify
// the argument info.
FunctionType *FT = F->getFunctionType();
if ((CC == CallingConv::X86_FastCall || CC == CallingConv::X86_StdCall) &&
// "Pure" variadic functions do not receive @0 suffix.
(!FT->isVarArg() || FT->getNumParams() == 0 ||
(FT->getNumParams() == 1 && F->hasStructRetAttr())))
AddFastCallStdCallSuffix(OutName, F, *DL);
}
}
}
示例4: isFreeCall
/// isFreeCall - Returns non-null if the value is a call to the builtin free()
static const CallInst* isFreeCall(const Value* I) {
const CallInst* CI = dyn_cast<CallInst>(I);
if (!CI)
return 0;
Function* Callee = CI->getCalledFunction();
if (Callee == 0 || !Callee->isDeclaration())
return 0;
if (Callee->getName() != "free" /*&&
Callee->getName() != "my_free" &&
Callee->getName() != "_ZdlPv" && // operator delete(void*)
Callee->getName() != "_ZdaPv"*/) // operator delete[](void*)
return 0;
// Check free prototype.
// FIXME: workaround for PR5130, this will be obsolete when a nobuiltin
// attribute will exist.
FunctionType* FTy = Callee->getFunctionType();
if (!FTy->getReturnType()->isVoidTy())
return 0;
if (FTy->getNumParams() != 1)
return 0;
if (FTy->getParamType(0) != Type::getInt8PtrTy(Callee->getContext()))
return 0;
return CI;
}
示例5: delete
/// isFreeCall - Returns non-null if the value is a call to the builtin free()
const CallInst *llvm::isFreeCall(const Value *I, const TargetLibraryInfo *TLI) {
const CallInst *CI = dyn_cast<CallInst>(I);
if (!CI || isa<IntrinsicInst>(CI))
return 0;
Function *Callee = CI->getCalledFunction();
if (Callee == 0 || !Callee->isDeclaration())
return 0;
StringRef FnName = Callee->getName();
LibFunc::Func TLIFn;
if (!TLI || !TLI->getLibFunc(FnName, TLIFn) || !TLI->has(TLIFn))
return 0;
if (TLIFn != LibFunc::free &&
TLIFn != LibFunc::ZdlPv && // operator delete(void*)
TLIFn != LibFunc::ZdaPv) // operator delete[](void*)
return 0;
// Check free prototype.
// FIXME: workaround for PR5130, this will be obsolete when a nobuiltin
// attribute will exist.
FunctionType *FTy = Callee->getFunctionType();
if (!FTy->getReturnType()->isVoidTy())
return 0;
if (FTy->getNumParams() != 1)
return 0;
if (FTy->getParamType(0) != Type::getInt8PtrTy(Callee->getContext()))
return 0;
return CI;
}
示例6: RemoveNonLocalTypes
void TypeDuplicater::RemoveNonLocalTypes(Module &M){
std::set<Function *> UndefinedFunctions;
for(auto IF = M.begin(), EF = M.end(); IF != EF; ++IF){
Function *F = &*IF;
if(F->isDeclaration())
UndefinedFunctions.insert(F);
}
for(auto F: UndefinedFunctions){
FunctionType *FuncType = cast<FunctionType>(F->getFunctionType());
for(int i=0; i<FuncType->getNumParams(); i++){
Type *T =FuncType->getParamType(i);
while(T->isPointerTy())
T = T->getPointerElementType();
if(auto *ST = dyn_cast<StructType>(T))
RawStructs.erase(ST);
}
Type *T =FuncType->getReturnType();
while(T->isPointerTy())
T = T->getPointerElementType();
if(auto *ST = dyn_cast<StructType>(T))
RawStructs.erase(ST);
}
}
示例7: remapInstruction
void Mapper::remapInstruction(Instruction *I) {
// Remap operands.
for (Use &Op : I->operands()) {
Value *V = mapValue(Op);
// If we aren't ignoring missing entries, assert that something happened.
if (V)
Op = V;
else
assert((Flags & RF_IgnoreMissingLocals) &&
"Referenced value not in value map!");
}
// Remap phi nodes' incoming blocks.
if (PHINode *PN = dyn_cast<PHINode>(I)) {
for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) {
Value *V = mapValue(PN->getIncomingBlock(i));
// If we aren't ignoring missing entries, assert that something happened.
if (V)
PN->setIncomingBlock(i, cast<BasicBlock>(V));
else
assert((Flags & RF_IgnoreMissingLocals) &&
"Referenced block not in value map!");
}
}
// Remap attached metadata.
SmallVector<std::pair<unsigned, MDNode *>, 4> MDs;
I->getAllMetadata(MDs);
for (const auto &MI : MDs) {
MDNode *Old = MI.second;
MDNode *New = cast_or_null<MDNode>(mapMetadata(Old));
if (New != Old)
I->setMetadata(MI.first, New);
}
if (!TypeMapper)
return;
// If the instruction's type is being remapped, do so now.
if (auto CS = CallSite(I)) {
SmallVector<Type *, 3> Tys;
FunctionType *FTy = CS.getFunctionType();
Tys.reserve(FTy->getNumParams());
for (Type *Ty : FTy->params())
Tys.push_back(TypeMapper->remapType(Ty));
CS.mutateFunctionType(FunctionType::get(
TypeMapper->remapType(I->getType()), Tys, FTy->isVarArg()));
return;
}
if (auto *AI = dyn_cast<AllocaInst>(I))
AI->setAllocatedType(TypeMapper->remapType(AI->getAllocatedType()));
if (auto *GEP = dyn_cast<GetElementPtrInst>(I)) {
GEP->setSourceElementType(
TypeMapper->remapType(GEP->getSourceElementType()));
GEP->setResultElementType(
TypeMapper->remapType(GEP->getResultElementType()));
}
I->mutateType(TypeMapper->remapType(I->getType()));
}
示例8: if
/// isFreeCall - Returns non-null if the value is a call to the builtin free()
const CallInst *llvm::isFreeCall(const Value *I, const TargetLibraryInfo *TLI) {
bool IsNoBuiltinCall;
const Function *Callee =
getCalledFunction(I, /*LookThroughBitCast=*/false, IsNoBuiltinCall);
if (Callee == nullptr || IsNoBuiltinCall)
return nullptr;
StringRef FnName = Callee->getName();
LibFunc TLIFn;
if (!TLI || !TLI->getLibFunc(FnName, TLIFn) || !TLI->has(TLIFn))
return nullptr;
unsigned ExpectedNumParams;
if (TLIFn == LibFunc_free ||
TLIFn == LibFunc_ZdlPv || // operator delete(void*)
TLIFn == LibFunc_ZdaPv || // operator delete[](void*)
TLIFn == LibFunc_msvc_delete_ptr32 || // operator delete(void*)
TLIFn == LibFunc_msvc_delete_ptr64 || // operator delete(void*)
TLIFn == LibFunc_msvc_delete_array_ptr32 || // operator delete[](void*)
TLIFn == LibFunc_msvc_delete_array_ptr64) // operator delete[](void*)
ExpectedNumParams = 1;
else if (TLIFn == LibFunc_ZdlPvj || // delete(void*, uint)
TLIFn == LibFunc_ZdlPvm || // delete(void*, ulong)
TLIFn == LibFunc_ZdlPvRKSt9nothrow_t || // delete(void*, nothrow)
TLIFn == LibFunc_ZdlPvSt11align_val_t || // delete(void*, align_val_t)
TLIFn == LibFunc_ZdaPvj || // delete[](void*, uint)
TLIFn == LibFunc_ZdaPvm || // delete[](void*, ulong)
TLIFn == LibFunc_ZdaPvRKSt9nothrow_t || // delete[](void*, nothrow)
TLIFn == LibFunc_ZdaPvSt11align_val_t || // delete[](void*, align_val_t)
TLIFn == LibFunc_msvc_delete_ptr32_int || // delete(void*, uint)
TLIFn == LibFunc_msvc_delete_ptr64_longlong || // delete(void*, ulonglong)
TLIFn == LibFunc_msvc_delete_ptr32_nothrow || // delete(void*, nothrow)
TLIFn == LibFunc_msvc_delete_ptr64_nothrow || // delete(void*, nothrow)
TLIFn == LibFunc_msvc_delete_array_ptr32_int || // delete[](void*, uint)
TLIFn == LibFunc_msvc_delete_array_ptr64_longlong || // delete[](void*, ulonglong)
TLIFn == LibFunc_msvc_delete_array_ptr32_nothrow || // delete[](void*, nothrow)
TLIFn == LibFunc_msvc_delete_array_ptr64_nothrow) // delete[](void*, nothrow)
ExpectedNumParams = 2;
else if (TLIFn == LibFunc_ZdaPvSt11align_val_tRKSt9nothrow_t || // delete(void*, align_val_t, nothrow)
TLIFn == LibFunc_ZdlPvSt11align_val_tRKSt9nothrow_t) // delete[](void*, align_val_t, nothrow)
ExpectedNumParams = 3;
else
return nullptr;
// Check free prototype.
// FIXME: workaround for PR5130, this will be obsolete when a nobuiltin
// attribute will exist.
FunctionType *FTy = Callee->getFunctionType();
if (!FTy->getReturnType()->isVoidTy())
return nullptr;
if (FTy->getNumParams() != ExpectedNumParams)
return nullptr;
if (FTy->getParamType(0) != Type::getInt8PtrTy(Callee->getContext()))
return nullptr;
return dyn_cast<CallInst>(I);
}
示例9: RemapInstruction
/// RemapInstruction - Convert the instruction operands from referencing the
/// current values into those specified by VMap.
///
void llvm::RemapInstruction(Instruction *I, ValueToValueMapTy &VMap,
RemapFlags Flags, ValueMapTypeRemapper *TypeMapper,
ValueMaterializer *Materializer){
// Remap operands.
for (User::op_iterator op = I->op_begin(), E = I->op_end(); op != E; ++op) {
Value *V = MapValue(*op, VMap, Flags, TypeMapper, Materializer);
// If we aren't ignoring missing entries, assert that something happened.
if (V)
*op = V;
else
assert((Flags & RF_IgnoreMissingEntries) &&
"Referenced value not in value map!");
}
// Remap phi nodes' incoming blocks.
if (PHINode *PN = dyn_cast<PHINode>(I)) {
for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) {
Value *V = MapValue(PN->getIncomingBlock(i), VMap, Flags);
// If we aren't ignoring missing entries, assert that something happened.
if (V)
PN->setIncomingBlock(i, cast<BasicBlock>(V));
else
assert((Flags & RF_IgnoreMissingEntries) &&
"Referenced block not in value map!");
}
}
// Remap attached metadata.
SmallVector<std::pair<unsigned, MDNode *>, 4> MDs;
I->getAllMetadata(MDs);
for (SmallVectorImpl<std::pair<unsigned, MDNode *>>::iterator
MI = MDs.begin(),
ME = MDs.end();
MI != ME; ++MI) {
MDNode *Old = MI->second;
MDNode *New = MapMetadata(Old, VMap, Flags, TypeMapper, Materializer);
if (New != Old)
I->setMetadata(MI->first, New);
}
if (!TypeMapper)
return;
// If the instruction's type is being remapped, do so now.
if (auto CS = CallSite(I)) {
SmallVector<Type *, 3> Tys;
FunctionType *FTy = CS.getFunctionType();
Tys.reserve(FTy->getNumParams());
for (Type *Ty : FTy->params())
Tys.push_back(TypeMapper->remapType(Ty));
CS.mutateFunctionType(FunctionType::get(
TypeMapper->remapType(I->getType()), Tys, FTy->isVarArg()));
} else
I->mutateType(TypeMapper->remapType(I->getType()));
}
示例10: isWhitelistedBswap
// We accept bswap for a limited set of types (i16, i32, i64).
// The various backends are able to generate instructions to
// implement the intrinsic. Also, i16 and i64 are easy to
// implement as along as there is a way to do i32.
static bool isWhitelistedBswap(const Function *F) {
FunctionType *FT = F->getFunctionType();
if (FT->getNumParams() != 1)
return false;
Type *ParamType = FT->getParamType(0);
LLVMContext &C = F->getContext();
Type *AcceptableTypes[] = { Type::getInt16Ty(C),
Type::getInt32Ty(C),
Type::getInt64Ty(C) };
return TypeAcceptable(ParamType, AcceptableTypes);
}
示例11: if
/// isFreeCall - Returns non-null if the value is a call to the builtin free()
const CallInst *llvm::isFreeCall(const Value *I, const TargetLibraryInfo *TLI) {
const CallInst *CI = dyn_cast<CallInst>(I);
if (!CI || isa<IntrinsicInst>(CI))
return nullptr;
Function *Callee = CI->getCalledFunction();
if (Callee == nullptr)
return nullptr;
StringRef FnName = Callee->getName();
LibFunc::Func TLIFn;
if (!TLI || !TLI->getLibFunc(FnName, TLIFn) || !TLI->has(TLIFn))
return nullptr;
unsigned ExpectedNumParams;
if (TLIFn == LibFunc::free ||
TLIFn == LibFunc::ZdlPv || // operator delete(void*)
TLIFn == LibFunc::ZdaPv || // operator delete[](void*)
TLIFn == LibFunc::msvc_delete_ptr32 || // operator delete(void*)
TLIFn == LibFunc::msvc_delete_ptr64 || // operator delete(void*)
TLIFn == LibFunc::msvc_delete_array_ptr32 || // operator delete[](void*)
TLIFn == LibFunc::msvc_delete_array_ptr64) // operator delete[](void*)
ExpectedNumParams = 1;
else if (TLIFn == LibFunc::ZdlPvj || // delete(void*, uint)
TLIFn == LibFunc::ZdlPvm || // delete(void*, ulong)
TLIFn == LibFunc::ZdlPvRKSt9nothrow_t || // delete(void*, nothrow)
TLIFn == LibFunc::ZdaPvj || // delete[](void*, uint)
TLIFn == LibFunc::ZdaPvm || // delete[](void*, ulong)
TLIFn == LibFunc::ZdaPvRKSt9nothrow_t || // delete[](void*, nothrow)
TLIFn == LibFunc::msvc_delete_ptr32_int || // delete(void*, uint)
TLIFn == LibFunc::msvc_delete_ptr64_longlong || // delete(void*, ulonglong)
TLIFn == LibFunc::msvc_delete_ptr32_nothrow || // delete(void*, nothrow)
TLIFn == LibFunc::msvc_delete_ptr64_nothrow || // delete(void*, nothrow)
TLIFn == LibFunc::msvc_delete_array_ptr32_int || // delete[](void*, uint)
TLIFn == LibFunc::msvc_delete_array_ptr64_longlong || // delete[](void*, ulonglong)
TLIFn == LibFunc::msvc_delete_array_ptr32_nothrow || // delete[](void*, nothrow)
TLIFn == LibFunc::msvc_delete_array_ptr64_nothrow) // delete[](void*, nothrow)
ExpectedNumParams = 2;
else
return nullptr;
// Check free prototype.
// FIXME: workaround for PR5130, this will be obsolete when a nobuiltin
// attribute will exist.
FunctionType *FTy = Callee->getFunctionType();
if (!FTy->getReturnType()->isVoidTy())
return nullptr;
if (FTy->getNumParams() != ExpectedNumParams)
return nullptr;
if (FTy->getParamType(0) != Type::getInt8PtrTy(Callee->getContext()))
return nullptr;
return CI;
}
示例12: check
static void check(Value *Func, ArrayRef<Value *> Args) {
FunctionType *FTy =
cast<FunctionType>(cast<PointerType>(Func->getType())->getElementType());
assert((Args.size() == FTy->getNumParams() ||
(FTy->isVarArg() && Args.size() > FTy->getNumParams())) &&
"XXCalling a function with bad signature!");
for (unsigned i = 0; i != Args.size(); ++i) {
if (!(FTy->getParamType(i) == Args[i]->getType())) {
errs() << "types:\n ";
FTy->getParamType(i)->dump();
errs() << "\n ";
Args[i]->getType()->dump();
errs() << "\n";
}
assert((i >= FTy->getNumParams() ||
FTy->getParamType(i) == Args[i]->getType()) &&
"YYCalling a function with a bad signature!");
}
}
示例13: getCalledFunction
/// \brief Returns the allocation data for the given value if it is a call to a
/// known allocation function, and NULL otherwise.
static const AllocFnsTy *getAllocationData(const Value *V, AllocType AllocTy,
const TargetLibraryInfo *TLI,
bool LookThroughBitCast = false) {
// Skip all intrinsics but duetto.allocate
if (const IntrinsicInst* II = dyn_cast<IntrinsicInst>(V))
{
if (II->getIntrinsicID() == Intrinsic::duetto_allocate)
return &AllocationFnData[0];
return 0;
}
Function *Callee = getCalledFunction(V, LookThroughBitCast);
if (!Callee)
return 0;
// Make sure that the function is available.
StringRef FnName = Callee->getName();
LibFunc::Func TLIFn;
if (!TLI || !TLI->getLibFunc(FnName, TLIFn) || !TLI->has(TLIFn))
return 0;
unsigned i = 0;
bool found = false;
for ( ; i < array_lengthof(AllocationFnData); ++i) {
if (AllocationFnData[i].Func == TLIFn) {
found = true;
break;
}
}
if (!found)
return 0;
const AllocFnsTy *FnData = &AllocationFnData[i];
if ((FnData->AllocTy & AllocTy) != FnData->AllocTy)
return 0;
// Check function prototype.
int FstParam = FnData->FstParam;
int SndParam = FnData->SndParam;
FunctionType *FTy = Callee->getFunctionType();
if (FTy->getReturnType() == Type::getInt8PtrTy(FTy->getContext()) &&
FTy->getNumParams() == FnData->NumParams &&
(FstParam < 0 ||
(FTy->getParamType(FstParam)->isIntegerTy(32) ||
FTy->getParamType(FstParam)->isIntegerTy(64))) &&
(SndParam < 0 ||
FTy->getParamType(SndParam)->isIntegerTy(32) ||
FTy->getParamType(SndParam)->isIntegerTy(64)))
return FnData;
return 0;
}
示例14: profileFunction
/// Creates a hash-code for the function which is the same for any two
/// functions that will compare equal, without looking at the instructions
/// inside the function.
static unsigned profileFunction(const Function *F) {
FunctionType *FTy = F->getFunctionType();
FoldingSetNodeID ID;
ID.AddInteger(F->size());
ID.AddInteger(F->getCallingConv());
ID.AddBoolean(F->hasGC());
ID.AddBoolean(FTy->isVarArg());
ID.AddInteger(getTypeIDForHash(FTy->getReturnType()));
for (unsigned i = 0, e = FTy->getNumParams(); i != e; ++i)
ID.AddInteger(getTypeIDForHash(FTy->getParamType(i)));
return ID.ComputeHash();
}
示例15: BuildLazyArguments
void Function::BuildLazyArguments() const {
// Create the arguments vector, all arguments start out unnamed.
FunctionType *FT = getFunctionType();
for (unsigned i = 0, e = FT->getNumParams(); i != e; ++i) {
assert(!FT->getParamType(i)->isVoidTy() &&
"Cannot have void typed arguments!");
ArgumentList.push_back(new Argument(FT->getParamType(i)));
}
// Clear the lazy arguments bit.
unsigned SDC = getSubclassDataFromValue();
const_cast<Function*>(this)->setValueSubclassData(SDC &= ~1);
}