Mercurial > hg > graal-jvmci-8
comparison src/share/vm/adlc/output_c.cpp @ 23049:a1642365d69f
8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
Summary: Introduce a new register class, reg_class_dynamic, that supports also cist-spillable masks.
Reviewed-by: kvn, dlong, roland
author | zmajo |
---|---|
date | Fri, 27 Mar 2015 10:57:42 +0100 |
parents | 62c54fcc0a35 |
children | dd9cc155639c |
comparison
equal
deleted
inserted
replaced
23048:173f9910da57 | 23049:a1642365d69f |
---|---|
153 // Generate a list of register masks, one for each class. | 153 // Generate a list of register masks, one for each class. |
154 fprintf(fp_hpp,"\n"); | 154 fprintf(fp_hpp,"\n"); |
155 fprintf(fp_hpp,"// Register masks, one for each register class.\n"); | 155 fprintf(fp_hpp,"// Register masks, one for each register class.\n"); |
156 _register->_rclasses.reset(); | 156 _register->_rclasses.reset(); |
157 for (rc_name = NULL; (rc_name = _register->_rclasses.iter()) != NULL;) { | 157 for (rc_name = NULL; (rc_name = _register->_rclasses.iter()) != NULL;) { |
158 const char *prefix = ""; | |
159 RegClass *reg_class = _register->getRegClass(rc_name); | 158 RegClass *reg_class = _register->getRegClass(rc_name); |
160 assert(reg_class, "Using an undefined register class"); | 159 assert(reg_class, "Using an undefined register class"); |
161 | 160 reg_class->declare_register_masks(fp_hpp); |
162 const char* rc_name_to_upper = toUpper(rc_name); | |
163 | |
164 if (reg_class->_user_defined == NULL) { | |
165 fprintf(fp_hpp, "extern const RegMask _%s%s_mask;\n", prefix, rc_name_to_upper); | |
166 fprintf(fp_hpp, "inline const RegMask &%s%s_mask() { return _%s%s_mask; }\n", prefix, rc_name_to_upper, prefix, rc_name_to_upper); | |
167 } else { | |
168 fprintf(fp_hpp, "inline const RegMask &%s%s_mask() { %s }\n", prefix, rc_name_to_upper, reg_class->_user_defined); | |
169 } | |
170 | |
171 if (reg_class->_stack_or_reg) { | |
172 assert(reg_class->_user_defined == NULL, "no user defined reg class here"); | |
173 fprintf(fp_hpp, "extern const RegMask _%sSTACK_OR_%s_mask;\n", prefix, rc_name_to_upper); | |
174 fprintf(fp_hpp, "inline const RegMask &%sSTACK_OR_%s_mask() { return _%sSTACK_OR_%s_mask; }\n", prefix, rc_name_to_upper, prefix, rc_name_to_upper); | |
175 } | |
176 delete[] rc_name_to_upper; | |
177 | |
178 } | 161 } |
179 } | 162 } |
180 } | 163 } |
181 | 164 |
182 // Generate an enumeration of user-defined register classes | 165 // Generate an enumeration of user-defined register classes |
188 // Generate a list of register masks, one for each class. | 171 // Generate a list of register masks, one for each class. |
189 fprintf(fp_cpp,"\n"); | 172 fprintf(fp_cpp,"\n"); |
190 fprintf(fp_cpp,"// Register masks, one for each register class.\n"); | 173 fprintf(fp_cpp,"// Register masks, one for each register class.\n"); |
191 _register->_rclasses.reset(); | 174 _register->_rclasses.reset(); |
192 for (rc_name = NULL; (rc_name = _register->_rclasses.iter()) != NULL;) { | 175 for (rc_name = NULL; (rc_name = _register->_rclasses.iter()) != NULL;) { |
193 const char *prefix = ""; | |
194 RegClass *reg_class = _register->getRegClass(rc_name); | 176 RegClass *reg_class = _register->getRegClass(rc_name); |
195 assert(reg_class, "Using an undefined register class"); | 177 assert(reg_class, "Using an undefined register class"); |
196 | 178 reg_class->build_register_masks(fp_cpp); |
197 if (reg_class->_user_defined != NULL) { | |
198 continue; | |
199 } | |
200 | |
201 int len = RegisterForm::RegMask_Size(); | |
202 const char* rc_name_to_upper = toUpper(rc_name); | |
203 fprintf(fp_cpp, "const RegMask _%s%s_mask(", prefix, rc_name_to_upper); | |
204 | |
205 { | |
206 int i; | |
207 for(i = 0; i < len - 1; i++) { | |
208 fprintf(fp_cpp," 0x%x,", reg_class->regs_in_word(i, false)); | |
209 } | |
210 fprintf(fp_cpp," 0x%x );\n", reg_class->regs_in_word(i, false)); | |
211 } | |
212 | |
213 if (reg_class->_stack_or_reg) { | |
214 int i; | |
215 fprintf(fp_cpp, "const RegMask _%sSTACK_OR_%s_mask(", prefix, rc_name_to_upper); | |
216 for(i = 0; i < len - 1; i++) { | |
217 fprintf(fp_cpp," 0x%x,",reg_class->regs_in_word(i, true)); | |
218 } | |
219 fprintf(fp_cpp," 0x%x );\n",reg_class->regs_in_word(i, true)); | |
220 } | |
221 delete[] rc_name_to_upper; | |
222 } | 179 } |
223 } | 180 } |
224 } | 181 } |
225 | 182 |
226 // Compute an index for an array in the pipeline_reads_NNN arrays | 183 // Compute an index for an array in the pipeline_reads_NNN arrays |