[PATCH] D56179: [LLVM-C] Add Accessors for Discarding Value Names in the IR

Robert Widmann via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 1 11:01:07 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL350196: [LLVM-C] Add Accessors for Discarding Value Names in the IR (authored by CodaFi, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D56179?vs=179780&id=179799#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56179/new/

https://reviews.llvm.org/D56179

Files:
  llvm/trunk/include/llvm-c/Core.h
  llvm/trunk/lib/IR/Core.cpp


Index: llvm/trunk/lib/IR/Core.cpp
===================================================================
--- llvm/trunk/lib/IR/Core.cpp
+++ llvm/trunk/lib/IR/Core.cpp
@@ -108,6 +108,14 @@
   unwrap(C)->setYieldCallback(YieldCallback, OpaqueHandle);
 }
 
+bool LLVMContextShouldDiscardValueNames(LLVMContextRef C) {
+  return unwrap(C)->shouldDiscardValueNames();
+}
+
+void LLVMContextSetDiscardValueNames(LLVMContextRef C, bool Discard) {
+  unwrap(C)->setDiscardValueNames(Discard);
+}
+
 void LLVMContextDispose(LLVMContextRef C) {
   delete unwrap(C);
 }
Index: llvm/trunk/include/llvm-c/Core.h
===================================================================
--- llvm/trunk/include/llvm-c/Core.h
+++ llvm/trunk/include/llvm-c/Core.h
@@ -521,6 +521,23 @@
                                  void *OpaqueHandle);
 
 /**
+ * Retrieve whether the given context is set to discard all value names.
+ *
+ * @see LLVMContext::shouldDiscardValueNames()
+ */
+bool LLVMContextShouldDiscardValueNames(LLVMContextRef C);
+
+/**
+ * Set whether the given context discards all value names.
+ *
+ * If true, only the names of GlobalValue objects will be available in the IR.
+ * This can be used to save memory and runtime, especially in release mode.
+ *
+ * @see LLVMContext::setDiscardValueNames()
+ */
+void LLVMContextSetDiscardValueNames(LLVMContextRef C, bool Discard);
+
+/**
  * Destroy a context instance.
  *
  * This should be called for every call to LLVMContextCreate() or memory


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56179.179799.patch
Type: text/x-patch
Size: 1482 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190101/4cb8f7a9/attachment-0001.bin>


More information about the llvm-commits mailing list