本文整理匯總了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
}