1module Platform.AArch64.Descriptor
2
3import Compiler.MachineAArch64
4import Compiler.MachineAArch64Assembly
5
6-- AAPCS64 twin of Runtime.NativeDescriptor: x0 input/result, x6 scratch.
7-- The sign check preserves kernel errno before the unsigned INT_MAX bound.
8-- No callee-saved or interpreter registers are touched.
9def aarch64DescriptorAssembly =
10 (constructor
11 AArch64Assembly
12 AArch64AssemblyEmit
13 (constructor
14 AArch64Instruction
15 AArch64CompareImmediate
16 (constructor AArch64Register AArch64X0)
17 0)
18 (constructor
19 AArch64Assembly
20 AArch64AssemblyBranchIf
21 (constructor AArch64Condition AArch64Minus)
22 b"return"
23 (constructor
24 AArch64Assembly
25 AArch64AssemblyEmit
26 (constructor
27 AArch64Instruction
28 AArch64MoveWideZero
29 (constructor AArch64Register AArch64X6)
30 65535
31 (constructor AArch64HalfwordShift AArch64Shift0))
32 (constructor
33 AArch64Assembly
34 AArch64AssemblyEmit
35 (constructor
36 AArch64Instruction
37 AArch64MoveWideKeep
38 (constructor AArch64Register AArch64X6)
39 32767
40 (constructor AArch64HalfwordShift AArch64Shift16))
41 (constructor
42 AArch64Assembly
43 AArch64AssemblyEmit
44 (constructor
45 AArch64Instruction
46 AArch64CompareRegister
47 (constructor AArch64Register AArch64X0)
48 (constructor AArch64Register AArch64X6))
49 (constructor
50 AArch64Assembly
51 AArch64AssemblyBranchIf
52 (constructor AArch64Condition AArch64UnsignedHigher)
53 b"invalid"
54 (constructor
55 AArch64Assembly
56 AArch64AssemblyEmit
57 (constructor
58 AArch64Instruction
59 AArch64MoveWideZero
60 (constructor AArch64Register AArch64X0)
61 0
62 (constructor AArch64HalfwordShift AArch64Shift0))
63 (constructor
64 AArch64Assembly
65 AArch64AssemblyBranch
66 b"return"
67 (constructor
68 AArch64Assembly
69 AArch64AssemblyLabel
70 b"invalid"
71 (constructor
72 AArch64Assembly
73 AArch64AssemblyEmit
74 (constructor
75 AArch64Instruction
76 AArch64MoveWideZero
77 (constructor AArch64Register AArch64X0)
78 0
79 (constructor AArch64HalfwordShift AArch64Shift0))
80 (constructor
81 AArch64Assembly
82 AArch64AssemblyEmit
83 (constructor
84 AArch64Instruction
85 AArch64MoveWideZero
86 (constructor AArch64Register AArch64X6)
87 22
88 (constructor AArch64HalfwordShift AArch64Shift0))
89 (constructor
90 AArch64Assembly
91 AArch64AssemblyEmit
92 (constructor
93 AArch64Instruction
94 AArch64SubtractRegister
95 (constructor AArch64Register AArch64X0)
96 (constructor AArch64Register AArch64X0)
97 (constructor AArch64Register AArch64X6))
98 (constructor
99 AArch64Assembly
100 AArch64AssemblyLabel
101 b"return"
102 (constructor
103 AArch64Assembly
104 AArch64AssemblyEmit
105 (constructor AArch64Instruction AArch64Return)
106 (constructor AArch64Assembly AArch64AssemblyEnd)))))))))))))))
107
108def aarch64DescriptorCode : Bytes =
109 (eliminate
110 AArch64AssemblyResult
111 (lambda unrestricted current : (family AArch64AssemblyResult) . Bytes)
112 (aarch64Assemble aarch64DescriptorAssembly)
113 (branch AArch64AssemblyEncoded code . code)
114 (branch AArch64AssemblyEncodeDuplicateLabel name . b"")
115 (branch AArch64AssemblyMissingLabel name . b"")
116 (branch AArch64AssemblyDisplacementOutOfRange name . b"")
117 (branch AArch64AssemblyOperandRefused value . b""))The compiler supplied declaration spans and resolved links from this source snapshot. This page does not assert that this file belongs to a checked closure.