mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-07-26 06:38:42 +00:00
compiler: remove support for memory references in AsmFull
Memory references (`*m` in LLVM IR inline assembly) need a pointer type starting in LLVM 14. This is a bit inconvenient and requires a new API in the go-llvm package. Instead of doing that, I'd like to remove support for memory references from AsmFull (and possibly AsmFull entirely if possible: it's hard to use correctly). This breaks tinygo.org/x/drivers/ws2812 for AVR, ARM, and RISC-V which need to be updated. Probably using CGo.
This commit is contained in:
committed by
Ron Evans
parent
52233790cc
commit
cad6a57077
@@ -98,7 +98,10 @@ func (b *builder) createInlineAsmFull(instr *ssa.CallCommon) (llvm.Value, error)
|
||||
case llvm.IntegerTypeKind:
|
||||
constraints = append(constraints, "r")
|
||||
case llvm.PointerTypeKind:
|
||||
constraints = append(constraints, "*m")
|
||||
// Memory references require a type in LLVM 14, probably as a
|
||||
// preparation for opaque pointers.
|
||||
err = b.makeError(instr.Pos(), "support for pointer operands was dropped in TinyGo 0.23")
|
||||
return s
|
||||
default:
|
||||
err = b.makeError(instr.Pos(), "unknown type in inline assembly for value: "+name)
|
||||
return s
|
||||
|
||||
@@ -236,10 +236,10 @@ func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error {
|
||||
kendryte.GPIOHS.RISE_IE.ClearBits(1 << pin)
|
||||
// Acknowledge interrupt atomically.
|
||||
riscv.AsmFull(
|
||||
"amoor.w {}, {mask}, {reg}",
|
||||
"amoor.w {}, {mask}, ({reg})",
|
||||
map[string]interface{}{
|
||||
"mask": uint32(1 << pin),
|
||||
"reg": &kendryte.GPIOHS.RISE_IP.Reg,
|
||||
"reg": uintptr(unsafe.Pointer(&kendryte.GPIOHS.RISE_IP.Reg)),
|
||||
})
|
||||
kendryte.GPIOHS.RISE_IE.SetBits(1 << pin)
|
||||
}
|
||||
@@ -248,10 +248,10 @@ func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error {
|
||||
kendryte.GPIOHS.FALL_IE.ClearBits(1 << pin)
|
||||
// Acknowledge interrupt atomically.
|
||||
riscv.AsmFull(
|
||||
"amoor.w {}, {mask}, {reg}",
|
||||
"amoor.w {}, {mask}, ({reg})",
|
||||
map[string]interface{}{
|
||||
"mask": uint32(1 << pin),
|
||||
"reg": &kendryte.GPIOHS.FALL_IP.Reg,
|
||||
"reg": uintptr(unsafe.Pointer(&kendryte.GPIOHS.FALL_IP.Reg)),
|
||||
})
|
||||
kendryte.GPIOHS.FALL_IE.SetBits(1 << pin)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user