1 //===- transforms_pmbuilder.go - Bindings for PassManagerBuilder ----------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This file defines bindings for the PassManagerBuilder class.
11 //===----------------------------------------------------------------------===//
16 #include "llvm-c/Transforms/PassManagerBuilder.h"
20 type PassManagerBuilder
struct {
21 C C
.LLVMPassManagerBuilderRef
24 func NewPassManagerBuilder() (pmb PassManagerBuilder
) {
25 pmb
.C
= C
.LLVMPassManagerBuilderCreate()
29 func (pmb PassManagerBuilder
) SetOptLevel(level
int) {
30 C
.LLVMPassManagerBuilderSetOptLevel(pmb
.C
, C
.uint(level
))
33 func (pmb PassManagerBuilder
) SetSizeLevel(level
int) {
34 C
.LLVMPassManagerBuilderSetSizeLevel(pmb
.C
, C
.uint(level
))
37 func (pmb PassManagerBuilder
) Populate(pm PassManager
) {
38 C
.LLVMPassManagerBuilderPopulateModulePassManager(pmb
.C
, pm
.C
)
41 func (pmb PassManagerBuilder
) PopulateFunc(pm PassManager
) {
42 C
.LLVMPassManagerBuilderPopulateFunctionPassManager(pmb
.C
, pm
.C
)
45 func (pmb PassManagerBuilder
) PopulateLTOPassManager(pm PassManager
, internalize
bool, runInliner
bool) {
46 C
.LLVMPassManagerBuilderPopulateLTOPassManager(pmb
.C
, pm
.C
, boolToLLVMBool(internalize
), boolToLLVMBool(runInliner
))
49 func (pmb PassManagerBuilder
) Dispose() {
50 C
.LLVMPassManagerBuilderDispose(pmb
.C
)
53 func (pmb PassManagerBuilder
) SetDisableUnitAtATime(val
bool) {
54 C
.LLVMPassManagerBuilderSetDisableUnitAtATime(pmb
.C
, boolToLLVMBool(val
))
57 func (pmb PassManagerBuilder
) SetDisableUnrollLoops(val
bool) {
58 C
.LLVMPassManagerBuilderSetDisableUnrollLoops(pmb
.C
, boolToLLVMBool(val
))
61 func (pmb PassManagerBuilder
) SetDisableSimplifyLibCalls(val
bool) {
62 C
.LLVMPassManagerBuilderSetDisableSimplifyLibCalls(pmb
.C
, boolToLLVMBool(val
))
65 func (pmb PassManagerBuilder
) UseInlinerWithThreshold(threshold
uint) {
66 C
.LLVMPassManagerBuilderUseInlinerWithThreshold(pmb
.C
, C
.uint(threshold
))