cl/instr:only permit interger at asmfull
This commit is contained in:
21
cl/instr.go
21
cl/instr.go
@@ -133,9 +133,24 @@ func (p *context) asmFull(b llssa.Builder, args []ssa.Value) (ret llssa.Expr) {
|
|||||||
panic("asmFull: register not found: " + name)
|
panic("asmFull: register not found: " + name)
|
||||||
}
|
}
|
||||||
if _, ok := registerNumbers[name]; !ok {
|
if _, ok := registerNumbers[name]; !ok {
|
||||||
registerNumbers[name] = len(registerNumbers)
|
// Type checking based on Go types - similar to TinyGo's implementation
|
||||||
inputValues = append(inputValues, value)
|
rawType := value.Type.RawType()
|
||||||
constraints = append(constraints, "r")
|
switch typ := rawType.Underlying().(type) {
|
||||||
|
case *types.Basic:
|
||||||
|
if typ.Info()&types.IsInteger != 0 {
|
||||||
|
registerNumbers[name] = len(registerNumbers)
|
||||||
|
inputValues = append(inputValues, value)
|
||||||
|
constraints = append(constraints, "r")
|
||||||
|
} else {
|
||||||
|
panic("asmFull: unsupported basic type in inline assembly for operand: " + name + ", only integer types are supported")
|
||||||
|
}
|
||||||
|
case *types.Pointer:
|
||||||
|
// Pointer operands support was dropped, following TinyGo 0.23
|
||||||
|
panic("asmFull: not support for pointer operands: " + name + ", only integer types are supported")
|
||||||
|
default:
|
||||||
|
panic("asmFull: unsupported type in inline assembly for operand: " + name + ", only integer types are supported")
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("${%v}", registerNumbers[name])
|
return fmt.Sprintf("${%v}", registerNumbers[name])
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user