Revert "[opaque pointer types] Add a FunctionCallee wrapper type, and use it."

This reverts commit f47d6b38c7a61d50db4566b02719de05492dcef1 (r352791).

Seems to run into compilation failures with GCC (but not clang, where
I tested it). Reverting while I investigate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352800 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
James Y Knight
2019-01-31 21:51:58 +00:00
parent e0c702bbe8
commit 5be828a949
69 changed files with 891 additions and 858 deletions
+7 -6
View File
@@ -140,8 +140,8 @@ void Module::getOperandBundleTags(SmallVectorImpl<StringRef> &Result) const {
// it. This is nice because it allows most passes to get away with not handling
// the symbol table directly for this common task.
//
FunctionCallee Module::getOrInsertFunction(StringRef Name, FunctionType *Ty,
AttributeList AttributeList) {
Constant *Module::getOrInsertFunction(StringRef Name, FunctionType *Ty,
AttributeList AttributeList) {
// See if we have a definition for the specified function already.
GlobalValue *F = getNamedValue(Name);
if (!F) {
@@ -151,20 +151,21 @@ FunctionCallee Module::getOrInsertFunction(StringRef Name, FunctionType *Ty,
if (!New->isIntrinsic()) // Intrinsics get attrs set on construction
New->setAttributes(AttributeList);
FunctionList.push_back(New);
return {Ty, New}; // Return the new prototype.
return New; // Return the new prototype.
}
// If the function exists but has the wrong type, return a bitcast to the
// right type.
auto *PTy = PointerType::get(Ty, F->getAddressSpace());
if (F->getType() != PTy)
return {Ty, ConstantExpr::getBitCast(F, PTy)};
return ConstantExpr::getBitCast(F, PTy);
// Otherwise, we just found the existing function or a prototype.
return {Ty, F};
return F;
}
FunctionCallee Module::getOrInsertFunction(StringRef Name, FunctionType *Ty) {
Constant *Module::getOrInsertFunction(StringRef Name,
FunctionType *Ty) {
return getOrInsertFunction(Name, Ty, AttributeList());
}