aboutsummaryrefslogtreecommitdiff
path: root/src/zig_llvm.cpp
diff options
context:
space:
mode:
authorGuillaume Wenzek <gwenzek@users.noreply.github.com>2023-01-03 12:05:09 +0100
committerGitHub <noreply@github.com>2023-01-03 13:05:09 +0200
commita44085dc2ab81877fc71fb50e846454c2694a14c (patch)
treee3ffb828f5933a7a1df32c7e06f2c90871d59c8f /src/zig_llvm.cpp
parent93bdd04e8880f0ae2ad73b5922d499ec8500a82c (diff)
downloadzig-a44085dc2ab81877fc71fb50e846454c2694a14c.tar.gz
zig-a44085dc2ab81877fc71fb50e846454c2694a14c.zip
add -fopt-bisect-limit
Diffstat (limited to 'src/zig_llvm.cpp')
-rw-r--r--src/zig_llvm.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/zig_llvm.cpp b/src/zig_llvm.cpp
index c38e311f67..4f73bd2c3c 100644
--- a/src/zig_llvm.cpp
+++ b/src/zig_llvm.cpp
@@ -31,6 +31,7 @@
#include <llvm/IR/Instructions.h>
#include <llvm/IR/LegacyPassManager.h>
#include <llvm/IR/Module.h>
+#include <llvm/IR/OptBisect.h>
#include <llvm/IR/PassManager.h>
#include <llvm/IR/Verifier.h>
#include <llvm/InitializePasses.h>
@@ -412,6 +413,18 @@ ZIG_EXTERN_C LLVMTypeRef ZigLLVMTokenTypeInContext(LLVMContextRef context_ref) {
return wrap(Type::getTokenTy(*unwrap(context_ref)));
}
+
+ZIG_EXTERN_C void ZigLLVMSetOptBisectLimit(LLVMContextRef context_ref, int limit) {
+ // In LLVM15 we just have an OptBisect singleton we can edit.
+ OptBisect& bisect = getOptBisector();
+ bisect.setLimit(limit);
+
+ // In LLVM16 OptBisect will be wrapped in OptPassGate, and will need to be set per context.
+ // static OptBisect _opt_bisector;
+ // _opt_bisector.setLimit(limit);
+ // unwrap(context_ref)->setOptPassGate(_opt_bisector);
+}
+
LLVMValueRef ZigLLVMAddFunctionInAddressSpace(LLVMModuleRef M, const char *Name, LLVMTypeRef FunctionTy, unsigned AddressSpace) {
Function* func = Function::Create(unwrap<FunctionType>(FunctionTy), GlobalValue::ExternalLinkage, AddressSpace, Name, unwrap(M));
return wrap(func);