Skip to content
← Back

src/ir/values/call/global.ghul

1
namespace IR.Values.Call is
2
use TypeTyped = Semantic.Types.Typed
3
use Semantic.Types.Type
4
5
class GLOBAL: Value, TypeTyped is
6
is_state_changing_call: bool => !function.is_store_free
7
function: Semantic.Symbols.Function
8
arguments: Collections.List[Value]
9
type: Type
10
11
init(function: Semantic.Symbols.Function, arguments: Collections.List[Value], type: Type?) is
12
super.init()
13
14
self.function = function
15
self.arguments = arguments
16
17
if type? then
18
self.type = type
19
else
20
self.type = function.return_type!
21
fi
22
23
si
24
25
gen(context: IR.CONTEXT) is
26
for a in arguments do
27
gen(a, context)
28
od
29
30
let body = context.current_srm_body_emitter!
31
body.call(context.resolve_call_target(function))
32
si
33
34
to_string() -> string =>
35
"global-call:[{type}](\"{function.name}\",{arguments})"
36
si
37
si