about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm/llvm/ffi.rs
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-01-05 19:16:58 +0100
committerNikita Popov <nikita.ppv@gmail.com>2020-02-12 15:34:16 +0100
commitc6b0803202c95abd614c8ea448f7c7ff948da31a (patch)
treeff563ab4d941505fce9c69f570f21db541c91ca5 /src/librustc_codegen_llvm/llvm/ffi.rs
parent737f08bc28363626cf4036f646cb182b61d05bd3 (diff)
downloadrust-c6b0803202c95abd614c8ea448f7c7ff948da31a.tar.gz
rust-c6b0803202c95abd614c8ea448f7c7ff948da31a.zip
Add support for new pass manager
The new pass manager can be enabled using
-Z new-llvm-pass-manager=on.
Diffstat (limited to 'src/librustc_codegen_llvm/llvm/ffi.rs')
-rw-r--r--src/librustc_codegen_llvm/llvm/ffi.rs49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/librustc_codegen_llvm/llvm/ffi.rs b/src/librustc_codegen_llvm/llvm/ffi.rs
index cdb55b179a3..f570e808f56 100644
--- a/src/librustc_codegen_llvm/llvm/ffi.rs
+++ b/src/librustc_codegen_llvm/llvm/ffi.rs
@@ -402,6 +402,38 @@ pub enum CodeGenOptLevel {
     Aggressive,
 }
 
+/// LLVMRustPassBuilderOptLevel
+#[repr(C)]
+pub enum PassBuilderOptLevel {
+    O0,
+    O1,
+    O2,
+    O3,
+    Os,
+    Oz,
+}
+
+/// LLVMRustOptStage
+#[derive(PartialEq)]
+#[repr(C)]
+pub enum OptStage {
+    PreLinkNoLTO,
+    PreLinkThinLTO,
+    PreLinkFatLTO,
+    ThinLTO,
+    FatLTO,
+}
+
+/// LLVMRustSanitizerOptions
+#[repr(C)]
+pub struct SanitizerOptions {
+    pub sanitize_memory: bool,
+    pub sanitize_thread: bool,
+    pub sanitize_address: bool,
+    pub sanitize_recover: bool,
+    pub sanitize_memory_track_origins: c_int,
+}
+
 /// LLVMRelocMode
 #[derive(Copy, Clone, PartialEq)]
 #[repr(C)]
@@ -1896,6 +1928,23 @@ extern "C" {
         Output: *const c_char,
         FileType: FileType,
     ) -> LLVMRustResult;
+    pub fn LLVMRustOptimizeWithNewPassManager(
+        M: &'a Module,
+        TM: &'a TargetMachine,
+        OptLevel: PassBuilderOptLevel,
+        OptStage: OptStage,
+        NoPrepopulatePasses: bool,
+        VerifyIR: bool,
+        UseThinLTOBuffers: bool,
+        MergeFunctions: bool,
+        UnrollLoops: bool,
+        SLPVectorize: bool,
+        LoopVectorize: bool,
+        DisableSimplifyLibCalls: bool,
+        SanitizerOptions: Option<&SanitizerOptions>,
+        PGOGenPath: *const c_char,
+        PGOUsePath: *const c_char,
+    );
     pub fn LLVMRustPrintModule(
         M: &'a Module,
         Output: *const c_char,