1//===- transforms_pmbuilder.go - Bindings for PassManagerBuilder ----------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9// 10// This file defines bindings for the PassManagerBuilder class. 11// 12//===----------------------------------------------------------------------===// 13 14package llvm 15 16/* 17#include "llvm-c/Transforms/PassManagerBuilder.h" 18*/ 19import "C" 20 21type PassManagerBuilder struct { 22 C C.LLVMPassManagerBuilderRef 23} 24 25func NewPassManagerBuilder() (pmb PassManagerBuilder) { 26 pmb.C = C.LLVMPassManagerBuilderCreate() 27 return 28} 29 30func (pmb PassManagerBuilder) SetOptLevel(level int) { 31 C.LLVMPassManagerBuilderSetOptLevel(pmb.C, C.uint(level)) 32} 33 34func (pmb PassManagerBuilder) SetSizeLevel(level int) { 35 C.LLVMPassManagerBuilderSetSizeLevel(pmb.C, C.uint(level)) 36} 37 38func (pmb PassManagerBuilder) Populate(pm PassManager) { 39 C.LLVMPassManagerBuilderPopulateModulePassManager(pmb.C, pm.C) 40} 41 42func (pmb PassManagerBuilder) PopulateFunc(pm PassManager) { 43 C.LLVMPassManagerBuilderPopulateFunctionPassManager(pmb.C, pm.C) 44} 45 46func (pmb PassManagerBuilder) Dispose() { 47 C.LLVMPassManagerBuilderDispose(pmb.C) 48} 49