codegen: introduce gen_mov and use it instead of explicit coding
[ajla.git] / scripts / consts.txt
blobf87ecb2465ef3d6f64386273b162ed47ba3c6b99
1 ; Copyright (C) 2024 Mikulas Patocka
3 ; This file is part of Ajla.
5 ; Ajla is free software: you can redistribute it and/or modify it under the
6 ; terms of the GNU General Public License as published by the Free Software
7 ; Foundation, either version 3 of the License, or (at your option) any later
8 ; version.
10 ; Ajla is distributed in the hope that it will be useful, but WITHOUT ANY
11 ; WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 ; A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14 ; You should have received a copy of the GNU General Public License along with
15 ; Ajla. If not, see <https://www.gnu.org/licenses/>.
17 P_BinaryOp              ; op, result, (ref_flag1, strict flag), src1, (ref_flag2), src2
18 P_UnaryOp               ; op, result, (ref_flag, strict_flag), src
19 P_Copy                  ; dest, ref_flag, src
20 P_Copy_Type_Cast        ; dest, def_flag, src
21 P_Free                  ; var
22 P_Eval                  ; var
23 P_Keep                  ; var
24 P_Fn                    ; result, n_args, n_return_values, args..., return_values...
25 P_Load_Local_Type       ; result, function var (-1 if we are referring to record entries), index
26 P_Load_Fn               ; result, n_curried_args, call_mode, [path_idx, fn_idx, n_unit_chars, (unit_name)], (ref_flag, arg_idx)
27 P_Curry                 ; result, n_curried_args, ref_flag, function, (ref_flag, arg_idx)
28 P_Call                  ; call_mode, n_return_values, n_args, [path_idx, fn_idx, n_unit_chars, (unit_name)], (ref_flag, arg_idx), (return_value_idx)
29 P_Call_Indirect         ; call_mode, n_return_values, n_args, ref_flag, function, (ref_flag, arg_idx), (return_value_idx)
30 P_Load_Const            ; result, n_bytes, lsb...msb
31 P_Structured_Write      ; n_steps, structured_result, ref_flag, structured_struct, ref_flag, scalar, ...        (Structured_Record, local_type, idx) | (Structured_Option, idx) | (Structured_Array, idx, local_type)
32 P_Record_Type           ; result, n_entries, (entries), [path_idx, fn_idx, n_unit_chars, (unit_name)]
33 P_Option_Type           ; result, n_entries, (entries), [path_idx, fn_idx, n_unit_chars, (unit_name)]
34 P_Record_Create         ; result, n_args, (ref_flag, arg_idx)
35 P_Record_Load_Slot      ; scalar, record, slot
36 P_Record_Load           ; scalar, Flag_Evaluate | Flag_Borrow, record, slot
37 P_Option_Create         ; result, index, ref_flag, value
38 P_Option_Load           ; scalar, Flag_Evaluate | Flag_Borrow, option, index
39 P_Option_Test           ; result, option, index
40 P_Option_Ord            ; result, option
41 P_Array_Flexible        ; result, type
42 P_Array_Fixed           ; result, type, dim_var
43 P_Array_Create          ; result, local_type, length, length_var, (ref_flag, arg_idx)
44 P_Array_Fill            ; result, local_type, (ref_flag | sparse_flag), content_var, length_var
45 P_Array_String          ; result, n_chars, (chars)
46 P_Array_Unicode         ; result, (chars)
47 P_Array_Load            ; scalar, Flag_Evaluate | Flag_Borrow | Flag_Index_In_Range, array, index
48 P_Array_Len             ; result, array, Flag_Evaluate
49 P_Array_Len_Greater_Than        ; result, array, length, Flag_Evaluate
50 P_Array_Sub             ; result, (ref_flag | Flag_Evaluate), array, start, end
51 P_Array_Skip            ; result, (ref_flag | Flag_Evaluate), array, start
52 P_Array_Append          ; result, (ref_flag, arg1), (ref_flag, arg2)
53 P_Array_Append_One      ; result, (ref_flag, arg1), (ref_flag, arg2)
54 P_Array_Flatten         ; result, (ref_flag, arg1)
55 P_Jmp                   ; label
56 P_Jmp_False             ; variable, label if false, label if exception
57 P_Label                 ; label
58 P_IO                    ; io_type, n_outputs, n_inputs, n_params, outputs, inputs, params
59 P_Args                  ; (arg ...)
60 P_Return_Vars           ; (ret ...)
61 P_Return                ; ((ref_flag, arg) ...)
62 P_Checkpoint            ; (must-be-flat-var ...)
63 P_Line_Info             ; line_number
64 P_Phi                   ; result, (arg ...)
65 P_Pcode_N
68 T_Type
69 T_SInt8
70 T_UInt8
71 T_SInt16
72 T_UInt16
73 T_SInt32
74 T_UInt32
75 T_SInt64
76 T_UInt64
77 T_SInt128
78 T_UInt128
79 T_Integer
80 T_Integer8
81 T_Integer16
82 T_Integer32
83 T_Integer64
84 T_Integer128
85 T_Real16
86 T_Real32
87 T_Real64
88 T_Real80
89 T_Real128
90 T_EmptyOption   ; used in option declaration for typeless fields
91 T_FlatOption    ; these are used in variable runtime types
92 T_Undetermined  ; this must be the last type that may appear as runtime type in pcode
93 T_TypeOfType    ; these are not used in pcode
94 T_Record
95 T_UnknownType
96 T_InvalidType
97 T_InferredType  ; this must have the lowest number
100 Structured_Record
101 Structured_Option
102 Structured_Array
105 VarFlag_Must_Be_Flat
108 Flag_Free_Argument
109 Flag_Evaluate
110 Flag_Borrow
111 Flag_Array_Fill_Sparse
112 Flag_Op_Strict
113 Flag_Return_Elided
114 Flag_Index_In_Range
117 Bin_Add
118 Bin_Subtract
119 Bin_Multiply
120 Bin_Divide_Int
121 Bin_Divide_Real
122 Bin_Modulo
123 Bin_Power
124 Bin_Atan2
125 Bin_And
126 Bin_Or
127 Bin_Xor
128 Bin_Shl
129 Bin_Shr
130 Bin_Rol
131 Bin_Ror
132 Bin_Bts
133 Bin_Btr
134 Bin_Btc
135 Bin_Equal
136 Bin_NotEqual
137 Bin_Less
138 Bin_LessEqual
139 Bin_Bt
140 Un_Not
141 Un_Neg
142 Un_Inc
143 Un_Dec
144 Un_Bswap
145 Un_Brev
146 Un_Bsf
147 Un_Bsr
148 Un_Popcnt
149 Un_Sqrt
150 Un_Cbrt
151 Un_Sin
152 Un_Cos
153 Un_Tan
154 Un_Asin
155 Un_Acos
156 Un_Atan
157 Un_Sinh
158 Un_Cosh
159 Un_Tanh
160 Un_Asinh
161 Un_Acosh
162 Un_Atanh
163 Un_Exp2
164 Un_Exp
165 Un_Exp10
166 Un_Log2
167 Un_Log
168 Un_Log10
169 Un_Round
170 Un_Floor
171 Un_Ceil
172 Un_Trunc
173 Un_Fract
174 Un_Mantissa
175 Un_Exponent
176 Un_NextNumber
177 Un_PrevNumber
178 Un_ConvertToInt
179 Un_ConvertFromInt
180 Un_IsException
181 Un_ExceptionClass
182 Un_ExceptionType
183 Un_ExceptionAux
184 Un_SystemProperty
185 Op_N
188 Fn_Function
189 Fn_Record
190 Fn_Option
192 Fn_Mask
195 Local_Type_Record
196 Local_Type_Flat_Record
197 Local_Type_Flat_Array
200 Call_Mode_Unspecified
201 Call_Mode_Normal
202 Call_Mode_Strict
203 Call_Mode_Spark
204 Call_Mode_Lazy
205 Call_Mode_Inline
206 Call_Mode_Cache
207 Call_Mode_Save
208 Call_Mode_Type
209 Call_Mode_Flat
212 SystemProperty_OS
213 SystemProperty_Charset
214 SystemProperty_Charset_Console
215 SystemProperty_Fixed
216 SystemProperty_Real
217 SystemProperty_Privileged
218 SystemProperty_Compile
221 SystemProperty_OS_Posix
222 SystemProperty_OS_DOS
223 SystemProperty_OS_OS2
224 SystemProperty_OS_Cygwin
225 SystemProperty_OS_Windows
228 IO_Exception_Make
229 IO_Exception_String
230 IO_Exception_Payload
231 IO_Exception_Stack
232 IO_N_Std_Handles
233 IO_Get_Std_Handle
234 IO_Get_Args
235 IO_Get_Environment
236 IO_Stream_Open_Read
237 IO_Stream_Read_Partial
238 IO_Stream_Open_Write
239 IO_Stream_Write
240 IO_Read_Console_Packet
241 IO_Write_Console_Packet
242 IO_Pipe
243 IO_Block_Open
244 IO_Block_Read
245 IO_Block_Write
246 IO_LSeek
247 IO_FTruncate
248 IO_FAllocate
249 IO_CloneRange
250 IO_FSync
251 IO_Sync
252 IO_Root_Dir
253 IO_Lib_Path
254 IO_Open_Dir
255 IO_Read_Dir
256 IO_Dir_Path
257 IO_DMonitor_Prepare
258 IO_DMonitor_Wait
259 IO_Stat
260 IO_FStat
261 IO_FStatFS
262 IO_DStatFS
263 IO_ReadLink
264 IO_Dir_Action
265 IO_Dir2_Action
266 IO_Drives
267 IO_Stty
268 IO_Tty_Size
269 IO_Tty_Background
270 IO_Tty_Foreground
271 IO_UName
272 IO_GetHostName
273 IO_Spawn
274 IO_Wait
275 IO_GetTime
276 IO_TimeToCalendar
277 IO_CalendarToTime
278 IO_Sleep
279 IO_Any
280 IO_Never
281 IO_Fork
282 IO_Atomic_Enter
283 IO_Atomic_Exit
284 IO_Wait_For_Dereferenced
285 IO_Int_To_Native
286 IO_Native_To_Int
287 IO_Socket
288 IO_Connect
289 IO_Connect_Wait
290 IO_Bind
291 IO_Listen
292 IO_Accept
293 IO_Get_Sock_Name
294 IO_Get_Peer_Name
295 IO_Recv_From
296 IO_Send_To
297 IO_Get_Sock_Opt
298 IO_Set_Sock_Opt
299 IO_Get_Addr_Info
300 IO_Get_Name_Info
301 IO_MsgQueue_New
302 IO_MsgQueue_Send
303 IO_MsgQueue_Receive
304 IO_MsgQueue_Wait
305 IO_MsgQueue_Is_Nonempty
306 IO_Signal_Handle
307 IO_Signal_Prepare
308 IO_Signal_Wait
309 IO_Consume_Parameters
310 IO_Load_Program
311 IO_Get_Function_Ptr
312 IO_Get_SubFunctions
313 IO_Load_Optimized_Pcode
314 IO_Register_Dependence
315 IO_Deep_Eval
316 IO_Evaluate
317 IO_Debug
318 IO_StackTrace
319 IO_TraceCtl
320 IO_FFI_Get_Size_Alignment
321 IO_FFI_Create_Structure
322 IO_FFI_Structure_Offset
323 IO_FFI_Poke
324 IO_FFI_Peek
325 IO_FFI_Poke_Array
326 IO_FFI_Peek_Array
327 IO_FFI_Handle_To_Number
328 IO_FFI_Number_To_Handle
329 IO_FFI_Create_Function
330 IO_FFI_Call_Function
331 IO_FFI_Encode_Real
332 IO_FFI_Decode_Real
333 IO_FFI_Destructor_New
334 IO_FFI_Destructor_Allocate
335 IO_FFI_Destructor_Free
336 IO_FFI_Destructor_Call
337 IO_N
340 IO_Open_Flag_Read
341 IO_Open_Flag_Write
342 IO_Open_Flag_Append
343 IO_Open_Flag_Create
344 IO_Open_Flag_Must_Create
345 IO_Open_Flag_No_Follow
346 IO_Open_Flag_N
349 IO_Stat_Flag_DevMajor
350 IO_Stat_Flag_DevMinor
351 IO_Stat_Flag_Inode
352 IO_Stat_Flag_Type
353 IO_Stat_Flag_Mode
354 IO_Stat_Flag_NLink
355 IO_Stat_Flag_UID
356 IO_Stat_Flag_GID
357 IO_Stat_Flag_RDevMajor
358 IO_Stat_Flag_RDevMinor
359 IO_Stat_Flag_Size
360 IO_Stat_Flag_OptimalIOSize
361 IO_Stat_Flag_Allocated
362 IO_Stat_Flag_ATime
363 IO_Stat_Flag_MTime
364 IO_Stat_Flag_CTime
367 IO_Stat_Type_File
368 IO_Stat_Type_Directory
369 IO_Stat_Type_Link
370 IO_Stat_Type_Pipe
371 IO_Stat_Type_CharDev
372 IO_Stat_Type_BlockDev
373 IO_Stat_Type_Socket
376 IO_StatFS_Flag_BSize
377 IO_StatFS_Flag_FrSize
378 IO_StatFS_Flag_FrTotal
379 IO_StatFS_Flag_FrFree
380 IO_StatFS_Flag_FrAvail
381 IO_StatFS_Flag_InTotal
382 IO_StatFS_Flag_InFree
383 IO_StatFS_Flag_InAvail
384 IO_StatFS_Flag_FSId
385 IO_StatFS_Flag_Flags
386 IO_StatFS_Flag_NameLen
389 IO_StatFS_ST_ReadOnly
390 IO_StatFS_ST_NoSuid
391 IO_StatFS_ST_NoDev
392 IO_StatFS_ST_NoExec
393 IO_StatFS_ST_Synchronous
394 IO_StatFS_ST_MandLock
395 IO_StatFS_ST_NoAtime
396 IO_StatFS_ST_NoDirAtime
397 IO_StatFS_ST_RelAtime
400 IO_UName_Flag_Ajla_Version
401 IO_UName_Flag_Flavor
402 IO_UName_Flag_System
403 IO_UName_Flag_Release
404 IO_UName_Flag_Version
405 IO_UName_Flag_Machine
408 IO_Action_Rm
409 IO_Action_Rm_Dir
410 IO_Action_Mk_Dir
411 IO_Action_Mk_Pipe
412 IO_Action_Mk_Socket
413 IO_Action_Mk_CharDev
414 IO_Action_Mk_BlockDev
415 IO_Action_Mk_SymLink
416 IO_Action_Mk_Link
417 IO_Action_Rename
418 IO_Action_ChMod
419 IO_Action_ChOwn
420 IO_Action_LChOwn
421 IO_Action_UTime
422 IO_Action_LUTime
425 IO_Stty_Flag_Raw
426 IO_Stty_Flag_Noecho
427 IO_Stty_Flag_Nosignal
428 IO_Stty_Flag_NoCRLF
431 EC_NONE
432 EC_SYNC
433 EC_ASYNC
434 EC_SYSCALL
435 EC_EXIT
436 EC_N
439 AJLA_ERROR_BASE
441 AJLA_ERROR_UNKNOWN_ERROR
442 AJLA_ERROR_OUT_OF_MEMORY
443 AJLA_ERROR_SIZE_OVERFLOW
444 AJLA_ERROR_INT_TOO_LARGE
445 AJLA_ERROR_DOESNT_FIT
446 AJLA_ERROR_INVALID_OPERATION
447 AJLA_ERROR_NOT_SUPPORTED
448 AJLA_ERROR_NEGATIVE_INDEX
449 AJLA_ERROR_INDEX_OUT_OF_RANGE
450 AJLA_ERROR_OPTION_DOESNT_MATCH
451 AJLA_ERROR_RECORD_FIELD_NOT_INITIALIZED
452 AJLA_ERROR_ARRAY_ENTRY_NOT_INITIALIZED
453 AJLA_ERROR_NOT_FOUND
454 AJLA_ERROR_NON_ABSOLUTE_PATH
455 AJLA_ERROR_ABORT
456 AJLA_ERROR_NAN
457 AJLA_ERROR_INFINITY
458 AJLA_ERROR_SYSTEM_RETURNED_INVALID_DATA
459 AJLA_ERROR_COMPILER_ERROR
460 AJLA_ERROR_OPTIMIZER_ERROR
461 AJLA_ERROR_SYSTEM
462 AJLA_ERROR_ERRNO
463 AJLA_ERROR_OS2
464 AJLA_ERROR_OS2_SOCKET
465 AJLA_ERROR_WIN32
466 AJLA_ERROR_H_ERRNO
467 AJLA_ERROR_GAI
468 AJLA_ERROR_SUBPROCESS
469 AJLA_ERROR_LIBRARY_NOT_FOUND
470 AJLA_ERROR_SYMBOL_NOT_FOUND
471 AJLA_ERROR_EXIT
472 AJLA_ERROR_USER
473 AJLA_ERROR_USER2
474 AJLA_ERROR_USER3
475 AJLA_ERROR_N
478 SYSTEM_ERROR_BASE
480 SYSTEM_ERROR_EPERM
481 SYSTEM_ERROR_ENOENT
482 SYSTEM_ERROR_ESRCH
483 SYSTEM_ERROR_EINTR
484 SYSTEM_ERROR_EIO
485 SYSTEM_ERROR_ENXIO
486 SYSTEM_ERROR_E2BIG
487 SYSTEM_ERROR_ENOEXEC
488 SYSTEM_ERROR_EBADF
489 SYSTEM_ERROR_ECHILD
490 SYSTEM_ERROR_EAGAIN
491 SYSTEM_ERROR_ENOMEM
492 SYSTEM_ERROR_EACCES
493 SYSTEM_ERROR_EFAULT
494 SYSTEM_ERROR_ENOTBLK
495 SYSTEM_ERROR_EBUSY
496 SYSTEM_ERROR_EEXIST
497 SYSTEM_ERROR_EXDEV
498 SYSTEM_ERROR_ENODEV
499 SYSTEM_ERROR_ENOTDIR
500 SYSTEM_ERROR_EISDIR
501 SYSTEM_ERROR_EINVAL
502 SYSTEM_ERROR_ENFILE
503 SYSTEM_ERROR_EMFILE
504 SYSTEM_ERROR_ENOTTY
505 SYSTEM_ERROR_ETXTBSY
506 SYSTEM_ERROR_EFBIG
507 SYSTEM_ERROR_ENOSPC
508 SYSTEM_ERROR_ESPIPE
509 SYSTEM_ERROR_EROFS
510 SYSTEM_ERROR_EMLINK
511 SYSTEM_ERROR_EPIPE
512 SYSTEM_ERROR_EDOM
513 SYSTEM_ERROR_ERANGE
514 SYSTEM_ERROR_EDEADLK
515 SYSTEM_ERROR_ENAMETOOLONG
516 SYSTEM_ERROR_ENOLCK
517 SYSTEM_ERROR_ENOSYS
518 SYSTEM_ERROR_ENOTEMPTY
519 SYSTEM_ERROR_ELOOP
520 SYSTEM_ERROR_ENOMSG
521 SYSTEM_ERROR_EIDRM
522 SYSTEM_ERROR_ECHRNG
523 SYSTEM_ERROR_EL2NSYNC
524 SYSTEM_ERROR_EL3HLT
525 SYSTEM_ERROR_EL3RST
526 SYSTEM_ERROR_ELNRNG
527 SYSTEM_ERROR_EUNATCH
528 SYSTEM_ERROR_ENOCSI
529 SYSTEM_ERROR_EL2HLT
530 SYSTEM_ERROR_EBADE
531 SYSTEM_ERROR_EBADR
532 SYSTEM_ERROR_EXFULL
533 SYSTEM_ERROR_ENOANO
534 SYSTEM_ERROR_EBADRQC
535 SYSTEM_ERROR_EBADSLT
536 SYSTEM_ERROR_EBFONT
537 SYSTEM_ERROR_ENOSTR
538 SYSTEM_ERROR_ENODATA
539 SYSTEM_ERROR_ETIME
540 SYSTEM_ERROR_ENOSR
541 SYSTEM_ERROR_ENONET
542 SYSTEM_ERROR_ENOPKG
543 SYSTEM_ERROR_EREMOTE
544 SYSTEM_ERROR_ENOLINK
545 SYSTEM_ERROR_EADV
546 SYSTEM_ERROR_ESRMNT
547 SYSTEM_ERROR_ECOMM
548 SYSTEM_ERROR_EPROTO
549 SYSTEM_ERROR_EMULTIHOP
550 SYSTEM_ERROR_EDOTDOT
551 SYSTEM_ERROR_EBADMSG
552 SYSTEM_ERROR_EOVERFLOW
553 SYSTEM_ERROR_ENOTUNIQ
554 SYSTEM_ERROR_EBADFD
555 SYSTEM_ERROR_EREMCHG
556 SYSTEM_ERROR_ELIBACC
557 SYSTEM_ERROR_ELIBBAD
558 SYSTEM_ERROR_ELIBSCN
559 SYSTEM_ERROR_ELIBMAX
560 SYSTEM_ERROR_ELIBEXEC
561 SYSTEM_ERROR_EILSEQ
562 SYSTEM_ERROR_ERESTART
563 SYSTEM_ERROR_ESTRPIPE
564 SYSTEM_ERROR_EUSERS
565 SYSTEM_ERROR_ENOTSOCK
566 SYSTEM_ERROR_EDESTADDRREQ
567 SYSTEM_ERROR_EMSGSIZE
568 SYSTEM_ERROR_EPROTOTYPE
569 SYSTEM_ERROR_ENOPROTOOPT
570 SYSTEM_ERROR_EPROTONOSUPPORT
571 SYSTEM_ERROR_ESOCKTNOSUPPORT
572 SYSTEM_ERROR_EOPNOTSUPP
573 SYSTEM_ERROR_EPFNOSUPPORT
574 SYSTEM_ERROR_EAFNOSUPPORT
575 SYSTEM_ERROR_EADDRINUSE
576 SYSTEM_ERROR_EADDRNOTAVAIL
577 SYSTEM_ERROR_ENETDOWN
578 SYSTEM_ERROR_ENETUNREACH
579 SYSTEM_ERROR_ENETRESET
580 SYSTEM_ERROR_ECONNABORTED
581 SYSTEM_ERROR_ECONNRESET
582 SYSTEM_ERROR_ENOBUFS
583 SYSTEM_ERROR_EISCONN
584 SYSTEM_ERROR_ENOTCONN
585 SYSTEM_ERROR_ESHUTDOWN
586 SYSTEM_ERROR_ETOOMANYREFS
587 SYSTEM_ERROR_ETIMEDOUT
588 SYSTEM_ERROR_ECONNREFUSED
589 SYSTEM_ERROR_EHOSTDOWN
590 SYSTEM_ERROR_EHOSTUNREACH
591 SYSTEM_ERROR_EALREADY
592 SYSTEM_ERROR_EINPROGRESS
593 SYSTEM_ERROR_ESTALE
594 SYSTEM_ERROR_EUCLEAN
595 SYSTEM_ERROR_ENOTNAM
596 SYSTEM_ERROR_ENAVAIL
597 SYSTEM_ERROR_EISNAM
598 SYSTEM_ERROR_EREMOTEIO
599 SYSTEM_ERROR_EDQUOT
600 SYSTEM_ERROR_ENOMEDIUM
601 SYSTEM_ERROR_EMEDIUMTYPE
602 SYSTEM_ERROR_ECANCELED
603 SYSTEM_ERROR_ENOKEY
604 SYSTEM_ERROR_EKEYEXPIRED
605 SYSTEM_ERROR_EKEYREVOKED
606 SYSTEM_ERROR_EKEYREJECTED
607 SYSTEM_ERROR_EOWNERDEAD
608 SYSTEM_ERROR_ENOTRECOVERABLE
609 SYSTEM_ERROR_ERFKILL
610 SYSTEM_ERROR_EHWPOISON
611 SYSTEM_ERROR_N