diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-18 22:30:13 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-18 22:30:13 +0000 |
commit | c2091e37ec2fd62e82f5aa69e8d147e0c329cdff (patch) | |
tree | ec3599801897bc1eff805ce1c07137b32e5e4019 /defs | |
parent | b7be78d774daf5b9a9fdd63e6d20e30309b9efa0 (diff) | |
download | ruby-c2091e37ec2fd62e82f5aa69e8d147e0c329cdff.tar.gz |
* keywords, lex.c.src, opt_insn_unif.def, opt_operand.def: moved rarely changed
input files for code generators into defs/ directory.
* Makefile.in (lex.c): followed keywords and lex.c.src.
* common.mk (parser.o): followed keywords.
(INSNS): followed opt_*.def
* tools/instruction.rb: followed opt_*.def.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'defs')
-rw-r--r-- | defs/keywords | 51 | ||||
-rw-r--r-- | defs/lex.c.src | 51 | ||||
-rw-r--r-- | defs/opt_insn_unif.def | 29 | ||||
-rw-r--r-- | defs/opt_operand.def | 59 |
4 files changed, 190 insertions, 0 deletions
diff --git a/defs/keywords b/defs/keywords new file mode 100644 index 0000000000..f0d82a7667 --- /dev/null +++ b/defs/keywords @@ -0,0 +1,51 @@ +%{ +struct kwtable {const char *name; int id[2]; enum lex_state_e state;}; +const struct kwtable *rb_reserved_word(const char *, unsigned int); +#ifndef RIPPER +%} + +struct kwtable; +%% +__ENCODING__, {keyword__ENCODING__, keyword__ENCODING__}, EXPR_END +__LINE__, {keyword__LINE__, keyword__LINE__}, EXPR_END +__FILE__, {keyword__FILE__, keyword__FILE__}, EXPR_END +BEGIN, {keyword_BEGIN, keyword_BEGIN}, EXPR_END +END, {keyword_END, keyword_END}, EXPR_END +alias, {keyword_alias, keyword_alias}, EXPR_FNAME +and, {keyword_and, keyword_and}, EXPR_VALUE +begin, {keyword_begin, keyword_begin}, EXPR_BEG +break, {keyword_break, keyword_break}, EXPR_MID +case, {keyword_case, keyword_case}, EXPR_VALUE +class, {keyword_class, keyword_class}, EXPR_CLASS +def, {keyword_def, keyword_def}, EXPR_FNAME +defined?, {keyword_defined, keyword_defined}, EXPR_ARG +do, {keyword_do, keyword_do}, EXPR_BEG +else, {keyword_else, keyword_else}, EXPR_BEG +elsif, {keyword_elsif, keyword_elsif}, EXPR_VALUE +end, {keyword_end, keyword_end}, EXPR_END +ensure, {keyword_ensure, keyword_ensure}, EXPR_BEG +false, {keyword_false, keyword_false}, EXPR_END +for, {keyword_for, keyword_for}, EXPR_VALUE +if, {keyword_if, modifier_if}, EXPR_VALUE +in, {keyword_in, keyword_in}, EXPR_VALUE +module, {keyword_module, keyword_module}, EXPR_VALUE +next, {keyword_next, keyword_next}, EXPR_MID +nil, {keyword_nil, keyword_nil}, EXPR_END +not, {keyword_not, keyword_not}, EXPR_ARG +or, {keyword_or, keyword_or}, EXPR_VALUE +redo, {keyword_redo, keyword_redo}, EXPR_END +rescue, {keyword_rescue, modifier_rescue}, EXPR_MID +retry, {keyword_retry, keyword_retry}, EXPR_END +return, {keyword_return, keyword_return}, EXPR_MID +self, {keyword_self, keyword_self}, EXPR_END +super, {keyword_super, keyword_super}, EXPR_ARG +then, {keyword_then, keyword_then}, EXPR_BEG +true, {keyword_true, keyword_true}, EXPR_END +undef, {keyword_undef, keyword_undef}, EXPR_FNAME +unless, {keyword_unless, modifier_unless}, EXPR_VALUE +until, {keyword_until, modifier_until}, EXPR_VALUE +when, {keyword_when, keyword_when}, EXPR_VALUE +while, {keyword_while, modifier_while}, EXPR_VALUE +yield, {keyword_yield, keyword_yield}, EXPR_ARG +%% +#endif diff --git a/defs/lex.c.src b/defs/lex.c.src new file mode 100644 index 0000000000..f0d82a7667 --- /dev/null +++ b/defs/lex.c.src @@ -0,0 +1,51 @@ +%{ +struct kwtable {const char *name; int id[2]; enum lex_state_e state;}; +const struct kwtable *rb_reserved_word(const char *, unsigned int); +#ifndef RIPPER +%} + +struct kwtable; +%% +__ENCODING__, {keyword__ENCODING__, keyword__ENCODING__}, EXPR_END +__LINE__, {keyword__LINE__, keyword__LINE__}, EXPR_END +__FILE__, {keyword__FILE__, keyword__FILE__}, EXPR_END +BEGIN, {keyword_BEGIN, keyword_BEGIN}, EXPR_END +END, {keyword_END, keyword_END}, EXPR_END +alias, {keyword_alias, keyword_alias}, EXPR_FNAME +and, {keyword_and, keyword_and}, EXPR_VALUE +begin, {keyword_begin, keyword_begin}, EXPR_BEG +break, {keyword_break, keyword_break}, EXPR_MID +case, {keyword_case, keyword_case}, EXPR_VALUE +class, {keyword_class, keyword_class}, EXPR_CLASS +def, {keyword_def, keyword_def}, EXPR_FNAME +defined?, {keyword_defined, keyword_defined}, EXPR_ARG +do, {keyword_do, keyword_do}, EXPR_BEG +else, {keyword_else, keyword_else}, EXPR_BEG +elsif, {keyword_elsif, keyword_elsif}, EXPR_VALUE +end, {keyword_end, keyword_end}, EXPR_END +ensure, {keyword_ensure, keyword_ensure}, EXPR_BEG +false, {keyword_false, keyword_false}, EXPR_END +for, {keyword_for, keyword_for}, EXPR_VALUE +if, {keyword_if, modifier_if}, EXPR_VALUE +in, {keyword_in, keyword_in}, EXPR_VALUE +module, {keyword_module, keyword_module}, EXPR_VALUE +next, {keyword_next, keyword_next}, EXPR_MID +nil, {keyword_nil, keyword_nil}, EXPR_END +not, {keyword_not, keyword_not}, EXPR_ARG +or, {keyword_or, keyword_or}, EXPR_VALUE +redo, {keyword_redo, keyword_redo}, EXPR_END +rescue, {keyword_rescue, modifier_rescue}, EXPR_MID +retry, {keyword_retry, keyword_retry}, EXPR_END +return, {keyword_return, keyword_return}, EXPR_MID +self, {keyword_self, keyword_self}, EXPR_END +super, {keyword_super, keyword_super}, EXPR_ARG +then, {keyword_then, keyword_then}, EXPR_BEG +true, {keyword_true, keyword_true}, EXPR_END +undef, {keyword_undef, keyword_undef}, EXPR_FNAME +unless, {keyword_unless, modifier_unless}, EXPR_VALUE +until, {keyword_until, modifier_until}, EXPR_VALUE +when, {keyword_when, keyword_when}, EXPR_VALUE +while, {keyword_while, modifier_while}, EXPR_VALUE +yield, {keyword_yield, keyword_yield}, EXPR_ARG +%% +#endif diff --git a/defs/opt_insn_unif.def b/defs/opt_insn_unif.def new file mode 100644 index 0000000000..1ac613dbea --- /dev/null +++ b/defs/opt_insn_unif.def @@ -0,0 +1,29 @@ +# +# a definition of instruction unification +# +# + +__END__ + +putobject putobject +putobject putstring +putobject setlocal +putobject setdynamic + +putstring putstring +putstring putobject +putstring setlocal +putstring setdynamic + +# putnil end + +dup setlocal + +# from tarai +getlocal getlocal +# getlocal send + +# from tak, ackermann +getlocal putobject + + diff --git a/defs/opt_operand.def b/defs/opt_operand.def new file mode 100644 index 0000000000..5ca1d74028 --- /dev/null +++ b/defs/opt_operand.def @@ -0,0 +1,59 @@ +# +# configration file for operand union optimization +# +# format: +# [insn name] op1, op2 ... +# +# wildcard: * +# + +__END__ + +getlocal 2 +getlocal 3 +getlocal 4 + +setlocal 2 +setlocal 3 +setlocal 4 + +getdynamic *, 0 +getdynamic 1, 0 +getdynamic 2, 0 +getdynamic 3, 0 +getdynamic 4, 0 + +setdynamic *, 0 +setdynamic 1, 0 +setdynamic 2, 0 +setdynamic 3, 0 +setdynamic 4, 0 + +putobject INT2FIX(0) +putobject INT2FIX(1) +putobject Qtrue +putobject Qfalse + +# CALL +send *, *, Qfalse, 0, * +send *, 0, Qfalse, 0, * +send *, 1, Qfalse, 0, * +send *, 2, Qfalse, 0, * +send *, 3, Qfalse, 0, * + +# FCALL +send *, *, Qfalse, 0x04, * +send *, 0, Qfalse, 0x04, * +send *, 1, Qfalse, 0x04, * +send *, 2, Qfalse, 0x04, * +send *, 3, Qfalse, 0x04, * + +# VCALL +send *, 0, Qfalse, 0x0c, * + + +__END__ + + + + |