diff options
author | Matthew Simpson <mssimpso@codeaurora.org> | 2017-10-16 22:22:11 +0000 |
---|---|---|
committer | Matthew Simpson <mssimpso@codeaurora.org> | 2017-10-16 22:22:11 +0000 |
commit | 9f219e8d892284417fa5c1f64b69a36b8602a06f (patch) | |
tree | 55dee695af90cf26054703d47325291b2f31d035 /lib/IR/MDBuilder.cpp | |
parent | 983f9af008ef293025c0e0198f0726ee64ffc793 (diff) |
Add !callees metadata
This patch adds a new kind of metadata that indicates the possible callees of
indirect calls.
Differential Revision: https://reviews.llvm.org/D37354
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315944 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR/MDBuilder.cpp')
-rw-r--r-- | lib/IR/MDBuilder.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/IR/MDBuilder.cpp b/lib/IR/MDBuilder.cpp index 84bad318591..54783e884e9 100644 --- a/lib/IR/MDBuilder.cpp +++ b/lib/IR/MDBuilder.cpp @@ -14,6 +14,7 @@ #include "llvm/IR/MDBuilder.h" #include "llvm/IR/Constants.h" +#include "llvm/IR/Function.h" #include "llvm/IR/Metadata.h" using namespace llvm; @@ -95,6 +96,13 @@ MDNode *MDBuilder::createRange(Constant *Lo, Constant *Hi) { return MDNode::get(Context, {createConstant(Lo), createConstant(Hi)}); } +MDNode *MDBuilder::createCallees(ArrayRef<Function *> Callees) { + SmallVector<Metadata *, 4> Ops; + for (Function *F : Callees) + Ops.push_back(createConstant(F)); + return MDNode::get(Context, Ops); +} + MDNode *MDBuilder::createAnonymousAARoot(StringRef Name, MDNode *Extra) { // To ensure uniqueness the root node is self-referential. auto Dummy = MDNode::getTemporary(Context, None); |