mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-03 02:27:48 +00:00
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)
This commit is contained in:
committed by
Ron Evans
parent
80d94115dc
commit
7ea9eff406
@@ -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()])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user