mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-07 12:33:42 +00:00
compiler: add support for parameters to inline assembly
This commit is contained in:
+17
-4
@@ -33,13 +33,26 @@ import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// Run the given assembly code. The code will be marked as having side effects,
|
||||
// as it doesn't produce output and thus would normally be eliminated by the
|
||||
// optimizer.
|
||||
func Asm(asm string)
|
||||
|
||||
// Run the given inline assembly. The code will be marked as having side
|
||||
// effects, as it would otherwise be optimized away. The inline assembly string
|
||||
// recognizes template values in the form {name}, like so:
|
||||
//
|
||||
// arm.AsmFull(
|
||||
// "str {value}, {result}",
|
||||
// map[string]interface{}{
|
||||
// "value": 1
|
||||
// "result": &dest,
|
||||
// })
|
||||
func AsmFull(asm string, regs map[string]interface{})
|
||||
|
||||
//go:volatile
|
||||
type RegValue uint32
|
||||
|
||||
type __asm string
|
||||
|
||||
func Asm(s __asm)
|
||||
|
||||
const (
|
||||
SCS_BASE = 0xE000E000
|
||||
NVIC_BASE = SCS_BASE + 0x0100
|
||||
|
||||
+13
-4
@@ -1,9 +1,18 @@
|
||||
package avr
|
||||
|
||||
// Magic type recognozed by the compiler to mark this string as inline assembly.
|
||||
type __asm string
|
||||
|
||||
// Run the given assembly code. The code will be marked as having side effects,
|
||||
// as it doesn't produce output and thus would normally be eliminated by the
|
||||
// optimizer.
|
||||
func Asm(asm __asm)
|
||||
func Asm(asm string)
|
||||
|
||||
// Run the given inline assembly. The code will be marked as having side
|
||||
// effects, as it would otherwise be optimized away. The inline assembly string
|
||||
// recognizes template values in the form {name}, like so:
|
||||
//
|
||||
// avr.AsmFull(
|
||||
// "str {value}, {result}",
|
||||
// map[string]interface{}{
|
||||
// "value": 1
|
||||
// "result": &dest,
|
||||
// })
|
||||
func AsmFull(asm string, regs map[string]interface{})
|
||||
|
||||
Reference in New Issue
Block a user