summaryrefslogtreecommitdiff
path: root/regen/opcode.pl
diff options
context:
space:
mode:
authorJim Cromie <jim.cromie@gmail.com>2011-06-02 00:27:49 -0600
committerFather Chrysostomos <sprout@cpan.org>2011-09-09 23:45:08 -0700
commit332c2eacbbe33d99076d34256aa32351d41421c9 (patch)
treeeac1b630e6de565140755e6e61015e5ca63e03d5 /regen/opcode.pl
parent2b420b633b59fecd2561eeec600f17160862175b (diff)
downloadperl-332c2eacbbe33d99076d34256aa32351d41421c9.tar.gz
regen/opcode.pl: generate OP_IS_DIRHOP, use in gv.c
Generate OP_IS_DIRHOP like other OP_IS_* macros, use in gv.c:Perl_gv_add_by_type(). Modifies 'F' operand type to 'DF'. This yields a micro-optimization.
Diffstat (limited to 'regen/opcode.pl')
-rwxr-xr-xregen/opcode.pl14
1 files changed, 11 insertions, 3 deletions
diff --git a/regen/opcode.pl b/regen/opcode.pl
index 5e1cf62dc8..b4576da236 100755
--- a/regen/opcode.pl
+++ b/regen/opcode.pl
@@ -353,6 +353,8 @@ my %OP_IS_SOCKET; # /Fs/
my %OP_IS_FILETEST; # /F-/
my %OP_IS_FT_ACCESS; # /F-+/
my %OP_IS_NUMCOMPARE; # /S</
+my %OP_IS_DIRHOP; # /Fd/
+
my $OCSHIFT = 8;
my $OASHIFT = 12;
@@ -371,6 +373,10 @@ for my $op (@ops) {
$argsum |= $opclass{$flags} << $OCSHIFT;
my $argshift = $OASHIFT;
for my $arg (split(' ',$args{$op})) {
+ if ($arg =~ s/^D//) {
+ # handle 1st, just to put D 1st.
+ $OP_IS_DIRHOP{$op} = $opnum{$op};
+ }
if ($arg =~ /^F/) {
# record opnums of these opnames
$OP_IS_SOCKET{$op} = $opnum{$op} if $arg =~ s/s//;
@@ -407,15 +413,17 @@ END
print $on <<'EO_OP_IS_COMMENT';
-/* the OP_IS_(SOCKET|FILETEST) macros are optimized to a simple range
- check because all the member OPs are contiguous in opcode.pl
- <OPS> table. opcode.pl verifies the range contiguity. */
+/* the OP_IS_* macros are optimized to a simple range check because
+ all the member OPs are contiguous in regen/opcodes table.
+ opcode.pl verifies the range contiguity, or generates an OR-equals
+ expression */
EO_OP_IS_COMMENT
gen_op_is_macro( \%OP_IS_SOCKET, 'OP_IS_SOCKET');
gen_op_is_macro( \%OP_IS_FILETEST, 'OP_IS_FILETEST');
gen_op_is_macro( \%OP_IS_FT_ACCESS, 'OP_IS_FILETEST_ACCESS');
gen_op_is_macro( \%OP_IS_NUMCOMPARE, 'OP_IS_NUMCOMPARE');
+gen_op_is_macro( \%OP_IS_DIRHOP, 'OP_IS_DIRHOP');
sub gen_op_is_macro {
my ($op_is, $macname) = @_;