This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
padcv op type
[perl5.git] / regen / opcodes
1 # New ops always go at the end
2 # The restriction on having custom as the last op has been removed
3
4 # A recapitulation of the format of this file:
5 # The file consists of five columns: the name of the op, an English
6 # description, the name of the "check" routine used to optimize this
7 # operation, some flags, and a description of the operands.
8
9 # The flags consist of options followed by a mandatory op class signifier
10
11 # The classes are:
12 # baseop      - 0            unop     - 1            binop      - 2
13 # logop       - |            listop   - @            pmop       - /
14 # padop/svop  - $            padop    - # (unused)   loop       - {
15 # baseop/unop - %            loopexop - }            filestatop - -
16 # pvop/svop   - "            cop      - ;
17
18 # Other options are:
19 #   needs stack mark                    - m
20 #   needs constant folding              - f
21 #   produces a scalar                   - s
22 #   produces an integer                 - i
23 #   needs a target                      - t
24 #   target can be in a pad              - T
25 #   has a corresponding integer version - I
26 #   has side effects                    - d
27 #   uses $_ if no argument given        - u
28
29 # Values for the operands are:
30 # scalar      - S            list     - L            array     - A
31 # hash        - H            sub (CV) - C            file      - F
32 # socket      - Fs           filetest - F-           filetest_access - F-+
33 # num-compare - S<           dirhandle - DF
34
35 # reference - R
36 # "?" denotes an optional operand.
37
38 # Nothing.
39
40 null            null operation          ck_null         0       
41 stub            stub                    ck_null         0
42 scalar          scalar                  ck_fun          s%      S
43
44 # Pushy stuff.
45
46 pushmark        pushmark                ck_null         s0      
47 wantarray       wantarray               ck_null         is0     
48
49 const           constant item           ck_svconst      s$      
50
51 gvsv            scalar variable         ck_null         ds$     
52 gv              glob value              ck_null         ds$     
53 gelem           glob elem               ck_null         d2      S S
54 padsv           private variable        ck_null         ds0
55 padav           private array           ck_null         d0
56 padhv           private hash            ck_null         d0
57 padany          private value           ck_null         d0
58
59 pushre          push regexp             ck_null         d/
60
61 # References and stuff.
62
63 rv2gv           ref-to-glob cast        ck_rvconst      ds1     
64 rv2sv           scalar dereference      ck_rvconst      ds1     
65 av2arylen       array length            ck_null         is1     
66 rv2cv           subroutine dereference  ck_rvconst      d1
67 anoncode        anonymous subroutine    ck_anoncode     $       
68 prototype       subroutine prototype    ck_null         s%      S
69 refgen          reference constructor   ck_spair        m1      L
70 srefgen         single ref constructor  ck_null         fs1     S
71 ref             reference-type operator ck_fun          stu%    S?
72 bless           bless                   ck_fun          s@      S S?
73
74 # Pushy I/O.
75
76 backtick        quoted execution (``, qx)       ck_open         tu%     S?
77 # glob defaults its first arg to $_
78 glob            glob                    ck_glob         t@      S?
79 readline        <HANDLE>                ck_readline     t%      F?
80 rcatline        append I/O operator     ck_null         t$
81
82 # Bindable operators.
83
84 regcmaybe       regexp internal guard   ck_fun          s1      S
85 regcreset       regexp internal reset   ck_fun          s1      S
86 regcomp         regexp compilation      ck_null         s|      S
87 match           pattern match (m//)     ck_match        d/
88 qr              pattern quote (qr//)    ck_match        s/
89 subst           substitution (s///)     ck_match        dis/    S
90 substcont       substitution iterator   ck_null         dis|    
91 trans           transliteration (tr///) ck_match        is"     S
92 # y///r
93 transr          transliteration (tr///) ck_match        is"     S
94
95 # Lvalue operators.
96 # sassign is special-cased for op class
97
98 sassign         scalar assignment       ck_sassign      s0
99 aassign         list assignment         ck_null         t2      L L
100
101 chop            chop                    ck_spair        mts%    L
102 schop           scalar chop             ck_null         stu%    S?
103 chomp           chomp                   ck_spair        mTs%    L
104 schomp          scalar chomp            ck_null         sTu%    S?
105 defined         defined operator        ck_defined      isu%    S?
106 undef           undef operator          ck_fun          s%      R?
107 study           study                   ck_fun          su%     S?
108 pos             match position          ck_fun          stu%    R?
109
110 preinc          preincrement (++)               ck_lfun         dIs1    S
111 i_preinc        integer preincrement (++)       ck_lfun         dis1    S
112 predec          predecrement (--)               ck_lfun         dIs1    S
113 i_predec        integer predecrement (--)       ck_lfun         dis1    S
114 postinc         postincrement (++)              ck_lfun         dIst1   S
115 i_postinc       integer postincrement (++)      ck_lfun         disT1   S
116 postdec         postdecrement (--)              ck_lfun         dIst1   S
117 i_postdec       integer postdecrement (--)      ck_lfun         disT1   S
118
119 # Ordinary operators.
120
121 pow             exponentiation (**)     ck_null         fsT2    S S
122
123 multiply        multiplication (*)      ck_null         IfsT2   S S
124 i_multiply      integer multiplication (*)      ck_null         ifsT2   S S
125 divide          division (/)            ck_null         IfsT2   S S
126 i_divide        integer division (/)    ck_null         ifsT2   S S
127 modulo          modulus (%)             ck_null         IifsT2  S S
128 i_modulo        integer modulus (%)     ck_null         ifsT2   S S
129 repeat          repeat (x)              ck_repeat       fmt2    L S
130
131 add             addition (+)            ck_null         IfsT2   S S
132 i_add           integer addition (+)    ck_null         ifsT2   S S
133 subtract        subtraction (-)         ck_null         IfsT2   S S
134 i_subtract      integer subtraction (-) ck_null         ifsT2   S S
135 concat          concatenation (.) or string     ck_concat       fsT2    S S
136 stringify       string                  ck_fun          fsT@    S
137
138 left_shift      left bitshift (<<)      ck_bitop        fsT2    S S
139 right_shift     right bitshift (>>)     ck_bitop        fsT2    S S
140
141 lt              numeric lt (<)          ck_cmp          Iifs2   S S<
142 i_lt            integer lt (<)          ck_cmp          ifs2    S S<
143 gt              numeric gt (>)          ck_cmp          Iifs2   S S<
144 i_gt            integer gt (>)          ck_cmp          ifs2    S S<
145 le              numeric le (<=)         ck_cmp          Iifs2   S S<
146 i_le            integer le (<=)         ck_cmp          ifs2    S S<
147 ge              numeric ge (>=)         ck_cmp          Iifs2   S S<
148 i_ge            integer ge (>=)         ck_cmp          ifs2    S S<
149 eq              numeric eq (==)         ck_null         Iifs2   S S<
150 i_eq            integer eq (==)         ck_null         ifs2    S S<
151 ne              numeric ne (!=)         ck_null         Iifs2   S S<
152 i_ne            integer ne (!=)         ck_null         ifs2    S S<
153 ncmp            numeric comparison (<=>)        ck_null         Iifst2  S S<
154 i_ncmp          integer comparison (<=>)        ck_null         ifst2   S S<
155
156 slt             string lt               ck_null         ifs2    S S
157 sgt             string gt               ck_null         ifs2    S S
158 sle             string le               ck_null         ifs2    S S
159 sge             string ge               ck_null         ifs2    S S
160 seq             string eq               ck_null         ifs2    S S
161 sne             string ne               ck_null         ifs2    S S
162 scmp            string comparison (cmp) ck_null         ifst2   S S
163
164 bit_and         bitwise and (&)         ck_bitop        fst2    S S
165 bit_xor         bitwise xor (^)         ck_bitop        fst2    S S
166 bit_or          bitwise or (|)          ck_bitop        fst2    S S
167
168 negate          negation (-)            ck_null         Ifst1   S
169 i_negate        integer negation (-)    ck_null         ifsT1   S
170 not             not                     ck_null         ifs1    S
171 complement      1's complement (~)      ck_bitop        fst1    S
172
173 smartmatch      smart match             ck_smartmatch   s2
174
175 # High falutin' math.
176
177 atan2           atan2                   ck_fun          fsT@    S S
178 sin             sin                     ck_fun          fsTu%   S?
179 cos             cos                     ck_fun          fsTu%   S?
180 rand            rand                    ck_fun          sT%     S?
181 srand           srand                   ck_fun          sT%     S?
182 exp             exp                     ck_fun          fsTu%   S?
183 log             log                     ck_fun          fsTu%   S?
184 sqrt            sqrt                    ck_fun          fsTu%   S?
185
186 # Lowbrow math.
187
188 int             int                     ck_fun          fsTu%   S?
189 hex             hex                     ck_fun          fsTu%   S?
190 oct             oct                     ck_fun          fsTu%   S?
191 abs             abs                     ck_fun          fsTu%   S?
192
193 # String stuff.
194
195 length          length                  ck_length       ifsTu%  S?
196 substr          substr                  ck_substr       st@     S S S? S?
197 vec             vec                     ck_fun          ist@    S S S
198
199 index           index                   ck_index        isT@    S S S?
200 rindex          rindex                  ck_index        isT@    S S S?
201
202 sprintf         sprintf                 ck_lfun         fmst@   S L
203 formline        formline                ck_fun          ms@     S L
204 ord             ord                     ck_fun          ifsTu%  S?
205 chr             chr                     ck_fun          fsTu%   S?
206 crypt           crypt                   ck_fun          fsT@    S S
207 ucfirst         ucfirst                 ck_fun          fstu%   S?
208 lcfirst         lcfirst                 ck_fun          fstu%   S?
209 uc              uc                      ck_fun          fstu%   S?
210 lc              lc                      ck_fun          fstu%   S?
211 quotemeta       quotemeta               ck_fun          fstu%   S?
212
213 # Arrays.
214
215 rv2av           array dereference       ck_rvconst      dt1     
216 aelemfast       constant array element  ck_null         s$      A S
217 aelemfast_lex   constant lexical array element  ck_null         d0      A S
218 aelem           array element           ck_null         s2      A S
219 aslice          array slice             ck_null         m@      A L
220
221 aeach           each on array           ck_each         %       A
222 akeys           keys on array           ck_each         t%      A
223 avalues         values on array         ck_each         t%      A
224
225 # Hashes.
226
227 each            each                    ck_each         %       H
228 values          values                  ck_each         t%      H
229 keys            keys                    ck_each         t%      H
230 delete          delete                  ck_delete       %       S
231 exists          exists                  ck_exists       is%     S
232 rv2hv           hash dereference        ck_rvconst      dt1     
233 helem           hash element            ck_null         s2      H S
234 hslice          hash slice              ck_null         m@      H L
235
236 # Explosives and implosives.
237
238 unpack          unpack                  ck_fun          u@      S S?
239 pack            pack                    ck_fun          fmst@   S L
240 split           split                   ck_split        t@      S S S
241 join            join or string          ck_join         mst@    S L
242
243 # List operators.
244
245 list            list                    ck_null         m@      L
246 lslice          list slice              ck_null         2       H L L
247 anonlist        anonymous list ([])     ck_fun          ms@     L
248 anonhash        anonymous hash ({})     ck_fun          ms@     L
249
250 splice          splice                  ck_fun          m@      A S? S? L
251 push            push                    ck_fun          imsT@   A L
252 pop             pop                     ck_shift        s%      A?
253 shift           shift                   ck_shift        s%      A?
254 unshift         unshift                 ck_fun          imsT@   A L
255 sort            sort                    ck_sort         dm@     C? L
256 reverse         reverse                 ck_fun          mt@     L
257
258 grepstart       grep                    ck_grep         dm@     C L
259 grepwhile       grep iterator           ck_null         dt|     
260
261 mapstart        map                     ck_grep         dm@     C L
262 mapwhile        map iterator            ck_null         dt|
263
264 # Range stuff.
265
266 range           flipflop                ck_null         |       S S
267 flip            range (or flip)         ck_null         1       S S
268 flop            range (or flop)         ck_null         1
269
270 # Control.
271
272 and             logical and (&&)                ck_null         |       
273 or              logical or (||)                 ck_null         |       
274 xor             logical xor                     ck_null         fs2     S S     
275 dor             defined or (//)                 ck_null         |
276 cond_expr       conditional expression          ck_null         d|      
277 andassign       logical and assignment (&&=)    ck_null         s|      
278 orassign        logical or assignment (||=)     ck_null         s|      
279 dorassign       defined or assignment (//=)     ck_null         s|
280
281 method          method lookup           ck_method       d1
282 entersub        subroutine entry        ck_subr         dmt1    L
283 leavesub        subroutine exit         ck_null         1       
284 leavesublv      lvalue subroutine return        ck_null         1       
285 caller          caller                  ck_fun          t%      S?
286 warn            warn                    ck_fun          imst@   L
287 die             die                     ck_die          dimst@  L
288 reset           symbol reset            ck_fun          is%     S?
289
290 lineseq         line sequence           ck_null         @       
291 nextstate       next statement          ck_null         s;      
292 dbstate         debug next statement    ck_null         s;      
293 unstack         iteration finalizer     ck_null         s0
294 enter           block entry             ck_null         0       
295 leave           block exit              ck_null         @       
296 scope           block                   ck_null         @       
297 enteriter       foreach loop entry      ck_null         d{      
298 iter            foreach loop iterator   ck_null         0       
299 enterloop       loop entry              ck_null         d{      
300 leaveloop       loop exit               ck_null         2       
301 return          return                  ck_return       dm@     L
302 last            last                    ck_null         ds}     
303 next            next                    ck_null         ds}     
304 redo            redo                    ck_null         ds}     
305 dump            dump                    ck_null         ds}     
306 goto            goto                    ck_null         ds}     
307 exit            exit                    ck_exit         ds%     S?
308 method_named    method with known name  ck_null         d$
309
310 entergiven      given()                 ck_null         d|
311 leavegiven      leave given block       ck_null         1
312 enterwhen       when()                  ck_null         d|
313 leavewhen       leave when block        ck_null         1
314 break           break                   ck_null         0
315 continue        continue                ck_null         0
316
317 # I/O.
318
319 open            open                    ck_open         ismt@   F S? L
320 close           close                   ck_fun          is%     F?
321 pipe_op         pipe                    ck_fun          is@     F F
322
323 fileno          fileno                  ck_fun          ist%    F
324 umask           umask                   ck_fun          ist%    S?
325 binmode         binmode                 ck_fun          s@      F S?
326
327 tie             tie                     ck_fun          idms@   R S L
328 untie           untie                   ck_fun          is%     R
329 tied            tied                    ck_fun          s%      R
330 dbmopen         dbmopen                 ck_fun          is@     H S S
331 dbmclose        dbmclose                ck_fun          is%     H
332
333 sselect         select system call      ck_select       t@      S S S S
334 select          select                  ck_select       st@     F?
335
336 getc            getc                    ck_eof          st%     F?
337 read            read                    ck_fun          imst@   F R S S?
338 enterwrite      write                   ck_fun          dis%    F?
339 leavewrite      write exit              ck_null         1       
340
341 prtf            printf                  ck_listiob      ims@    F? L
342 print           print                   ck_listiob      ims@    F? L
343 say             say                     ck_listiob      ims@    F? L
344
345 sysopen         sysopen                 ck_fun          s@      F S S S?
346 sysseek         sysseek                 ck_fun          s@      F S S
347 sysread         sysread                 ck_fun          imst@   F R S S?
348 syswrite        syswrite                ck_fun          imst@   F S S? S?
349
350 eof             eof                     ck_eof          is%     F?
351 tell            tell                    ck_tell         st%     F?
352 seek            seek                    ck_tell         s@      F S S
353 # truncate really behaves as if it had both "S S" and "F S"
354 truncate        truncate                ck_trunc        is@     S S
355
356 fcntl           fcntl                   ck_fun          st@     F S S
357 ioctl           ioctl                   ck_fun          st@     F S S
358 flock           flock                   ck_fun          isT@    F S
359
360 # Sockets.  OP_IS_SOCKET wants them consecutive (so moved 1st 2)
361
362 send            send                    ck_fun          imst@   Fs S S S?
363 recv            recv                    ck_fun          imst@   Fs R S S
364
365 socket          socket                  ck_fun          is@     Fs S S S
366 sockpair        socketpair              ck_fun          is@     Fs Fs S S S
367
368 bind            bind                    ck_fun          is@     Fs S
369 connect         connect                 ck_fun          is@     Fs S
370 listen          listen                  ck_fun          is@     Fs S
371 accept          accept                  ck_fun          ist@    Fs Fs
372 shutdown        shutdown                ck_fun          ist@    Fs S
373
374 gsockopt        getsockopt              ck_fun          is@     Fs S S
375 ssockopt        setsockopt              ck_fun          is@     Fs S S S
376
377 getsockname     getsockname             ck_fun          is%     Fs
378 getpeername     getpeername             ck_fun          is%     Fs
379
380 # Stat calls.  OP_IS_FILETEST wants them consecutive.
381
382 lstat           lstat                   ck_ftst         u-      F?
383 stat            stat                    ck_ftst         u-      F?
384 ftrread         -R                      ck_ftst         isu-    F-+
385 ftrwrite        -W                      ck_ftst         isu-    F-+
386 ftrexec         -X                      ck_ftst         isu-    F-+
387 fteread         -r                      ck_ftst         isu-    F-+
388 ftewrite        -w                      ck_ftst         isu-    F-+
389 fteexec         -x                      ck_ftst         isu-    F-+
390 ftis            -e                      ck_ftst         isu-    F-
391 ftsize          -s                      ck_ftst         istu-   F-
392 ftmtime         -M                      ck_ftst         stu-    F-
393 ftatime         -A                      ck_ftst         stu-    F-
394 ftctime         -C                      ck_ftst         stu-    F-
395 ftrowned        -O                      ck_ftst         isu-    F-
396 fteowned        -o                      ck_ftst         isu-    F-
397 ftzero          -z                      ck_ftst         isu-    F-
398 ftsock          -S                      ck_ftst         isu-    F-
399 ftchr           -c                      ck_ftst         isu-    F-
400 ftblk           -b                      ck_ftst         isu-    F-
401 ftfile          -f                      ck_ftst         isu-    F-
402 ftdir           -d                      ck_ftst         isu-    F-
403 ftpipe          -p                      ck_ftst         isu-    F-
404 ftsuid          -u                      ck_ftst         isu-    F-
405 ftsgid          -g                      ck_ftst         isu-    F-
406 ftsvtx          -k                      ck_ftst         isu-    F-
407 ftlink          -l                      ck_ftst         isu-    F-
408 fttty           -t                      ck_ftst         is-     F-
409 fttext          -T                      ck_ftst         isu-    F-
410 ftbinary        -B                      ck_ftst         isu-    F-
411
412 # File calls.
413
414 # chdir really behaves as if it had both "S?" and "F?"
415 chdir           chdir                   ck_trunc        isT%    S?
416 chown           chown                   ck_fun          imsT@   L
417 chroot          chroot                  ck_fun          isTu%   S?
418 unlink          unlink                  ck_fun          imsTu@  L
419 chmod           chmod                   ck_fun          imsT@   L
420 utime           utime                   ck_fun          imsT@   L
421 rename          rename                  ck_fun          isT@    S S
422 link            link                    ck_fun          isT@    S S
423 symlink         symlink                 ck_fun          isT@    S S
424 readlink        readlink                ck_fun          stu%    S?
425 mkdir           mkdir                   ck_fun          isTu@   S? S?
426 rmdir           rmdir                   ck_fun          isTu%   S?
427
428 # Directory calls.
429
430 open_dir        opendir                 ck_fun          is@     F S
431 readdir         readdir                 ck_fun          %       DF
432 telldir         telldir                 ck_fun          st%     DF
433 seekdir         seekdir                 ck_fun          s@      DF S
434 rewinddir       rewinddir               ck_fun          s%      DF
435 closedir        closedir                ck_fun          is%     DF
436
437 # Process control.
438
439 fork            fork                    ck_null         ist0    
440 wait            wait                    ck_null         isT0    
441 waitpid         waitpid                 ck_fun          isT@    S S
442 system          system                  ck_exec         imsT@   S? L
443 exec            exec                    ck_exec         dimsT@  S? L
444 kill            kill                    ck_fun          dimsT@  L
445 getppid         getppid                 ck_null         isT0    
446 getpgrp         getpgrp                 ck_fun          isT%    S?
447 setpgrp         setpgrp                 ck_fun          isT@    S? S?
448 getpriority     getpriority             ck_fun          isT@    S S
449 setpriority     setpriority             ck_fun          isT@    S S S
450
451 # Time calls.
452
453 time            time                    ck_null         isT0    
454 tms             times                   ck_null         0       
455 localtime       localtime               ck_fun          t%      S?
456 gmtime          gmtime                  ck_fun          t%      S?
457 alarm           alarm                   ck_fun          istu%   S?
458 sleep           sleep                   ck_fun          isT%    S?
459
460 # Shared memory.
461
462 shmget          shmget                  ck_fun          imst@   S S S
463 shmctl          shmctl                  ck_fun          imst@   S S S
464 shmread         shmread                 ck_fun          imst@   S S S S
465 shmwrite        shmwrite                ck_fun          imst@   S S S S
466
467 # Message passing.
468
469 msgget          msgget                  ck_fun          imst@   S S
470 msgctl          msgctl                  ck_fun          imst@   S S S
471 msgsnd          msgsnd                  ck_fun          imst@   S S S
472 msgrcv          msgrcv                  ck_fun          imst@   S S S S S
473
474 # Semaphores.
475
476 semop           semop                   ck_fun          imst@   S S
477 semget          semget                  ck_fun          imst@   S S S
478 semctl          semctl                  ck_fun          imst@   S S S S
479
480 # Eval.
481
482 require         require                 ck_require      du%     S?
483 dofile          do "file"               ck_fun          d1      S
484 hintseval       eval hints              ck_svconst      s$
485 entereval       eval "string"           ck_eval         du%     S?
486 leaveeval       eval "string" exit      ck_null         1       S
487 entertry        eval {block}            ck_eval         d|      
488 leavetry        eval {block} exit       ck_null         @       
489
490 # Get system info.
491
492 ghbyname        gethostbyname           ck_fun          %       S
493 ghbyaddr        gethostbyaddr           ck_fun          @       S S
494 ghostent        gethostent              ck_null         0       
495 gnbyname        getnetbyname            ck_fun          %       S
496 gnbyaddr        getnetbyaddr            ck_fun          @       S S
497 gnetent         getnetent               ck_null         0       
498 gpbyname        getprotobyname          ck_fun          %       S
499 gpbynumber      getprotobynumber        ck_fun          @       S
500 gprotoent       getprotoent             ck_null         0       
501 gsbyname        getservbyname           ck_fun          @       S S
502 gsbyport        getservbyport           ck_fun          @       S S
503 gservent        getservent              ck_null         0       
504 shostent        sethostent              ck_fun          is%     S
505 snetent         setnetent               ck_fun          is%     S
506 sprotoent       setprotoent             ck_fun          is%     S
507 sservent        setservent              ck_fun          is%     S
508 ehostent        endhostent              ck_null         is0     
509 enetent         endnetent               ck_null         is0     
510 eprotoent       endprotoent             ck_null         is0     
511 eservent        endservent              ck_null         is0     
512 gpwnam          getpwnam                ck_fun          %       S
513 gpwuid          getpwuid                ck_fun          %       S
514 gpwent          getpwent                ck_null         0       
515 spwent          setpwent                ck_null         is0     
516 epwent          endpwent                ck_null         is0     
517 ggrnam          getgrnam                ck_fun          %       S
518 ggrgid          getgrgid                ck_fun          %       S
519 ggrent          getgrent                ck_null         0       
520 sgrent          setgrent                ck_null         is0     
521 egrent          endgrent                ck_null         is0     
522 getlogin        getlogin                ck_null         st0     
523
524 # Miscellaneous.
525
526 syscall         syscall                 ck_fun          imst@   S L
527
528 # For multi-threading
529 lock            lock                    ck_rfun         s%      R
530
531 # For state support
532
533 once            once                    ck_null         |       
534
535 custom          unknown custom operator         ck_null         0
536
537 # For smart dereference for each/keys/values
538 reach           each on reference                       ck_each         %       S
539 rkeys           keys on reference                       ck_each         t%      S
540 rvalues         values on reference                     ck_each         t%      S
541
542 # For CORE:: subs
543 coreargs        CORE:: subroutine       ck_null         $       
544
545 runcv           __SUB__                 ck_null         s0
546
547 # fc and \F
548 fc              fc                      ck_fun          fstu%   S?
549
550 padcv           private subroutine      ck_null         d0