[PATCH] D74676: OpaquePtr: IRBuilder: Add deprecated attribute on CreateCall methods
Nicolai Hähnle via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 15 12:54:53 PST 2020
nhaehnle created this revision.
nhaehnle added a reviewer: t.p.northover.
Herald added a project: LLVM.
nhaehnle added a parent revision: D74675: LowerMatrixIntrinsics: Avoid use of deprecated CreateCall methods.
nhaehnle added parent revisions: D74674: Coroutines: avoid use of deprecated CreateLoad and CreateCall methods, D74673: CGBuiltin: Remove uses of deprecated CreateCall overloads.
Let's not remove them outright just yet, so that other projects get some
more explicit notice that they need to fix their code.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D74676
Files:
llvm/include/llvm/IR/IRBuilder.h
Index: llvm/include/llvm/IR/IRBuilder.h
===================================================================
--- llvm/include/llvm/IR/IRBuilder.h
+++ llvm/include/llvm/IR/IRBuilder.h
@@ -2549,23 +2549,42 @@
OpBundles, Name, FPMathTag);
}
- // Deprecated [opaque pointer types]
- CallInst *CreateCall(Value *Callee, ArrayRef<Value *> Args = None,
+ // Ordinarily, the FunctionCallee overloads above should be sufficient.
+ // These Function * and InlineAsm * overloads are required to hide the
+ // deprecated Value * overloads below.
+ CallInst *CreateCall(Function *Fn, ArrayRef<Value *> Args = None,
const Twine &Name = "", MDNode *FPMathTag = nullptr) {
- return CreateCall(
- cast<FunctionType>(Callee->getType()->getPointerElementType()), Callee,
- Args, Name, FPMathTag);
+ return CreateCall(FunctionCallee{Fn}, Args, Name, FPMathTag);
}
- // Deprecated [opaque pointer types]
- CallInst *CreateCall(Value *Callee, ArrayRef<Value *> Args,
+ CallInst *CreateCall(Function *Fn, ArrayRef<Value *> Args,
ArrayRef<OperandBundleDef> OpBundles,
const Twine &Name = "", MDNode *FPMathTag = nullptr) {
- return CreateCall(
- cast<FunctionType>(Callee->getType()->getPointerElementType()), Callee,
- Args, OpBundles, Name, FPMathTag);
+ return CreateCall(FunctionCallee{Fn}, Args, OpBundles, Name, FPMathTag);
+ }
+
+ CallInst *CreateCall(InlineAsm *Fn, ArrayRef<Value *> Args = None,
+ const Twine &Name = "", MDNode *FPMathTag = nullptr) {
+ return CreateCall(FunctionCallee{Fn}, Args, Name, FPMathTag);
}
+ CallInst *CreateCall(InlineAsm *Fn, ArrayRef<Value *> Args,
+ ArrayRef<OperandBundleDef> OpBundles,
+ const Twine &Name = "", MDNode *FPMathTag = nullptr) {
+ return CreateCall(FunctionCallee{Fn}, Args, OpBundles, Name, FPMathTag);
+ }
+
+ // Deprecated [opaque pointer types]
+ LLVM_ATTRIBUTE_DEPRECATED(
+ CallInst *CreateCall(Value *Callee, ArrayRef<Value *> Args = None,
+ const Twine &Name = "", MDNode *FPMathTag = nullptr),
+ "Pointer types are opaque");
+ LLVM_ATTRIBUTE_DEPRECATED(
+ CallInst *CreateCall(Value *Callee, ArrayRef<Value *> Args,
+ ArrayRef<OperandBundleDef> OpBundles,
+ const Twine &Name = "", MDNode *FPMathTag = nullptr),
+ "Pointer types are opaque");
+
CallInst *CreateConstrainedFPCall(
Function *Callee, ArrayRef<Value *> Args, const Twine &Name = "",
Optional<fp::RoundingMode> Rounding = None,
@@ -2976,6 +2995,28 @@
}
};
+// Deprecated [opaque pointer types]
+template <typename T, typename Inserter>
+CallInst *IRBuilder<T, Inserter>::CreateCall(Value *Callee,
+ ArrayRef<Value *> Args,
+ const Twine &Name,
+ MDNode *FPMathTag) {
+ return CreateCall(
+ cast<FunctionType>(Callee->getType()->getPointerElementType()),
+ Callee, Args, Name, FPMathTag);
+}
+
+// Deprecated [opaque pointer types]
+template <typename T, typename Inserter>
+CallInst *
+IRBuilder<T, Inserter>::CreateCall(Value *Callee, ArrayRef<Value *> Args,
+ ArrayRef<OperandBundleDef> OpBundles,
+ const Twine &Name, MDNode *FPMathTag) {
+ return CreateCall(
+ cast<FunctionType>(Callee->getType()->getPointerElementType()),
+ Callee, Args, OpBundles, Name, FPMathTag);
+}
+
// Create wrappers for C Binding types (see CBindingWrapping.h).
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(IRBuilder<>, LLVMBuilderRef)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74676.244838.patch
Type: text/x-patch
Size: 3797 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200215/9f0ae41f/attachment.bin>
More information about the llvm-commits
mailing list