aboutsummaryrefslogtreecommitdiffhomepage
path: root/interp
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2022-09-22 13:39:51 +0200
committerRon Evans <[email protected]>2022-10-19 22:23:19 +0200
commit2b7f56220210198dc850df7d03017d7908bb119c (patch)
treec6caf479f9afed2d026f828b603b9984406494b6 /interp
parent08a51535d43dfc2ee11ec239f87f3321ddd8f469 (diff)
downloadtinygo-2b7f56220210198dc850df7d03017d7908bb119c.tar.gz
tinygo-2b7f56220210198dc850df7d03017d7908bb119c.zip
ci: add support for LLVM 15
This commit switches to LLVM 15 everywhere by default, while still keeping LLVM 14 support.
Diffstat (limited to 'interp')
-rw-r--r--interp/interpreter.go16
1 files changed, 14 insertions, 2 deletions
diff --git a/interp/interpreter.go b/interp/interpreter.go
index 83fd2cd9a..c61ce7cf3 100644
--- a/interp/interpreter.go
+++ b/interp/interpreter.go
@@ -356,7 +356,7 @@ func (r *runner) run(fn *function, params []value, parentMem *memoryView, indent
default:
panic("unknown integer type width")
}
- case strings.HasPrefix(callFn.name, "llvm.memcpy.p0i8.p0i8.") || strings.HasPrefix(callFn.name, "llvm.memmove.p0i8.p0i8."):
+ case strings.HasPrefix(callFn.name, "llvm.memcpy.p0") || strings.HasPrefix(callFn.name, "llvm.memmove.p0"):
// Copy a block of memory from one pointer to another.
dst, err := operands[1].asPointer(r)
if err != nil {
@@ -496,7 +496,7 @@ func (r *runner) run(fn *function, params []value, parentMem *memoryView, indent
typecodeID := typecodeIDBitCast.Operand(0).Initializer()
// Load the method set, which is part of the typecodeID object.
- methodSet := r.builder.CreateExtractValue(typecodeID, 2, "").Operand(0).Initializer()
+ methodSet := stripPointerCasts(r.builder.CreateExtractValue(typecodeID, 2, "")).Initializer()
// We don't need to load the interface method set.
@@ -1095,3 +1095,15 @@ func intPredicateString(predicate llvm.IntPredicate) string {
return "cmp?"
}
}
+
+// Strip some pointer casts. This is probably unnecessary once support for
+// LLVM 14 (non-opaque pointers) is dropped.
+func stripPointerCasts(value llvm.Value) llvm.Value {
+ if !value.IsAConstantExpr().IsNil() {
+ switch value.Opcode() {
+ case llvm.GetElementPtr, llvm.BitCast:
+ return stripPointerCasts(value.Operand(0))
+ }
+ }
+ return value
+}