mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-09 05:23:40 +00:00
Copy printfloat() from original runtime
I've tried writing my own, but I couldn't make it correct in all cases. So just copy the one from upstream for now, hopefully to be replaced at some point. TODO: add a printfloat32() implementation, now it just casts to float64. This will be useful for embedded systems that sometimes have float32 but not float64.
This commit is contained in:
@@ -1303,6 +1303,10 @@ func (c *Compiler) parseBuiltin(frame *Frame, args []ssa.Value, callName string)
|
||||
c.builder.CreateCall(fn, []llvm.Value{value}, "")
|
||||
} else if typ.Kind() == types.Bool {
|
||||
c.builder.CreateCall(c.mod.NamedFunction("runtime.printbool"), []llvm.Value{value}, "")
|
||||
} else if typ.Kind() == types.Float32 {
|
||||
c.builder.CreateCall(c.mod.NamedFunction("runtime.printfloat32"), []llvm.Value{value}, "")
|
||||
} else if typ.Kind() == types.Float64 {
|
||||
c.builder.CreateCall(c.mod.NamedFunction("runtime.printfloat64"), []llvm.Value{value}, "")
|
||||
} else {
|
||||
return llvm.Value{}, errors.New("unknown basic arg type: " + typ.String())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user