comparison src/share/vm/adlc/formssel.hpp @ 628:7bb995fbd3c0

Merge
author trims
date Thu, 12 Mar 2009 18:16:36 -0700
parents 98cb887364d3
children f9094a5e1c8a
comparison
equal deleted inserted replaced
580:ce2272390558 628:7bb995fbd3c0
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.
99 FormatRule *_format; // Format for assembly generation 99 FormatRule *_format; // Format for assembly generation
100 Peephole *_peephole; // List of peephole rules for instruction 100 Peephole *_peephole; // List of peephole rules for instruction
101 const char *_ins_pipe; // Instruction Scheduline description class 101 const char *_ins_pipe; // Instruction Scheduline description class
102 102
103 uint *_uniq_idx; // Indexes of unique operands 103 uint *_uniq_idx; // Indexes of unique operands
104 int _uniq_idx_length; // Length of _uniq_idx array
104 uint _num_uniq; // Number of unique operands 105 uint _num_uniq; // Number of unique operands
105 ComponentList _components; // List of Components matches MachNode's 106 ComponentList _components; // List of Components matches MachNode's
106 // operand structure 107 // operand structure
107 108
108 // Public Methods 109 // Public Methods
255 256
256 // Seach through operands to determine operands unique positions. 257 // Seach through operands to determine operands unique positions.
257 void set_unique_opnds(); 258 void set_unique_opnds();
258 uint num_unique_opnds() { return _num_uniq; } 259 uint num_unique_opnds() { return _num_uniq; }
259 uint unique_opnds_idx(int idx) { 260 uint unique_opnds_idx(int idx) {
260 if( _uniq_idx != NULL && idx > 0 ) 261 if( _uniq_idx != NULL && idx > 0 ) {
262 assert(idx < _uniq_idx_length, "out of bounds");
261 return _uniq_idx[idx]; 263 return _uniq_idx[idx];
262 else 264 } else {
263 return idx; 265 return idx;
264 } 266 }
267 }
265 268
266 // Operands which are only KILLs aren't part of the input array and 269 // Operands which are only KILLs aren't part of the input array and
267 // require special handling in some cases. Their position in this 270 // require special handling in some cases. Their position in this
268 // operand list is higher than the number of unique operands. 271 // operand list is higher than the number of unique operands.
269 bool is_noninput_operand(uint idx) { 272 bool is_noninput_operand(uint idx) {
272 275
273 // --------------------------- FILE *output_routines 276 // --------------------------- FILE *output_routines
274 // 277 //
275 // Generate the format call for the replacement variable 278 // Generate the format call for the replacement variable
276 void rep_var_format(FILE *fp, const char *rep_var); 279 void rep_var_format(FILE *fp, const char *rep_var);
277 // Generate index values needed for determing the operand position 280 // Generate index values needed for determining the operand position
278 void index_temps (FILE *fp, FormDict &globals, const char *prefix = "", const char *receiver = ""); 281 void index_temps (FILE *fp, FormDict &globals, const char *prefix = "", const char *receiver = "");
279 // --------------------------- 282 // ---------------------------
280 283
281 virtual bool verify(); // Check consistency after parsing 284 virtual bool verify(); // Check consistency after parsing
282 285
339 int rep_var_index(const char *rep_var); 342 int rep_var_index(const char *rep_var);
340 int num_args() { return _parameter_name.count(); } 343 int num_args() { return _parameter_name.count(); }
341 344
342 // --------------------------- Code Block 345 // --------------------------- Code Block
343 // Add code 346 // Add code
344 void add_code(const char *string_preceeding_replacement_var); 347 void add_code(const char *string_preceding_replacement_var);
345 // Add a replacement variable or one of its subfields 348 // Add a replacement variable or one of its subfields
346 // Subfields are stored with a leading '$' 349 // Subfields are stored with a leading '$'
347 void add_rep_var(char *replacement_var); 350 void add_rep_var(char *replacement_var);
348 351
349 bool verify(); 352 bool verify();
915 918
916 // return 0 if not found: 919 // return 0 if not found:
917 // 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
918 bool find_name(const char *str, int &position) const; 921 bool find_name(const char *str, int &position) const;
919 bool find_type(const char *str, int &position) const; 922 bool find_type(const char *str, int &position) const;
920 void append_components(FormDict &locals, ComponentList &components, 923 virtual void append_components(FormDict& locals, ComponentList& components,
921 bool def_flag) const; 924 bool def_flag = false) const;
922 bool base_operand(uint &position, FormDict &globals, 925 bool base_operand(uint &position, FormDict &globals,
923 const char * &result, const char * &name, 926 const char * &result, const char * &name,
924 const char * &opType) const; 927 const char * &opType) const;
925 // recursive count on operands 928 // recursive count on operands
926 uint num_consts(FormDict &globals) const; 929 uint num_consts(FormDict &globals) const;
942 bool sets_result() const; // rule "Set"s result of match 945 bool sets_result() const; // rule "Set"s result of match
943 const char *reduce_right(FormDict &globals) const; 946 const char *reduce_right(FormDict &globals) const;
944 const char *reduce_left (FormDict &globals) const; 947 const char *reduce_left (FormDict &globals) const;
945 948
946 // Recursive version of check in MatchRule 949 // Recursive version of check in MatchRule
947 int cisc_spill_match(FormDict &globals, RegisterForm *registers, 950 int cisc_spill_match(FormDict& globals, RegisterForm* registers,
948 MatchNode *mRule2, const char * &operand, 951 MatchNode* mRule2, const char* &operand,
949 const char * &reg_type); 952 const char* &reg_type);
950 int cisc_spill_merge(int left_result, int right_result); 953 int cisc_spill_merge(int left_result, int right_result);
951 954
952 bool equivalent(FormDict &globals, MatchNode *mNode2); 955 virtual bool equivalent(FormDict& globals, MatchNode* mNode2);
953 956
954 void count_commutative_op(int& count); 957 void count_commutative_op(int& count);
955 void swap_commutative_op(bool atroot, int count); 958 void swap_commutative_op(bool atroot, int count);
956 959
957 void dump(); 960 void dump();
974 MatchRule(ArchDesc &ad); 977 MatchRule(ArchDesc &ad);
975 MatchRule(ArchDesc &ad, MatchRule* mRule); // Shallow copy constructor; 978 MatchRule(ArchDesc &ad, MatchRule* mRule); // Shallow copy constructor;
976 MatchRule(ArchDesc &ad, MatchNode* mroot, int depth, char* construct, int numleaves); 979 MatchRule(ArchDesc &ad, MatchNode* mroot, int depth, char* construct, int numleaves);
977 ~MatchRule(); 980 ~MatchRule();
978 981
979 void append_components(FormDict &locals, ComponentList &components) const; 982 virtual void append_components(FormDict& locals, ComponentList& components, bool def_flag = false) const;
980 // Recursive call on all operands' match rules in my match rule. 983 // Recursive call on all operands' match rules in my match rule.
981 bool base_operand(uint &position, FormDict &globals, 984 bool base_operand(uint &position, FormDict &globals,
982 const char * &result, const char * &name, 985 const char * &result, const char * &name,
983 const char * &opType) const; 986 const char * &opType) const;
984 987
1001 bool is_ideal_bool() const; // node matches ideal 'Bool' 1004 bool is_ideal_bool() const; // node matches ideal 'Bool'
1002 Form::DataType is_ideal_load() const;// node matches ideal 'LoadXNode' 1005 Form::DataType is_ideal_load() const;// node matches ideal 'LoadXNode'
1003 Form::DataType is_ideal_store() const;// node matches ideal 'StoreXNode' 1006 Form::DataType is_ideal_store() const;// node matches ideal 'StoreXNode'
1004 1007
1005 // Check if 'mRule2' is a cisc-spill variant of this MatchRule 1008 // Check if 'mRule2' is a cisc-spill variant of this MatchRule
1006 int cisc_spill_match(FormDict &globals, RegisterForm *registers, 1009 int matchrule_cisc_spill_match(FormDict &globals, RegisterForm* registers,
1007 MatchRule *mRule2, const char * &operand, 1010 MatchRule* mRule2, const char* &operand,
1008 const char * &reg_type); 1011 const char* &reg_type);
1009 1012
1010 // Check if 'mRule2' is equivalent to this MatchRule 1013 // Check if 'mRule2' is equivalent to this MatchRule
1011 bool equivalent(FormDict &globals, MatchRule *mRule2); 1014 virtual bool equivalent(FormDict& globals, MatchNode* mRule2);
1012 1015
1013 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);
1014 1017
1015 void dump(); 1018 void dump();
1016 void output(FILE *fp); 1019 void output(FILE *fp);
1017 }; 1020 };
1018 1021