diff options
author | Ayke van Laethem <[email protected]> | 2022-05-23 21:47:42 +0200 |
---|---|---|
committer | Ron Evans <[email protected]> | 2022-05-25 12:51:31 +0200 |
commit | 7ea9eff40638643bbe8ae5466111e790daca7280 (patch) | |
tree | ed6e42cd1bfdd44ddb0d47f0674e390204580523 /interp | |
parent | 80d94115dc0b4d55e923641cf2692f1b26843a11 (diff) | |
download | tinygo-7ea9eff40638643bbe8ae5466111e790daca7280.tar.gz tinygo-7ea9eff40638643bbe8ae5466111e790daca7280.zip |
interp: implement binary operators in markExternal* functions
This is necessary for the next commit. The next commit would otherwise
cause an issue with the following constant operation:
i64 add (i64 ptrtoint (%runtime.machHeader* @_mh_execute_header to i64), i64 32)
Diffstat (limited to 'interp')
-rw-r--r-- | interp/memory.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/interp/memory.go b/interp/memory.go index d2396861f..3a16b875e 100644 --- a/interp/memory.go +++ b/interp/memory.go @@ -190,6 +190,16 @@ func (mv *memoryView) markExternal(llvmValue llvm.Value, mark uint8) error { if err != nil { return err } + case llvm.Add, llvm.Sub, llvm.Mul, llvm.UDiv, llvm.SDiv, llvm.URem, llvm.SRem, llvm.Shl, llvm.LShr, llvm.AShr, llvm.And, llvm.Or, llvm.Xor: + // Integer binary operators. Mark both operands. + err := mv.markExternal(llvmValue.Operand(0), mark) + if err != nil { + return err + } + err = mv.markExternal(llvmValue.Operand(1), mark) + if err != nil { + return err + } default: return fmt.Errorf("interp: unknown constant expression '%s'", instructionNameMap[llvmValue.Opcode()]) } |