mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-18 19:44:00 +00:00
compiler: implement const pointers from integers
These raw pointers are used for memory-mapped IO.
This commit is contained in:
+2
-1
@@ -2414,7 +2414,8 @@ func (c *Compiler) parseConst(expr *ssa.Const) (llvm.Value, error) {
|
|||||||
return strObj, nil
|
return strObj, nil
|
||||||
} else if typ.Kind() == types.UnsafePointer {
|
} else if typ.Kind() == types.UnsafePointer {
|
||||||
if !expr.IsNil() {
|
if !expr.IsNil() {
|
||||||
return llvm.Value{}, errors.New("todo: non-null constant pointer")
|
value, _ := constant.Uint64Val(expr.Value)
|
||||||
|
return llvm.ConstIntToPtr(llvm.ConstInt(c.uintptrType, value, false), c.i8ptrType), nil
|
||||||
}
|
}
|
||||||
return llvm.ConstNull(c.i8ptrType), nil
|
return llvm.ConstNull(c.i8ptrType), nil
|
||||||
} else if typ.Info()&types.IsUnsigned != 0 {
|
} else if typ.Info()&types.IsUnsigned != 0 {
|
||||||
|
|||||||
Reference in New Issue
Block a user