Skip to content

Commit a36ebd5

Browse files
committed
HACK: insert 'main' function at ty(-1) into functions map
1 parent 510de16 commit a36ebd5

File tree

1 file changed

+8
-1
lines changed
  • kmir/src/kmir/kdist/mir-semantics

1 file changed

+8
-1
lines changed

kmir/src/kmir/kdist/mir-semantics/kmir.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,14 @@ The function _names_ and _ids_ are not relevant for calls and therefore dropped.
136136
| #accumFunctions ( Map, Map, FunctionNames ) [ function, total ]
137137
| #accumItems ( Map, MonoItems ) [ function, total ]
138138
139-
rule #mkFunctionMap(Functions, Items) => #accumFunctions(.Map, #accumItems(.Map, Items), Functions)
139+
rule #mkFunctionMap(Functions, Items)
140+
=>
141+
#accumFunctions(#mainIsMinusOne(Items), #accumItems(.Map, Items), Functions)
142+
// ^^^^^^^^^^^^^^^^^^^^^^ Adds "main" as function with ty(-1)
143+
144+
syntax Map ::= #mainIsMinusOne(MonoItems) [function]
145+
146+
rule #mainIsMinusOne(ITEMS) => ty(-1) |-> #findMainItem(ITEMS)
140147
141148
// accumulate map of symbol_name -> function (MonoItemFn), discarding duplicate IDs
142149
rule #accumItems(Acc, .MonoItems) => Acc

0 commit comments

Comments
 (0)