本文整理汇总了Golang中llvm/org/llvm/bindings/go/llvm.Builder.GetInsertBlock方法的典型用法代码示例。如果您正苦于以下问题:Golang Builder.GetInsertBlock方法的具体用法?Golang Builder.GetInsertBlock怎么用?Golang Builder.GetInsertBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类llvm/org/llvm/bindings/go/llvm.Builder
的用法示例。
在下文中一共展示了Builder.GetInsertBlock方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: decode
func (ai *directArgInfo) decode(ctx llvm.Context, allocaBuilder llvm.Builder, builder llvm.Builder) llvm.Value {
var args []llvm.Value
fn := builder.GetInsertBlock().Parent()
for i, _ := range ai.argTypes {
args = append(args, fn.Param(ai.argOffset+i))
}
return directDecode(ctx, allocaBuilder, builder, ai.valType, args)
}
示例2: encode
func (ri *indirectRetInfo) encode(ctx llvm.Context, allocaBuilder llvm.Builder, builder llvm.Builder, vals []llvm.Value) {
fn := builder.GetInsertBlock().Parent()
sretSlot := fn.Param(0)
if ri.numResults == 1 {
builder.CreateStore(vals[0], sretSlot)
} else {
for i, v := range vals {
builder.CreateStore(v, builder.CreateStructGEP(sretSlot, i, ""))
}
}
builder.CreateRetVoid()
}
示例3: Declare
// Declare creates an llvm.dbg.declare call for the specified function
// parameter or local variable.
func (d *DIBuilder) Declare(b llvm.Builder, v ssa.Value, llv llvm.Value, paramIndex int) {
tag := tagAutoVariable
if paramIndex >= 0 {
tag = tagArgVariable
}
var diFile llvm.Value
var line int
if file := d.fset.File(v.Pos()); file != nil {
line = file.Line(v.Pos())
diFile = d.getFile(file)
}
localVar := d.builder.CreateLocalVariable(d.scope(), llvm.DILocalVariable{
Tag: tag,
Name: llv.Name(),
File: diFile,
Line: line,
ArgNo: paramIndex + 1,
Type: d.DIType(v.Type()),
})
expr := d.builder.CreateExpression(nil)
d.builder.InsertDeclareAtEnd(llv, localVar, expr, b.GetInsertBlock())
}