1 /* |
1 /* |
2 * Copyright 1998-2008 Sun Microsystems, Inc. All Rights Reserved. |
2 * Copyright 1998-2009 Sun Microsystems, Inc. All Rights Reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
918 |
918 |
919 // return 0 if not found: |
919 // return 0 if not found: |
920 // return 1 if found and position is incremented by operand offset in rule |
920 // return 1 if found and position is incremented by operand offset in rule |
921 bool find_name(const char *str, int &position) const; |
921 bool find_name(const char *str, int &position) const; |
922 bool find_type(const char *str, int &position) const; |
922 bool find_type(const char *str, int &position) const; |
923 void append_components(FormDict &locals, ComponentList &components, |
923 virtual void append_components(FormDict& locals, ComponentList& components, |
924 bool def_flag) const; |
924 bool def_flag = false) const; |
925 bool base_operand(uint &position, FormDict &globals, |
925 bool base_operand(uint &position, FormDict &globals, |
926 const char * &result, const char * &name, |
926 const char * &result, const char * &name, |
927 const char * &opType) const; |
927 const char * &opType) const; |
928 // recursive count on operands |
928 // recursive count on operands |
929 uint num_consts(FormDict &globals) const; |
929 uint num_consts(FormDict &globals) const; |
945 bool sets_result() const; // rule "Set"s result of match |
945 bool sets_result() const; // rule "Set"s result of match |
946 const char *reduce_right(FormDict &globals) const; |
946 const char *reduce_right(FormDict &globals) const; |
947 const char *reduce_left (FormDict &globals) const; |
947 const char *reduce_left (FormDict &globals) const; |
948 |
948 |
949 // Recursive version of check in MatchRule |
949 // Recursive version of check in MatchRule |
950 int cisc_spill_match(FormDict &globals, RegisterForm *registers, |
950 int cisc_spill_match(FormDict& globals, RegisterForm* registers, |
951 MatchNode *mRule2, const char * &operand, |
951 MatchNode* mRule2, const char* &operand, |
952 const char * ®_type); |
952 const char* ®_type); |
953 int cisc_spill_merge(int left_result, int right_result); |
953 int cisc_spill_merge(int left_result, int right_result); |
954 |
954 |
955 bool equivalent(FormDict &globals, MatchNode *mNode2); |
955 virtual bool equivalent(FormDict& globals, MatchNode* mNode2); |
956 |
956 |
957 void count_commutative_op(int& count); |
957 void count_commutative_op(int& count); |
958 void swap_commutative_op(bool atroot, int count); |
958 void swap_commutative_op(bool atroot, int count); |
959 |
959 |
960 void dump(); |
960 void dump(); |
977 MatchRule(ArchDesc &ad); |
977 MatchRule(ArchDesc &ad); |
978 MatchRule(ArchDesc &ad, MatchRule* mRule); // Shallow copy constructor; |
978 MatchRule(ArchDesc &ad, MatchRule* mRule); // Shallow copy constructor; |
979 MatchRule(ArchDesc &ad, MatchNode* mroot, int depth, char* construct, int numleaves); |
979 MatchRule(ArchDesc &ad, MatchNode* mroot, int depth, char* construct, int numleaves); |
980 ~MatchRule(); |
980 ~MatchRule(); |
981 |
981 |
982 void append_components(FormDict &locals, ComponentList &components) const; |
982 virtual void append_components(FormDict& locals, ComponentList& components, bool def_flag = false) const; |
983 // Recursive call on all operands' match rules in my match rule. |
983 // Recursive call on all operands' match rules in my match rule. |
984 bool base_operand(uint &position, FormDict &globals, |
984 bool base_operand(uint &position, FormDict &globals, |
985 const char * &result, const char * &name, |
985 const char * &result, const char * &name, |
986 const char * &opType) const; |
986 const char * &opType) const; |
987 |
987 |
1004 bool is_ideal_bool() const; // node matches ideal 'Bool' |
1004 bool is_ideal_bool() const; // node matches ideal 'Bool' |
1005 Form::DataType is_ideal_load() const;// node matches ideal 'LoadXNode' |
1005 Form::DataType is_ideal_load() const;// node matches ideal 'LoadXNode' |
1006 Form::DataType is_ideal_store() const;// node matches ideal 'StoreXNode' |
1006 Form::DataType is_ideal_store() const;// node matches ideal 'StoreXNode' |
1007 |
1007 |
1008 // Check if 'mRule2' is a cisc-spill variant of this MatchRule |
1008 // Check if 'mRule2' is a cisc-spill variant of this MatchRule |
1009 int cisc_spill_match(FormDict &globals, RegisterForm *registers, |
1009 int matchrule_cisc_spill_match(FormDict &globals, RegisterForm* registers, |
1010 MatchRule *mRule2, const char * &operand, |
1010 MatchRule* mRule2, const char* &operand, |
1011 const char * ®_type); |
1011 const char* ®_type); |
1012 |
1012 |
1013 // Check if 'mRule2' is equivalent to this MatchRule |
1013 // Check if 'mRule2' is equivalent to this MatchRule |
1014 bool equivalent(FormDict &globals, MatchRule *mRule2); |
1014 virtual bool equivalent(FormDict& globals, MatchNode* mRule2); |
1015 |
1015 |
1016 void swap_commutative_op(const char* instr_ident, int count, int& match_rules_cnt); |
1016 void matchrule_swap_commutative_op(const char* instr_ident, int count, int& match_rules_cnt); |
1017 |
1017 |
1018 void dump(); |
1018 void dump(); |
1019 void output(FILE *fp); |
1019 void output(FILE *fp); |
1020 }; |
1020 }; |
1021 |
1021 |