[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
Mon Dec 31 12:48:47 PST 2018
CodaFi created this revision.
CodaFi added reviewers: whitequark, deadalnix.
Herald added a subscriber: llvm-commits.
Add accessors so the performance improvement from this setting is accessible to third parties.
Repository:
rL LLVM
https://reviews.llvm.org/D56179
Files:
include/llvm-c/Core.h
lib/IR/Core.cpp
Index: lib/IR/Core.cpp
===================================================================
--- lib/IR/Core.cpp
+++ 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: include/llvm-c/Core.h
===================================================================
--- include/llvm-c/Core.h
+++ include/llvm-c/Core.h
@@ -520,6 +520,23 @@
void LLVMContextSetYieldCallback(LLVMContextRef C, LLVMYieldCallback Callback,
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.
*
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56179.179780.patch
Type: text/x-patch
Size: 1422 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181231/b33090c5/attachment.bin>
More information about the llvm-commits
mailing list