[prev in list] [next in list] [prev in thread] [next in thread] 

List:       llvm-commits
Subject:    [PATCH] D11698: Introduce enum value for previously defined metadata -- make.implicit
From:       Chen Li <meloli87 () gmail ! com>
Date:       2015-07-31 22:34:58
Message-ID: differential-rev-PHID-DREV-bxw6fje644b3jno5h3ln-req () reviews ! llvm ! org
[Download RAW message or body]

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.


["D11698.31174.patch" (text/x-patch)]

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.


_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic