14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 // FORMS.CPP - Definitions for ADL Parser Forms Classes
26 #include "adlc.hpp"
27
28 //==============================Instructions===================================
29 //------------------------------InstructForm-----------------------------------
30 InstructForm::InstructForm(const char *id, bool ideal_only)
31 : _ident(id), _ideal_only(ideal_only),
32 _localNames(cmpstr, hashstr, Form::arena),
33 _effects(cmpstr, hashstr, Form::arena),
34 _is_mach_constant(false)
35 {
36 _ftype = Form::INS;
37
38 _matrule = NULL;
39 _insencode = NULL;
40 _constant = NULL;
41 _opcode = NULL;
42 _size = NULL;
43 _attribs = NULL;
44 _predicate = NULL;
45 _exprule = NULL;
46 _rewrule = NULL;
47 _format = NULL;
48 _peephole = NULL;
49 _ins_pipe = NULL;
50 _uniq_idx = NULL;
51 _num_uniq = 0;
52 _cisc_spill_operand = Not_cisc_spillable;// Which operand may cisc-spill
53 _cisc_spill_alternate = NULL; // possible cisc replacement
54 _cisc_reg_mask_name = NULL;
55 _is_cisc_alternate = false;
56 _is_short_branch = false;
57 _short_branch_form = NULL;
58 _alignment = 1;
59 }
60
61 InstructForm::InstructForm(const char *id, InstructForm *instr, MatchRule *rule)
62 : _ident(id), _ideal_only(false),
63 _localNames(instr->_localNames),
64 _effects(instr->_effects),
65 _is_mach_constant(false)
66 {
67 _ftype = Form::INS;
68
69 _matrule = rule;
70 _insencode = instr->_insencode;
71 _constant = instr->_constant;
72 _opcode = instr->_opcode;
73 _size = instr->_size;
74 _attribs = instr->_attribs;
75 _predicate = instr->_predicate;
76 _exprule = instr->_exprule;
77 _rewrule = instr->_rewrule;
78 _format = instr->_format;
79 _peephole = instr->_peephole;
80 _ins_pipe = instr->_ins_pipe;
81 _uniq_idx = instr->_uniq_idx;
82 _num_uniq = instr->_num_uniq;
83 _cisc_spill_operand = Not_cisc_spillable;// Which operand may cisc-spill
84 _cisc_spill_alternate = NULL; // possible cisc replacement
85 _cisc_reg_mask_name = NULL;
1737 if ( ! first_param ) fprintf(fp,", ");
1738 first_param = false;
1739 // Output the parameter
1740 fprintf(fp,"%s", parameter);
1741 } // done with parameters
1742 fprintf(fp,") ");
1743 } // done with encodings
1744
1745 fprintf(fp,"\n");
1746 }
1747
1748 //------------------------------Effect-----------------------------------------
1749 static int effect_lookup(const char *name) {
1750 if(!strcmp(name, "USE")) return Component::USE;
1751 if(!strcmp(name, "DEF")) return Component::DEF;
1752 if(!strcmp(name, "USE_DEF")) return Component::USE_DEF;
1753 if(!strcmp(name, "KILL")) return Component::KILL;
1754 if(!strcmp(name, "USE_KILL")) return Component::USE_KILL;
1755 if(!strcmp(name, "TEMP")) return Component::TEMP;
1756 if(!strcmp(name, "INVALID")) return Component::INVALID;
1757 assert( false,"Invalid effect name specified\n");
1758 return Component::INVALID;
1759 }
1760
1761 Effect::Effect(const char *name) : _name(name), _use_def(effect_lookup(name)) {
1762 _ftype = Form::EFF;
1763 }
1764 Effect::~Effect() {
1765 }
1766
1767 // Dynamic type check
1768 Effect *Effect::is_effect() const {
1769 return (Effect*)this;
1770 }
1771
1772
1773 // True if this component is equal to the parameter.
1774 bool Effect::is(int use_def_kill_enum) const {
1775 return (_use_def == use_def_kill_enum ? true : false);
1776 }
|
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 // FORMS.CPP - Definitions for ADL Parser Forms Classes
26 #include "adlc.hpp"
27
28 //==============================Instructions===================================
29 //------------------------------InstructForm-----------------------------------
30 InstructForm::InstructForm(const char *id, bool ideal_only)
31 : _ident(id), _ideal_only(ideal_only),
32 _localNames(cmpstr, hashstr, Form::arena),
33 _effects(cmpstr, hashstr, Form::arena),
34 _is_mach_constant(false),
35 _has_call(false)
36 {
37 _ftype = Form::INS;
38
39 _matrule = NULL;
40 _insencode = NULL;
41 _constant = NULL;
42 _opcode = NULL;
43 _size = NULL;
44 _attribs = NULL;
45 _predicate = NULL;
46 _exprule = NULL;
47 _rewrule = NULL;
48 _format = NULL;
49 _peephole = NULL;
50 _ins_pipe = NULL;
51 _uniq_idx = NULL;
52 _num_uniq = 0;
53 _cisc_spill_operand = Not_cisc_spillable;// Which operand may cisc-spill
54 _cisc_spill_alternate = NULL; // possible cisc replacement
55 _cisc_reg_mask_name = NULL;
56 _is_cisc_alternate = false;
57 _is_short_branch = false;
58 _short_branch_form = NULL;
59 _alignment = 1;
60 }
61
62 InstructForm::InstructForm(const char *id, InstructForm *instr, MatchRule *rule)
63 : _ident(id), _ideal_only(false),
64 _localNames(instr->_localNames),
65 _effects(instr->_effects),
66 _is_mach_constant(false),
67 _has_call(false)
68 {
69 _ftype = Form::INS;
70
71 _matrule = rule;
72 _insencode = instr->_insencode;
73 _constant = instr->_constant;
74 _opcode = instr->_opcode;
75 _size = instr->_size;
76 _attribs = instr->_attribs;
77 _predicate = instr->_predicate;
78 _exprule = instr->_exprule;
79 _rewrule = instr->_rewrule;
80 _format = instr->_format;
81 _peephole = instr->_peephole;
82 _ins_pipe = instr->_ins_pipe;
83 _uniq_idx = instr->_uniq_idx;
84 _num_uniq = instr->_num_uniq;
85 _cisc_spill_operand = Not_cisc_spillable;// Which operand may cisc-spill
86 _cisc_spill_alternate = NULL; // possible cisc replacement
87 _cisc_reg_mask_name = NULL;
1739 if ( ! first_param ) fprintf(fp,", ");
1740 first_param = false;
1741 // Output the parameter
1742 fprintf(fp,"%s", parameter);
1743 } // done with parameters
1744 fprintf(fp,") ");
1745 } // done with encodings
1746
1747 fprintf(fp,"\n");
1748 }
1749
1750 //------------------------------Effect-----------------------------------------
1751 static int effect_lookup(const char *name) {
1752 if(!strcmp(name, "USE")) return Component::USE;
1753 if(!strcmp(name, "DEF")) return Component::DEF;
1754 if(!strcmp(name, "USE_DEF")) return Component::USE_DEF;
1755 if(!strcmp(name, "KILL")) return Component::KILL;
1756 if(!strcmp(name, "USE_KILL")) return Component::USE_KILL;
1757 if(!strcmp(name, "TEMP")) return Component::TEMP;
1758 if(!strcmp(name, "INVALID")) return Component::INVALID;
1759 if(!strcmp(name, "CALL")) return Component::CALL;
1760 assert( false,"Invalid effect name specified\n");
1761 return Component::INVALID;
1762 }
1763
1764 Effect::Effect(const char *name) : _name(name), _use_def(effect_lookup(name)) {
1765 _ftype = Form::EFF;
1766 }
1767 Effect::~Effect() {
1768 }
1769
1770 // Dynamic type check
1771 Effect *Effect::is_effect() const {
1772 return (Effect*)this;
1773 }
1774
1775
1776 // True if this component is equal to the parameter.
1777 bool Effect::is(int use_def_kill_enum) const {
1778 return (_use_def == use_def_kill_enum ? true : false);
1779 }
|