aboutsummaryrefslogtreecommitdiffhomepage
path: root/interp/interp.go
diff options
context:
space:
mode:
Diffstat (limited to 'interp/interp.go')
-rw-r--r--interp/interp.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/interp/interp.go b/interp/interp.go
index 856f08b18..7833dfe93 100644
--- a/interp/interp.go
+++ b/interp/interp.go
@@ -156,7 +156,7 @@ func Run(mod llvm.Module, timeout time.Duration, debug bool) error {
if obj.constant {
continue // constant buffers can't have been modified
}
- initializer, err := obj.buffer.toLLVMValue(obj.llvmGlobal.Type().ElementType(), &mem)
+ initializer, err := obj.buffer.toLLVMValue(obj.llvmGlobal.GlobalValueType(), &mem)
if err == errInvalidPtrToIntSize {
// This can happen when a previous interp run did not have the
// correct LLVM type for a global and made something up. In that
@@ -190,7 +190,7 @@ func Run(mod llvm.Module, timeout time.Duration, debug bool) error {
if err != nil {
return err
}
- if checks && initializer.Type() != obj.llvmGlobal.Type().ElementType() {
+ if checks && initializer.Type() != obj.llvmGlobal.GlobalValueType() {
panic("initializer type mismatch")
}
obj.llvmGlobal.SetInitializer(initializer)
@@ -213,7 +213,7 @@ func RunFunc(fn llvm.Value, timeout time.Duration, debug bool) error {
r.pkgName = initName[:len(initName)-len(".init")]
// Create new function with the interp result.
- newFn := llvm.AddFunction(mod, fn.Name()+".tmp", fn.Type().ElementType())
+ newFn := llvm.AddFunction(mod, fn.Name()+".tmp", fn.GlobalValueType())
newFn.SetLinkage(fn.Linkage())
newFn.SetVisibility(fn.Visibility())
entry := mod.Context().AddBasicBlock(newFn, "entry")
@@ -263,11 +263,11 @@ func RunFunc(fn llvm.Value, timeout time.Duration, debug bool) error {
if obj.constant {
continue // constant, so can't have been modified
}
- initializer, err := obj.buffer.toLLVMValue(obj.llvmGlobal.Type().ElementType(), &mem)
+ initializer, err := obj.buffer.toLLVMValue(obj.llvmGlobal.GlobalValueType(), &mem)
if err != nil {
return err
}
- if checks && initializer.Type() != obj.llvmGlobal.Type().ElementType() {
+ if checks && initializer.Type() != obj.llvmGlobal.GlobalValueType() {
panic("initializer type mismatch")
}
obj.llvmGlobal.SetInitializer(initializer)