diff options
author | Philip Reames <listmail@philipreames.com> | 2014-10-21 00:13:20 +0000 |
---|---|---|
committer | Philip Reames <listmail@philipreames.com> | 2014-10-21 00:13:20 +0000 |
commit | 5a3f5f751bdca3483e1edb0d3ac025a466c1ec2d (patch) | |
tree | dcbbec576b30401977a2b90e0be7ab28413101c0 /llvm/lib/Analysis | |
parent | 3eb69f5482199fe33c2963af380845238656c846 (diff) | |
download | bcm5719-llvm-5a3f5f751bdca3483e1edb0d3ac025a466c1ec2d.tar.gz bcm5719-llvm-5a3f5f751bdca3483e1edb0d3ac025a466c1ec2d.zip |
Introduce enum values for previously defined metadata types. (NFC)
Our metadata scheme lazily assigns IDs to string metadata, but we have a mechanism to preassign them as well. Using a preassigned ID is helpful since we get compile time type checking, and avoid some (minimal) string construction and comparison. This change adds enum value for three existing metadata types:
+ MD_nontemporal = 9, // "nontemporal"
+ MD_mem_parallel_loop_access = 10, // "llvm.mem.parallel_loop_access"
+ MD_nonnull = 11 // "nonnull"
I went through an updated various uses as well. I made no attempt to get all uses; I focused on the ones which were easily grepable and easily to translate. For example, there were several items in LoopInfo.cpp I chose not to update.
llvm-svn: 220248
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r-- | llvm/lib/Analysis/LoopInfo.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/LoopInfo.cpp b/llvm/lib/Analysis/LoopInfo.cpp index 46c0eaabe1a..2e0fdeca948 100644 --- a/llvm/lib/Analysis/LoopInfo.cpp +++ b/llvm/lib/Analysis/LoopInfo.cpp @@ -24,6 +24,7 @@ #include "llvm/IR/Constants.h" #include "llvm/IR/Dominators.h" #include "llvm/IR/Instructions.h" +#include "llvm/IR/LLVMContext.h" #include "llvm/IR/Metadata.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" @@ -307,7 +308,8 @@ bool Loop::isAnnotatedParallel() const { // directly or indirectly through another list metadata (in case of // nested parallel loops). The loop identifier metadata refers to // itself so we can check both cases with the same routine. - MDNode *loopIdMD = II->getMetadata("llvm.mem.parallel_loop_access"); + MDNode *loopIdMD = + II->getMetadata(LLVMContext::MD_mem_parallel_loop_access); if (!loopIdMD) return false; diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 462d5b7cf0b..53f3be51665 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -2624,7 +2624,7 @@ bool llvm::isKnownNonNull(const Value *V, const TargetLibraryInfo *TLI) { // A Load tagged w/nonnull metadata is never null. if (const LoadInst *LI = dyn_cast<LoadInst>(V)) - return LI->getMetadata("nonnull"); + return LI->getMetadata(LLVMContext::MD_nonnull); if (ImmutableCallSite CS = V) if (CS.isReturnNonNull()) |