@@ -3,28 +3,25 @@ package compiler
3
3
// This file implements volatile loads/stores in runtime/volatile.LoadT and
4
4
// runtime/volatile.StoreT as compiler builtins.
5
5
6
- import (
7
- "golang.org/x/tools/go/ssa"
8
- "tinygo.org/x/go-llvm"
9
- )
10
-
11
6
// createVolatileLoad is the implementation of the intrinsic function
12
7
// runtime/volatile.LoadT().
13
- func (b * builder ) createVolatileLoad (instr * ssa.CallCommon ) (llvm.Value , error ) {
14
- addr := b .getValue (instr .Args [0 ])
15
- b .createNilCheck (instr .Args [0 ], addr , "deref" )
8
+ func (b * builder ) createVolatileLoad () {
9
+ b .createFunctionStart ()
10
+ addr := b .getValue (b .fn .Params [0 ])
11
+ b .createNilCheck (b .fn .Params [0 ], addr , "deref" )
16
12
val := b .CreateLoad (addr , "" )
17
13
val .SetVolatile (true )
18
- return val , nil
14
+ b . CreateRet ( val )
19
15
}
20
16
21
17
// createVolatileStore is the implementation of the intrinsic function
22
18
// runtime/volatile.StoreT().
23
- func (b * builder ) createVolatileStore (instr * ssa.CallCommon ) (llvm.Value , error ) {
24
- addr := b .getValue (instr .Args [0 ])
25
- val := b .getValue (instr .Args [1 ])
26
- b .createNilCheck (instr .Args [0 ], addr , "deref" )
19
+ func (b * builder ) createVolatileStore () {
20
+ b .createFunctionStart ()
21
+ addr := b .getValue (b .fn .Params [0 ])
22
+ val := b .getValue (b .fn .Params [1 ])
23
+ b .createNilCheck (b .fn .Params [0 ], addr , "deref" )
27
24
store := b .CreateStore (val , addr )
28
25
store .SetVolatile (true )
29
- return llvm. Value {}, nil
26
+ b . CreateRetVoid ()
30
27
}
0 commit comments