本文整理汇总了Golang中github.com/axw/gollvm/llvm.Value.Name方法的典型用法代码示例。如果您正苦于以下问题:Golang Value.Name方法的具体用法?Golang Value.Name怎么用?Golang Value.Name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/axw/gollvm/llvm.Value
的用法示例。
在下文中一共展示了Value.Name方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: createGlobalVariableMetadata
// Debug intrinsic collectors.
func createGlobalVariableMetadata(global llvm.Value) llvm.DebugDescriptor {
return &llvm.GlobalVariableDescriptor{
Name: global.Name(),
DisplayName: global.Name(),
//File:
//Line:
Type: int32_debug_type, // FIXME
Value: global}
}
示例2: declare
// declare creates an llvm.dbg.declare call for the specified function
// parameter or local variable.
func (d *debugInfo) declare(b llvm.Builder, v ssa.Value, llv llvm.Value, paramIndex int) {
tag := tagAutoVariable
if paramIndex >= 0 {
tag = tagArgVariable
}
ld := debug.NewLocalVariableDescriptor(tag)
ld.Argument = uint32(paramIndex + 1)
ld.Name = llv.Name()
if file := d.Fset.File(v.Pos()); file != nil {
ld.Line = uint32(file.Position(v.Pos()).Line)
ld.File = &d.getCompileUnit(file).Path
}
ld.Type = d.TypeDebugDescriptor(deref(v.Type()))
ld.Context = d.context()
b.InsertDeclare(d.module, llvm.MDNode([]llvm.Value{llv}), d.MDNode(ld))
}
示例3: buildPtrRecvFunction
func (c *compiler) buildPtrRecvFunction(fn llvm.Value) llvm.Value {
defer c.builder.SetInsertPointAtEnd(c.builder.GetInsertBlock())
ifname := "*" + fn.Name()
ifn := c.module.Module.NamedFunction(ifname)
fntyp := fn.Type().ElementType()
entry := llvm.AddBasicBlock(ifn, "entry")
c.builder.SetInsertPointAtEnd(entry)
args := ifn.Params()
args[0] = c.builder.CreateLoad(args[0], "recv")
result := c.builder.CreateCall(fn, args, "")
if fntyp.ReturnType().TypeKind() == llvm.VoidTypeKind {
c.builder.CreateRetVoid()
} else {
c.builder.CreateRet(result)
}
return ifn
}
示例4: pushFunctionContext
func (d *debugInfo) pushFunctionContext(fnptr llvm.Value, sig *types.Signature, pos token.Pos) {
subprog := &debug.SubprogramDescriptor{
Name: fnptr.Name(),
DisplayName: fnptr.Name(),
Function: fnptr,
}
file := d.Fset.File(pos)
cu := d.getCompileUnit(file)
subprog.File = file.Name()
subprog.Context = &cu.Path
if file != nil {
subprog.Line = uint32(file.Line(pos))
subprog.ScopeLine = uint32(file.Line(pos)) // TODO(axw)
}
sigType := d.TypeDebugDescriptor(sig).(*debug.CompositeTypeDescriptor)
subroutineType := sigType.Members[0]
subprog.Type = subroutineType
cu.Subprograms = append(cu.Subprograms, subprog)
d.pushContext(subprog)
}
示例5: interfaceFuncWrapper
func (tm *TypeMap) interfaceFuncWrapper(f llvm.Value) llvm.Value {
ftyp := f.Type().ElementType()
paramTypes := ftyp.ParamTypes()
recvType := paramTypes[0]
paramTypes[0] = llvm.PointerType(llvm.Int8Type(), 0)
newf := llvm.AddFunction(f.GlobalParent(), f.Name()+".ifn", llvm.FunctionType(
ftyp.ReturnType(),
paramTypes,
ftyp.IsFunctionVarArg(),
))
b := llvm.GlobalContext().NewBuilder()
defer b.Dispose()
entry := llvm.AddBasicBlock(newf, "entry")
b.SetInsertPointAtEnd(entry)
args := make([]llvm.Value, len(paramTypes))
for i := range paramTypes {
args[i] = newf.Param(i)
}
recvBits := int(tm.target.TypeSizeInBits(recvType))
if recvBits > 0 {
args[0] = b.CreatePtrToInt(args[0], tm.target.IntPtrType(), "")
if args[0].Type().IntTypeWidth() > recvBits {
args[0] = b.CreateTrunc(args[0], llvm.IntType(recvBits), "")
}
args[0] = coerce(b, args[0], recvType)
} else {
args[0] = llvm.ConstNull(recvType)
}
result := b.CreateCall(f, args, "")
if result.Type().TypeKind() == llvm.VoidTypeKind {
b.CreateRetVoid()
} else {
b.CreateRet(result)
}
return newf
}