xref: /aosp_15_r20/external/llvm/bindings/go/llvm/transforms_ipo.go (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1//===- transforms_ipo.go - Bindings for ipo -------------------------------===//
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 ipo component.
11//
12//===----------------------------------------------------------------------===//
13
14package llvm
15
16/*
17#include "llvm-c/Transforms/IPO.h"
18*/
19import "C"
20
21// helpers
22func boolToUnsigned(b bool) C.unsigned {
23	if b {
24		return 1
25	}
26	return 0
27}
28
29func (pm PassManager) AddArgumentPromotionPass()     { C.LLVMAddArgumentPromotionPass(pm.C) }
30func (pm PassManager) AddConstantMergePass()         { C.LLVMAddConstantMergePass(pm.C) }
31func (pm PassManager) AddDeadArgEliminationPass()    { C.LLVMAddDeadArgEliminationPass(pm.C) }
32func (pm PassManager) AddFunctionAttrsPass()         { C.LLVMAddFunctionAttrsPass(pm.C) }
33func (pm PassManager) AddFunctionInliningPass()      { C.LLVMAddFunctionInliningPass(pm.C) }
34func (pm PassManager) AddGlobalDCEPass()             { C.LLVMAddGlobalDCEPass(pm.C) }
35func (pm PassManager) AddGlobalOptimizerPass()       { C.LLVMAddGlobalOptimizerPass(pm.C) }
36func (pm PassManager) AddIPConstantPropagationPass() { C.LLVMAddIPConstantPropagationPass(pm.C) }
37func (pm PassManager) AddPruneEHPass()               { C.LLVMAddPruneEHPass(pm.C) }
38func (pm PassManager) AddIPSCCPPass()                { C.LLVMAddIPSCCPPass(pm.C) }
39func (pm PassManager) AddInternalizePass(allButMain bool) {
40	C.LLVMAddInternalizePass(pm.C, boolToUnsigned(allButMain))
41}
42func (pm PassManager) AddStripDeadPrototypesPass() { C.LLVMAddStripDeadPrototypesPass(pm.C) }
43