[PATCH] D11698: Introduce enum value for previously defined metadata -- make.implicit
Chen Li
meloli87 at gmail.com
Fri Jul 31 15:34:58 PDT 2015
chenli created this revision.
chenli added a reviewer: reames.
chenli added a subscriber: llvm-commits.
This patch adds enum value for an existing metadata type -- make.implicit. Using preassigned enum will be helpful to get compile time type checking and avoid string construction and comparison. The patch also changes uses of make.implicit from string metadata to enum metadata. There is no functionality change.
http://reviews.llvm.org/D11698
Files:
include/llvm/IR/LLVMContext.h
lib/CodeGen/ImplicitNullChecks.cpp
Index: lib/CodeGen/ImplicitNullChecks.cpp
===================================================================
--- lib/CodeGen/ImplicitNullChecks.cpp
+++ lib/CodeGen/ImplicitNullChecks.cpp
@@ -38,6 +38,7 @@
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Instruction.h"
+#include "llvm/IR/LLVMContext.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Target/TargetSubtargetInfo.h"
@@ -134,7 +135,7 @@
MDNode *BranchMD =
MBB.getBasicBlock()
- ? MBB.getBasicBlock()->getTerminator()->getMetadata("make.implicit")
+ ? MBB.getBasicBlock()->getTerminator()->getMetadata(LLVMContext::MD_make_implicit)
: nullptr;
if (!BranchMD)
return false;
Index: include/llvm/IR/LLVMContext.h
===================================================================
--- include/llvm/IR/LLVMContext.h
+++ include/llvm/IR/LLVMContext.h
@@ -60,7 +60,8 @@
MD_mem_parallel_loop_access = 10, // "llvm.mem.parallel_loop_access"
MD_nonnull = 11, // "nonnull"
MD_dereferenceable = 12, // "dereferenceable"
- MD_dereferenceable_or_null = 13 // "dereferenceable_or_null"
+ MD_dereferenceable_or_null = 13, // "dereferenceable_or_null"
+ MD_make_implicit = 14 // "make.implicit"
};
/// getMDKindID - Return a unique non-zero ID for the specified metadata kind.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11698.31174.patch
Type: text/x-patch
Size: 1394 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150731/cac1a547/attachment.bin>
More information about the llvm-commits
mailing list