-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathfunction.ts
More file actions
56 lines (52 loc) · 1.41 KB
/
function.ts
File metadata and controls
56 lines (52 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import type * as Ast from "#ast";
import type { Type } from "./type.js";
import type { Block } from "./block.js";
/**
* Ir function containing basic blocks
*/
export interface Function {
/** Function name (for debugging) */
name: string;
/** Function parameters as temps (in SSA form) */
parameters: Function.Parameter[];
/** Entry block ID */
entry: string;
/** All basic blocks in the function */
blocks: Map<string, Block>;
/** SSA variable metadata mapping temp IDs to original variables */
ssaVariables?: Map<string, Function.SsaVariable>;
/** Source location of the function body */
loc?: Ast.SourceLocation;
/** Source identifier for debug info */
sourceId?: string;
}
export namespace Function {
/**
* Function parameter in SSA form
*/
export interface Parameter {
/** Parameter name (for debugging) */
name: string;
/** Parameter type */
type: Type;
/** Temp ID for this parameter */
tempId: string;
/** Source location of declaration */
loc?: Ast.SourceLocation;
}
/**
* SSA variable metadata
*/
export interface SsaVariable {
/** Original variable name */
name: string;
/** Scope identifier (to handle shadowing) */
scopeId: string;
/** Type of the variable */
type: Type;
/** Version number for this SSA instance */
version: number;
/** Source location of declaration */
loc?: Ast.SourceLocation;
}
}