Appearance
| 1 | namespace IR is | |
| 2 | use Semantic.Symbols.Symbol | |
| 3 | use Semantic.Symbols.Classy | |
| 4 | use Semantic.Symbols.Function | |
| 5 | ||
| 6 | // Where generated code goes. Generate-il builds each body as IR | |
| 7 | // values and hands them here; the backend decides what they become | |
| 8 | // and where the result is kept. | |
| 9 | // | |
| 10 | // Bodies nest: a closure's body is begun while the body of the | |
| 11 | // function containing it is still open, and ending the inner body | |
| 12 | // goes back to the outer one. A body is finished against whatever | |
| 13 | // it belongs to before it is ended, and is ended whether or not it | |
| 14 | // was finished. | |
| 15 | trait Backend open is | |
| 16 | // Starts a module of this name and version, written as a library | |
| 17 | // or as an executable. | |
| 18 | install(module_name: string, module_version: string, want_library: bool) | |
| 19 | ||
| 20 | // Starts the module again, after the symbols what was generated | |
| 21 | // names have been abandoned. | |
| 22 | reset() | |
| 23 | ||
| 24 | // Called once before the first body is begun. | |
| 25 | begin_assembly() | |
| 26 | ||
| 27 | // Called once after the last body has ended, when nothing has | |
| 28 | // been reported against the build. | |
| 29 | end_assembly() | |
| 30 | ||
| 31 | add_resource(name: string, content: ubyte[]) | |
| 32 | ||
| 33 | write(path: string) | |
| 34 | ||
| 35 | begin_body() | |
| 36 | ||
| 37 | // A body whose values name types in the terms of a member other | |
| 38 | // than the one the enclosing body belongs to, such as a closure | |
| 39 | // reading its own type parameters. | |
| 40 | begin_body(member: Symbol) | |
| 41 | ||
| 42 | write(value: Values.Value) | |
| 43 | ||
| 44 | finish_body(function: Function) | |
| 45 | ||
| 46 | finish_frame_member_body(frame: Classy, member: FrameMember) | |
| 47 | ||
| 48 | finish_unit_variant_initializer(variant: Classy) | |
| 49 | ||
| 50 | end_body() | |
| 51 | ||
| 52 | // Drops every body still open, after a failure that unwound | |
| 53 | // past the ends of the bodies it began. | |
| 54 | abandon_bodies() | |
| 55 | ||
| 56 | // Whether the variant has a single shared instance for its | |
| 57 | // initializer to create. | |
| 58 | has_unit_variant_instance(variant: Classy) -> bool | |
| 59 | ||
| 60 | // The function the program starts at. | |
| 61 | mark_entry_point(function: Function) | |
| 62 | si | |
| 63 | si |