about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorflip1995 <philipp.krones@embecosm.com>2022-04-21 13:35:40 +0100
committerPhilipp Krones <hello@philkrones.com>2022-06-14 14:50:52 +0200
commit20f597ffcd29d71d116c617def76291689549d6c (patch)
treeef75823552206544327e02a1347a80c4d8996319 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parentdef3fd8e9224128ffdf4cb0a7f08306f757a059a (diff)
downloadrust-20f597ffcd29d71d116c617def76291689549d6c.tar.gz
rust-20f597ffcd29d71d116c617def76291689549d6c.zip
Add LLVM module flags required for the VFE opt
To apply the optimization the `Virtual Function Elim` module flag has to
be set. To apply this optimization post-link the `LTOPostLink` module
flag has to be set.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
-rw-r--r--compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
index f90bb7f2368..a2dd0a7bcdc 100644
--- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
+++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
@@ -672,6 +672,11 @@ extern "C" void LLVMRustAddModuleFlag(
   unwrap(M)->addModuleFlag(MergeBehavior, Name, Value);
 }
 
+extern "C" bool LLVMRustHasModuleFlag(LLVMModuleRef M, const char *Name,
+                                      size_t Len) {
+  return unwrap(M)->getModuleFlag(StringRef(Name, Len)) != nullptr;
+}
+
 extern "C" LLVMValueRef LLVMRustMetadataAsValue(LLVMContextRef C, LLVMMetadataRef MD) {
   return wrap(MetadataAsValue::get(*unwrap(C), unwrap(MD)));
 }