-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTargetInfo.ts
35 lines (30 loc) · 1.17 KB
/
TargetInfo.ts
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
import { Statement } from './targetCode/Statement';
import { Function } from './threeAddressCode/Function';
// These functions tend to have platform specific implementations. Put your platforms implementation here.
export type TargetFunctionImpls = {
mallocImpl: Function;
printImpl: Function;
readIntImpl: Function;
};
export type RegisterAgnosticTargetInfo = {
functionImpls: TargetFunctionImpls;
bytesInWord: number;
syscallNumbers: any;
};
export type TargetRegisters<TargetRegister> = {
generalPurpose: TargetRegister[];
functionArgument: TargetRegister[];
functionResult: TargetRegister;
syscallArgument: TargetRegister[];
syscallSelectAndResult: TargetRegister;
};
// A function that turns target code in to an assembly string
export type ExeTranslator<TargetRegister> = (tas: Statement<TargetRegister>) => string[];
export type TargetInfo<TargetRegister> = {
registerAgnosticInfo: RegisterAgnosticTargetInfo;
registers: TargetRegisters<TargetRegister>;
extraSavedRegisters: TargetRegister[];
callerSavedRegisters: string[];
registersClobberedBySyscall: TargetRegister[];
translator: ExeTranslator<TargetRegister>;
};