Skip to content

Commit

Permalink
* Include new llvm-c/Transforms/PassBuilder.h header file in prese…
Browse files Browse the repository at this point in the history
…ts for LLVM (pull #1093)
  • Loading branch information
junlarsen authored Oct 23, 2021
1 parent 80d0be3 commit 9a86503
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

* Include new `llvm-c/Transforms/PassBuilder.h` header file in presets for LLVM ([pull #1093](https://github.com/bytedeco/javacpp-presets/pull/1093))
* Introduce `macosx-arm64` builds to presets for LLVM ([pull #1092](https://github.com/bytedeco/javacpp-presets/pull/1092))
* Add presets for Triton Inference Server 2.14 ([pull #1085](https://github.com/bytedeco/javacpp-presets/pull/1085))
* Add presets for the NvToolsExt (NVTX) module of CUDA ([issue #1068](https://github.com/bytedeco/javacpp-presets/issues/1068))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Targeted by JavaCPP version 1.5.7-SNAPSHOT: DO NOT EDIT THIS FILE

package org.bytedeco.llvm.LLVM;

import java.nio.*;
import org.bytedeco.javacpp.*;
import org.bytedeco.javacpp.annotation.*;

import static org.bytedeco.javacpp.presets.javacpp.*;

import static org.bytedeco.llvm.global.LLVM.*;


/**
* A set of options passed which are attached to the Pass Manager upon run.
*
* This corresponds to an llvm::LLVMPassBuilderOptions instance
*
* The details for how the different properties of this structure are used can
* be found in the source for LLVMRunPasses
*/
@Name("LLVMOpaquePassBuilderOptions") @Opaque @Properties(inherit = org.bytedeco.llvm.presets.LLVM.class)
public class LLVMPassBuilderOptionsRef extends Pointer {
/** Empty constructor. Calls {@code super((Pointer)null)}. */
public LLVMPassBuilderOptionsRef() { super((Pointer)null); }
/** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
public LLVMPassBuilderOptionsRef(Pointer p) { super(p); }
}
98 changes: 98 additions & 0 deletions llvm/src/gen/java/org/bytedeco/llvm/global/LLVM.java
Original file line number Diff line number Diff line change
Expand Up @@ -11519,6 +11519,104 @@ public static native void LLVMAddScalarReplAggregatesPassWithThreshold(LLVMPassM
// #endif


// Parsed from <llvm-c/Transforms/PassBuilder.h>

/*===-- llvm-c/Transform/PassBuilder.h - PassBuilder for LLVM C ---*- C -*-===*\
|* *|
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|* Exceptions. *|
|* See https://llvm.org/LICENSE.txt for license information. *|
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|* *|
|*===----------------------------------------------------------------------===*|
|* *|
|* This header contains the LLVM-C interface into the new pass manager *|
|* *|
\*===----------------------------------------------------------------------===*/

// #ifndef LLVM_C_TRANSFORMS_PASSBUILDER_H
// #define LLVM_C_TRANSFORMS_PASSBUILDER_H

// #include "llvm-c/Error.h"
// #include "llvm-c/TargetMachine.h"
// #include "llvm-c/Types.h"
// Targeting ../LLVM/LLVMPassBuilderOptionsRef.java



/**
* Construct and run a set of passes over a module
*
* This function takes a string with the passes that should be used. The format
* of this string is the same as opt's -passes argument for the new pass
* manager. Individual passes may be specified, separated by commas. Full
* pipelines may also be invoked using {@code default<O3>} and friends. See opt for
* full reference of the Passes format.
*/
public static native LLVMErrorRef LLVMRunPasses(LLVMModuleRef M, @Cast("const char*") BytePointer Passes,
LLVMTargetMachineRef TM,
LLVMPassBuilderOptionsRef Options);
public static native LLVMErrorRef LLVMRunPasses(LLVMModuleRef M, String Passes,
LLVMTargetMachineRef TM,
LLVMPassBuilderOptionsRef Options);

/**
* Create a new set of options for a PassBuilder
*
* Ownership of the returned instance is given to the client, and they are
* responsible for it. The client should call LLVMDisposePassBuilderOptions
* to free the pass builder options.
*/
public static native LLVMPassBuilderOptionsRef LLVMCreatePassBuilderOptions();

/**
* Toggle adding the VerifierPass for the PassBuilder, ensuring all functions
* inside the module is valid.
*/
public static native void LLVMPassBuilderOptionsSetVerifyEach(LLVMPassBuilderOptionsRef Options,
@Cast("LLVMBool") int VerifyEach);

/**
* Toggle debug logging when running the PassBuilder
*/
public static native void LLVMPassBuilderOptionsSetDebugLogging(LLVMPassBuilderOptionsRef Options,
@Cast("LLVMBool") int DebugLogging);

public static native void LLVMPassBuilderOptionsSetLoopInterleaving(
LLVMPassBuilderOptionsRef Options, @Cast("LLVMBool") int LoopInterleaving);

public static native void LLVMPassBuilderOptionsSetLoopVectorization(
LLVMPassBuilderOptionsRef Options, @Cast("LLVMBool") int LoopVectorization);

public static native void LLVMPassBuilderOptionsSetSLPVectorization(
LLVMPassBuilderOptionsRef Options, @Cast("LLVMBool") int SLPVectorization);

public static native void LLVMPassBuilderOptionsSetLoopUnrolling(LLVMPassBuilderOptionsRef Options,
@Cast("LLVMBool") int LoopUnrolling);

public static native void LLVMPassBuilderOptionsSetForgetAllSCEVInLoopUnroll(
LLVMPassBuilderOptionsRef Options, @Cast("LLVMBool") int ForgetAllSCEVInLoopUnroll);

public static native void LLVMPassBuilderOptionsSetLicmMssaOptCap(LLVMPassBuilderOptionsRef Options,
@Cast("unsigned") int LicmMssaOptCap);

public static native void LLVMPassBuilderOptionsSetLicmMssaNoAccForPromotionCap(
LLVMPassBuilderOptionsRef Options, @Cast("unsigned") int LicmMssaNoAccForPromotionCap);

public static native void LLVMPassBuilderOptionsSetCallGraphProfile(
LLVMPassBuilderOptionsRef Options, @Cast("LLVMBool") int CallGraphProfile);

public static native void LLVMPassBuilderOptionsSetMergeFunctions(LLVMPassBuilderOptionsRef Options,
@Cast("LLVMBool") int MergeFunctions);

/**
* Dispose of a heap-allocated PassBuilderOptions instance
*/
public static native void LLVMDisposePassBuilderOptions(LLVMPassBuilderOptionsRef Options);

// #endif // LLVM_C_TRANSFORMS_PASSBUILDER_H


// Parsed from <polly/LinkAllPasses.h>

//===- polly/LinkAllPasses.h ----------- Reference All Passes ---*- C++ -*-===//
Expand Down
4 changes: 3 additions & 1 deletion llvm/src/main/java/org/bytedeco/llvm/presets/LLVM.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"<llvm-c/Comdat.h>", "<llvm-c/DebugInfo.h>", "<llvm-c/Error.h>", "<llvm-c/ErrorHandling.h>", "<llvm-c/Orc.h>", "<llvm-c/Remarks.h>",
"<llvm-c/OrcEE.h>", "<llvm-c/LLJIT.h>", "<llvm-c/Transforms/AggressiveInstCombine.h>", "<llvm-c/Transforms/Coroutines.h>", "<llvm-c/Transforms/InstCombine.h>",
"<llvm-c/Transforms/IPO.h>", "<llvm-c/Transforms/PassManagerBuilder.h>", "<llvm-c/Transforms/Scalar.h>", "<llvm-c/Transforms/Utils.h>", "<llvm-c/Transforms/Vectorize.h>",
"<polly/LinkAllPasses.h>", "<FullOptimization.h>", "<NamedMetadataOperations.h>", "<TargetStubs.h>"},
"<llvm-c/Transforms/PassBuilder.h>", "<polly/LinkAllPasses.h>", "<FullOptimization.h>", "<NamedMetadataOperations.h>", "<TargetStubs.h>"},
compiler = "cpp14", link = {"LLVM-13", "LTO@.13", "Remarks@.13"}, resource = {"include", "lib", "libexec", "share"}),
@Platform(value = "macosx", link = {"LLVM", "LTO", "Remarks"}),
@Platform(value = "windows", link = {"LLVM", "LTO", "Remarks"})})
Expand Down Expand Up @@ -119,6 +119,7 @@ public void map(InfoMap infoMap) {
.put(new Info("LLVMOrcOpaqueIndirectStubsManager").pointerTypes("LLVMOrcIndirectStubsManagerRef"))
.put(new Info("LLVMOrcOpaqueLazyCallThroughManager").pointerTypes("LLVMOrcLazyCallThroughManagerRef"))
.put(new Info("LLVMOrcOpaqueDumpObjects").pointerTypes("LLVMOrcDumpObjectsRef"))
.put(new Info("LLVMOpaquePassBuilderOptions").pointerTypes("LLVMPassBuilderOptionsRef"))

.put(new Info("LLVMContextRef").valueTypes("LLVMContextRef").pointerTypes("@ByPtrPtr LLVMContextRef", "@Cast(\"LLVMContextRef*\") PointerPointer"))
.put(new Info("LLVMModuleRef").valueTypes("LLVMModuleRef").pointerTypes("@ByPtrPtr LLVMModuleRef", "@Cast(\"LLVMModuleRef*\") PointerPointer"))
Expand Down Expand Up @@ -182,6 +183,7 @@ public void map(InfoMap infoMap) {
.put(new Info("LLVMOrcIndirectStubsManagerRef").valueTypes("LLVMOrcIndirectStubsManagerRef").pointerTypes("@ByPtrPtr LLVMOrcIndirectStubsManagerRef", "@Cast(\"LLVMOrcIndirectStubsManagerRef*\") PointerPointer"))
.put(new Info("LLVMOrcLazyCallThroughManagerRef").valueTypes("LLVMOrcLazyCallThroughManagerRef").pointerTypes("@ByPtrPtr LLVMOrcLazyCallThroughManagerRef", "@Cast(\"LLVMOrcLazyCallThroughManagerRef*\") PointerPointer"))
.put(new Info("LLVMOrcDumpObjectsRef").valueTypes("LLVMOrcDumpObjectsRef").pointerTypes("@ByPtrPtr LLVMOrcDumpObjectsRef", "@Cast(\"LLVMOrcDumpObjectsRef*\") PointerPointer"))
.put(new Info("LLVMPassBuilderOptionsRef").valueTypes("LLVMPassBuilderOptionsRef").pointerTypes("@ByPtrPtr LLVMPassBuilderOptionsRef", "@Cast(\"LLVMPassBuilderOptionsRef*\") PointerPointer"))

.put(new Info("LLVM_C_EXTERN_C_BEGIN").cppText("#define LLVM_C_EXTERN_C_BEGIN").cppTypes())
.put(new Info("LLVM_C_EXTERN_C_END").cppText("#define LLVM_C_EXTERN_C_END").cppTypes())
Expand Down

0 comments on commit 9a86503

Please sign in to comment.