mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-08 04:53:42 +00:00
compiler: add support for parameters to inline assembly
This commit is contained in:
@@ -113,8 +113,25 @@ The device-specific packages like ``device/avr`` and ``device/arm`` provide
|
||||
|
||||
arm.Asm("wfi")
|
||||
|
||||
There is no support yet for inline assembly that takes (register) parameters or
|
||||
returns a value.
|
||||
You can also pass parameters to the inline assembly::
|
||||
|
||||
var result int32
|
||||
arm.AsmFull(`
|
||||
lsls {value}, #1
|
||||
str {value}, {result}
|
||||
`, map[string]interface{}{
|
||||
"value": 42,
|
||||
"result": &result,
|
||||
})
|
||||
println("result:", result)
|
||||
|
||||
In general, types are autodetected. That is, integer types are passed as raw
|
||||
registers and pointer types are passed as memory locations. This means you can't
|
||||
easily do pointer arithmetic. To do that, convert a pointer value to a
|
||||
``uintptr``.
|
||||
|
||||
Inline assembly support is expected to change in the future and may change in a
|
||||
backwards-incompatible manner.
|
||||
|
||||
|
||||
Harvard architectures (AVR)
|
||||
|
||||
Reference in New Issue
Block a user