本文整理匯總了Golang中github.com/axw/gollvm/llvm.TargetData類的典型用法代碼示例。如果您正苦於以下問題:Golang TargetData類的具體用法?Golang TargetData怎麽用?Golang TargetData使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了TargetData類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: NewLLVMTypeMap
func NewLLVMTypeMap(target llvm.TargetData) *LLVMTypeMap {
// spec says int is either 32-bit or 64-bit.
var inttype llvm.Type
if target.PointerSize() >= 8 {
inttype = llvm.Int64Type()
} else {
inttype = llvm.Int32Type()
}
return &LLVMTypeMap{
target: target,
types: make(map[string]llvm.Type),
inttype: inttype,
}
}
示例2: NewLLVMTypeMap
func NewLLVMTypeMap(target llvm.TargetData) *llvmTypeMap {
// spec says int is either 32-bit or 64-bit.
var inttype llvm.Type
if target.PointerSize() >= 8 {
inttype = llvm.Int64Type()
} else {
inttype = llvm.Int32Type()
}
return &llvmTypeMap{
StdSizes: &types.StdSizes{
WordSize: int64(target.PointerSize()),
MaxAlign: 8,
},
target: target,
inttype: inttype,
ptrstandin: llvm.GlobalContext().StructCreateNamed(""),
}
}
示例3: newAlgorithmMap
func newAlgorithmMap(m llvm.Module, runtime *runtimeInterface, target llvm.TargetData) *algorithmMap {
am := &algorithmMap{
module: m,
runtime: runtime,
}
uintptrType := target.IntPtrType()
voidPtrType := llvm.PointerType(llvm.Int8Type(), 0)
boolType := llvm.Int1Type()
params := []llvm.Type{uintptrType, voidPtrType}
am.hashAlgFunctionType = llvm.FunctionType(uintptrType, params, false)
params = []llvm.Type{uintptrType, uintptrType, uintptrType}
am.equalAlgFunctionType = llvm.FunctionType(boolType, params, false)
params = []llvm.Type{uintptrType, voidPtrType}
am.printAlgFunctionType = llvm.FunctionType(llvm.VoidType(), params, false)
params = []llvm.Type{uintptrType, voidPtrType, voidPtrType}
am.copyAlgFunctionType = llvm.FunctionType(llvm.VoidType(), params, false)
return am
}