mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-08 13:03:39 +00:00
all: change special type __volatile to pragma //go:volatile
This is one step towards removing unnecessary special casts in most cases. It is also part of removing as much magic as possible from the compiler (the pragma is explicit, the special name is not).
This commit is contained in:
@@ -1528,9 +1528,8 @@ func (c *Compiler) parseInstr(frame *Frame, instr ssa.Instruction) error {
|
||||
}
|
||||
store := c.builder.CreateStore(llvmVal, llvmAddr)
|
||||
valType := instr.Addr.Type().(*types.Pointer).Elem()
|
||||
if valType, ok := valType.(*types.Named); ok && valType.Obj().Name() == "__volatile" {
|
||||
// Magic type name to make this store volatile, for memory-mapped
|
||||
// registers.
|
||||
if c.ir.IsVolatile(valType) {
|
||||
// Volatile store, for memory-mapped registers.
|
||||
store.SetVolatile(true)
|
||||
}
|
||||
return nil
|
||||
@@ -3040,9 +3039,8 @@ func (c *Compiler) parseUnOp(frame *Frame, unop *ssa.UnOp) (llvm.Value, error) {
|
||||
case token.MUL: // *x, dereference pointer
|
||||
valType := unop.X.Type().(*types.Pointer).Elem()
|
||||
load := c.builder.CreateLoad(x, "")
|
||||
if valType, ok := valType.(*types.Named); ok && valType.Obj().Name() == "__volatile" {
|
||||
// Magic type name to make this load volatile, for memory-mapped
|
||||
// registers.
|
||||
if c.ir.IsVolatile(valType) {
|
||||
// Volatile load, for memory-mapped registers.
|
||||
load.SetVolatile(true)
|
||||
}
|
||||
return load, nil
|
||||
|
||||
Reference in New Issue
Block a user