compiler: implement const pointers from integers

These raw pointers are used for memory-mapped IO.
Этот коммит содержится в:
Ayke van Laethem 2018-09-05 11:15:33 +02:00
родитель ce71d18450
коммит 7258553528
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: E97FF5335DFDFDED

Просмотреть файл

@ -2414,7 +2414,8 @@ func (c *Compiler) parseConst(expr *ssa.Const) (llvm.Value, error) {
return strObj, nil
} else if typ.Kind() == types.UnsafePointer {
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
} else if typ.Info()&types.IsUnsigned != 0 {