Mercurial > hg > graal-compiler
annotate src/share/vm/adlc/formssel.hpp @ 17839:5cf196cc5405
8026334: hs_err improvement: Print elapsed time in a humanly readable format
Reviewed-by: coleenp, dsamersoff
Contributed-by: masato.yoshida@oracle.com
author | dbuck |
---|---|
date | Sat, 05 Apr 2014 23:38:24 -0700 |
parents | a9becfeecd1b |
children | 4ca6dc0799b6 |
rev | line source |
---|---|
0 | 1 /* |
17467
55fb97c4c58d
8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013
mikael
parents:
12323
diff
changeset
|
2 * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
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 | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1541
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1541
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1541
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef SHARE_VM_ADLC_FORMSSEL_HPP |
26 #define SHARE_VM_ADLC_FORMSSEL_HPP | |
27 | |
0 | 28 // FORMSSEL.HPP - ADL Parser Instruction Selection Forms Classes |
29 | |
30 // Class List | |
31 class Form; | |
32 class InstructForm; | |
33 class MachNodeForm; | |
34 class OperandForm; | |
35 class OpClassForm; | |
36 class AttributeForm; | |
37 class RegisterForm; | |
38 class PipelineForm; | |
39 class SourceForm; | |
40 class EncodeForm; | |
41 class Component; | |
42 class Constraint; | |
43 class Predicate; | |
44 class MatchRule; | |
45 class Attribute; | |
46 class Effect; | |
47 class ExpandRule; | |
48 class RewriteRule; | |
49 class ConstructRule; | |
50 class FormatRule; | |
51 class Peephole; | |
52 class EncClass; | |
53 class Interface; | |
54 class RegInterface; | |
55 class ConstInterface; | |
56 class MemInterface; | |
57 class CondInterface; | |
58 class Opcode; | |
59 class InsEncode; | |
60 class RegDef; | |
61 class RegClass; | |
62 class AllocClass; | |
63 class ResourceForm; | |
64 class PipeDesc; | |
65 class PipeClass; | |
66 class PeepMatch; | |
67 class PeepConstraint; | |
68 class PeepReplace; | |
69 class MatchList; | |
70 | |
71 class ArchDesc; | |
72 | |
73 //==============================Instructions=================================== | |
74 //------------------------------InstructForm----------------------------------- | |
75 class InstructForm : public Form { | |
76 private: | |
2008 | 77 bool _ideal_only; // Not a user-defined instruction |
0 | 78 // Members used for tracking CISC-spilling |
6850 | 79 int _cisc_spill_operand;// Which operand may cisc-spill |
0 | 80 void set_cisc_spill_operand(uint op_index) { _cisc_spill_operand = op_index; } |
2008 | 81 bool _is_cisc_alternate; |
0 | 82 InstructForm *_cisc_spill_alternate;// cisc possible replacement |
83 const char *_cisc_reg_mask_name; | |
84 InstructForm *_short_branch_form; | |
85 bool _is_short_branch; | |
14434
318d0622a6d7
8028580: PPC64 (part 114/120): Support for Call nodes with constants.
goetz
parents:
14428
diff
changeset
|
86 bool _is_mach_constant; // True if Node is a MachConstantNode. |
318d0622a6d7
8028580: PPC64 (part 114/120): Support for Call nodes with constants.
goetz
parents:
14428
diff
changeset
|
87 bool _needs_constant_base; // True if Node needs the mach_constant_base input. |
0 | 88 uint _alignment; |
89 | |
90 public: | |
91 // Public Data | |
14428
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12323
diff
changeset
|
92 const char *_ident; // Name of this instruction |
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12323
diff
changeset
|
93 NameList _parameters; // Locally defined names |
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12323
diff
changeset
|
94 FormDict _localNames; // Table of operands & their types |
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12323
diff
changeset
|
95 MatchRule *_matrule; // Matching rule for this instruction |
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12323
diff
changeset
|
96 Opcode *_opcode; // Encoding of the opcode for instruction |
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12323
diff
changeset
|
97 char *_size; // Size of instruction |
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12323
diff
changeset
|
98 InsEncode *_insencode; // Encoding class instruction belongs to |
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12323
diff
changeset
|
99 InsEncode *_constant; // Encoding class constant value belongs to |
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12323
diff
changeset
|
100 bool _is_postalloc_expand; // Indicates that encoding just does a lateExpand. |
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12323
diff
changeset
|
101 Attribute *_attribs; // List of Attribute rules |
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12323
diff
changeset
|
102 Predicate *_predicate; // Predicate test for this instruction |
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12323
diff
changeset
|
103 FormDict _effects; // Dictionary of effect rules |
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12323
diff
changeset
|
104 ExpandRule *_exprule; // Expand rule for this instruction |
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12323
diff
changeset
|
105 RewriteRule *_rewrule; // Rewrite rule for this instruction |
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12323
diff
changeset
|
106 FormatRule *_format; // Format for assembly generation |
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12323
diff
changeset
|
107 Peephole *_peephole; // List of peephole rules for instruction |
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12323
diff
changeset
|
108 const char *_ins_pipe; // Instruction Scheduling description class |
0 | 109 |
14428
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12323
diff
changeset
|
110 uint *_uniq_idx; // Indexes of unique operands |
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12323
diff
changeset
|
111 uint _uniq_idx_length; // Length of _uniq_idx array |
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12323
diff
changeset
|
112 uint _num_uniq; // Number of unique operands |
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12323
diff
changeset
|
113 ComponentList _components; // List of Components matches MachNode's |
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12323
diff
changeset
|
114 // operand structure |
0 | 115 |
14428
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12323
diff
changeset
|
116 bool _has_call; // contain a call and caller save registers should be saved? |
4120
f03a3c8bd5e5
7077312: Provide a CALL effect for instruct declaration in the ad file
roland
parents:
3842
diff
changeset
|
117 |
0 | 118 // Public Methods |
119 InstructForm(const char *id, bool ideal_only = false); | |
120 InstructForm(const char *id, InstructForm *instr, MatchRule *rule); | |
121 ~InstructForm(); | |
122 | |
123 // Dynamic type check | |
124 virtual InstructForm *is_instruction() const; | |
125 | |
126 virtual bool ideal_only() const; | |
127 | |
128 // This instruction sets a result | |
129 virtual bool sets_result() const; | |
130 // This instruction needs projections for additional DEFs or KILLs | |
131 virtual bool needs_projections(); | |
132 // This instruction needs extra nodes for temporary inputs | |
133 virtual bool has_temps(); | |
134 // This instruction defines or kills more than one object | |
135 virtual uint num_defs_or_kills(); | |
136 // This instruction has an expand rule? | |
137 virtual bool expands() const ; | |
14428
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12323
diff
changeset
|
138 // This instruction has a late expand rule? |
044b28168e20
8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents:
12323
diff
changeset
|
139 virtual bool postalloc_expands() const; |
0 | 140 // Return this instruction's first peephole rule, or NULL |
141 virtual Peephole *peepholes() const; | |
142 // Add a peephole rule to this instruction | |
143 virtual void append_peephole(Peephole *peep); | |
144 | |
145 virtual bool is_pinned(FormDict &globals); // should be pinned inside block | |
146 virtual bool is_projection(FormDict &globals); // node requires projection | |
147 virtual bool is_parm(FormDict &globals); // node matches ideal 'Parm' | |
148 // ideal opcode enumeration | |
149 virtual const char *ideal_Opcode(FormDict &globals) const; | |
150 virtual int is_expensive() const; // node matches ideal 'CosD' | |
151 virtual int is_empty_encoding() const; // _size=0 and/or _insencode empty | |
152 virtual int is_tls_instruction() const; // tlsLoadP rule or ideal ThreadLocal | |
153 virtual int is_ideal_copy() const; // node matches ideal 'Copy*' | |
11002
7fa25f5575c9
8016157: During CTW: C2: assert(!def_outside->member(r)) failed: Use of external LRG overlaps the same LRG defined in this block
adlertz
parents:
10389
diff
changeset
|
154 virtual bool is_ideal_negD() const; // node matches ideal 'NegD' |
0 | 155 virtual bool is_ideal_if() const; // node matches ideal 'If' |
156 virtual bool is_ideal_fastlock() const; // node matches 'FastLock' | |
157 virtual bool is_ideal_membar() const; // node matches ideal 'MemBarXXX' | |
158 virtual bool is_ideal_loadPC() const; // node matches ideal 'LoadPC' | |
159 virtual bool is_ideal_box() const; // node matches ideal 'Box' | |
160 virtual bool is_ideal_goto() const; // node matches ideal 'Goto' | |
161 virtual bool is_ideal_branch() const; // "" 'If' | 'Goto' | 'LoopEnd' | 'Jump' | |
162 virtual bool is_ideal_jump() const; // node matches ideal 'Jump' | |
163 virtual bool is_ideal_return() const; // node matches ideal 'Return' | |
164 virtual bool is_ideal_halt() const; // node matches ideal 'Halt' | |
165 virtual bool is_ideal_safepoint() const; // node matches 'SafePoint' | |
166 virtual bool is_ideal_nop() const; // node matches 'Nop' | |
167 virtual bool is_ideal_control() const; // control node | |
6179
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
4120
diff
changeset
|
168 virtual bool is_vector() const; // vector instruction |
0 | 169 |
170 virtual Form::CallType is_ideal_call() const; // matches ideal 'Call' | |
171 virtual Form::DataType is_ideal_load() const; // node matches ideal 'LoadXNode' | |
855
f9094a5e1c8a
6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
605
diff
changeset
|
172 // Should antidep checks be disabled for this Instruct |
f9094a5e1c8a
6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
605
diff
changeset
|
173 // See definition of MatchRule::skip_antidep_check |
f9094a5e1c8a
6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
605
diff
changeset
|
174 bool skip_antidep_check() const; |
0 | 175 virtual Form::DataType is_ideal_store() const;// node matches ideal 'StoreXNode' |
176 bool is_ideal_mem() const { return is_ideal_load() != Form::none || is_ideal_store() != Form::none; } | |
177 virtual uint two_address(FormDict &globals); // output reg must match input reg | |
178 // when chaining a constant to an instruction, return 'true' and set opType | |
179 virtual Form::DataType is_chain_of_constant(FormDict &globals); | |
180 virtual Form::DataType is_chain_of_constant(FormDict &globals, const char * &opType); | |
181 virtual Form::DataType is_chain_of_constant(FormDict &globals, const char * &opType, const char * &result_type); | |
182 | |
183 // Check if a simple chain rule | |
184 virtual bool is_simple_chain_rule(FormDict &globals) const; | |
185 | |
186 // check for structural rematerialization | |
187 virtual bool rematerialize(FormDict &globals, RegisterForm *registers); | |
188 | |
189 // loads from memory, so must check for anti-dependence | |
190 virtual bool needs_anti_dependence_check(FormDict &globals) const; | |
191 virtual int memory_operand(FormDict &globals) const; | |
192 bool is_wide_memory_kill(FormDict &globals) const; | |
193 | |
194 enum memory_operand_type { | |
195 NO_MEMORY_OPERAND = -1, | |
196 MANY_MEMORY_OPERANDS = 999999 | |
197 }; | |
198 | |
199 | |
200 // This instruction captures the machine-independent bottom_type | |
201 // Expected use is for pointer vs oop determination for LoadP | |
1541
b5fdf39b9749
6953576: bottom_type for matched AddPNodes doesn't always agree with ideal
never
parents:
855
diff
changeset
|
202 virtual bool captures_bottom_type(FormDict& globals) const; |
0 | 203 |
204 virtual const char *cost(); // Access ins_cost attribute | |
205 virtual uint num_opnds(); // Count of num_opnds for MachNode class | |
6850 | 206 // Counts USE_DEF opnds twice. See also num_unique_opnds(). |
0 | 207 virtual uint num_post_match_opnds(); |
208 virtual uint num_consts(FormDict &globals) const;// Constants in match rule | |
209 // Constants in match rule with specified type | |
210 virtual uint num_consts(FormDict &globals, Form::DataType type) const; | |
211 | |
212 // Return the register class associated with 'leaf'. | |
213 virtual const char *out_reg_class(FormDict &globals); | |
214 | |
215 // number of ideal node inputs to skip | |
216 virtual uint oper_input_base(FormDict &globals); | |
217 | |
218 // Does this instruction need a base-oop edge? | |
219 int needs_base_oop_edge(FormDict &globals) const; | |
220 | |
221 // Build instruction predicates. If the user uses the same operand name | |
222 // twice, we need to check that the operands are pointer-eequivalent in | |
223 // the DFA during the labeling process. | |
224 Predicate *build_predicate(); | |
225 | |
226 virtual void build_components(); // top-level operands | |
227 // Return zero-based position in component list; -1 if not in list. | |
228 virtual int operand_position(const char *name, int usedef); | |
229 virtual int operand_position_format(const char *name); | |
230 | |
231 // Return zero-based position in component list; -1 if not in list. | |
232 virtual int label_position(); | |
233 virtual int method_position(); | |
234 // Return number of relocation entries needed for this instruction. | |
235 virtual uint reloc(FormDict &globals); | |
236 | |
6850 | 237 const char *opnd_ident(int idx); // Name of operand #idx. |
0 | 238 const char *reduce_result(); |
239 // Return the name of the operand on the right hand side of the binary match | |
240 // Return NULL if there is no right hand side | |
241 const char *reduce_right(FormDict &globals) const; | |
242 const char *reduce_left(FormDict &globals) const; | |
243 | |
244 // Base class for this instruction, MachNode except for calls | |
1541
b5fdf39b9749
6953576: bottom_type for matched AddPNodes doesn't always agree with ideal
never
parents:
855
diff
changeset
|
245 virtual const char *mach_base_class(FormDict &globals) const; |
0 | 246 |
247 // Check if this instruction can cisc-spill to 'alternate' | |
248 bool cisc_spills_to(ArchDesc &AD, InstructForm *alternate); | |
249 InstructForm *cisc_spill_alternate() { return _cisc_spill_alternate; } | |
6850 | 250 int cisc_spill_operand() const { return _cisc_spill_operand; } |
0 | 251 bool is_cisc_alternate() const { return _is_cisc_alternate; } |
252 void set_cisc_alternate(bool val) { _is_cisc_alternate = val; } | |
253 const char *cisc_reg_mask_name() const { return _cisc_reg_mask_name; } | |
254 void set_cisc_reg_mask_name(const char *rm_name) { _cisc_reg_mask_name = rm_name; } | |
255 // Output cisc-method prototypes and method bodies | |
256 void declare_cisc_version(ArchDesc &AD, FILE *fp_cpp); | |
257 bool define_cisc_version (ArchDesc &AD, FILE *fp_cpp); | |
258 | |
259 bool check_branch_variant(ArchDesc &AD, InstructForm *short_branch); | |
260 | |
261 bool is_short_branch() { return _is_short_branch; } | |
262 void set_short_branch(bool val) { _is_short_branch = val; } | |
263 | |
2008 | 264 bool is_mach_constant() const { return _is_mach_constant; } |
265 void set_is_mach_constant(bool x) { _is_mach_constant = x; } | |
14434
318d0622a6d7
8028580: PPC64 (part 114/120): Support for Call nodes with constants.
goetz
parents:
14428
diff
changeset
|
266 bool needs_constant_base() const { return _needs_constant_base; } |
318d0622a6d7
8028580: PPC64 (part 114/120): Support for Call nodes with constants.
goetz
parents:
14428
diff
changeset
|
267 void set_needs_constant_base(bool x) { _needs_constant_base = x; } |
2008 | 268 |
0 | 269 InstructForm *short_branch_form() { return _short_branch_form; } |
270 bool has_short_branch_form() { return _short_branch_form != NULL; } | |
271 // Output short branch prototypes and method bodies | |
272 void declare_short_branch_methods(FILE *fp_cpp); | |
1541
b5fdf39b9749
6953576: bottom_type for matched AddPNodes doesn't always agree with ideal
never
parents:
855
diff
changeset
|
273 bool define_short_branch_methods(ArchDesc &AD, FILE *fp_cpp); |
0 | 274 |
275 uint alignment() { return _alignment; } | |
276 void set_alignment(uint val) { _alignment = val; } | |
277 | |
278 // Seach through operands to determine operands unique positions. | |
279 void set_unique_opnds(); | |
280 uint num_unique_opnds() { return _num_uniq; } | |
281 uint unique_opnds_idx(int idx) { | |
10389 | 282 if (_uniq_idx != NULL && idx > 0) { |
283 assert((uint)idx < _uniq_idx_length, "out of bounds"); | |
284 return _uniq_idx[idx]; | |
285 } else { | |
286 return idx; | |
287 } | |
599
0ad1cb407fa1
6805427: adlc compiler may generate incorrect machnode emission code
never
parents:
470
diff
changeset
|
288 } |
10389 | 289 const char *unique_opnd_ident(uint idx); // Name of operand at unique idx. |
0 | 290 |
291 // Operands which are only KILLs aren't part of the input array and | |
292 // require special handling in some cases. Their position in this | |
293 // operand list is higher than the number of unique operands. | |
294 bool is_noninput_operand(uint idx) { | |
295 return (idx >= num_unique_opnds()); | |
296 } | |
297 | |
298 // --------------------------- FILE *output_routines | |
299 // | |
300 // Generate the format call for the replacement variable | |
301 void rep_var_format(FILE *fp, const char *rep_var); | |
605 | 302 // Generate index values needed for determining the operand position |
0 | 303 void index_temps (FILE *fp, FormDict &globals, const char *prefix = "", const char *receiver = ""); |
304 // --------------------------- | |
305 | |
306 virtual bool verify(); // Check consistency after parsing | |
307 | |
308 virtual void dump(); // Debug printer | |
309 virtual void output(FILE *fp); // Write to output files | |
310 }; | |
311 | |
312 //------------------------------EncodeForm------------------------------------- | |
313 class EncodeForm : public Form { | |
314 private: | |
315 | |
316 public: | |
317 // Public Data | |
318 NameList _eclasses; // List of encode class names | |
319 Dict _encClass; // Map encode class names to EncClass objects | |
320 | |
321 // Public Methods | |
322 EncodeForm(); | |
323 ~EncodeForm(); | |
324 | |
325 EncClass *add_EncClass(const char *className); | |
326 EncClass *encClass(const char *className); | |
327 | |
328 const char *encClassPrototype(const char *className); | |
329 const char *encClassBody(const char *className); | |
330 | |
331 void dump(); // Debug printer | |
332 void output(FILE *fp); // Write info to output files | |
333 }; | |
334 | |
335 //------------------------------EncClass--------------------------------------- | |
336 class EncClass : public Form { | |
337 public: | |
338 // NameList for parameter type and name | |
339 NameList _parameter_type; | |
340 NameList _parameter_name; | |
341 | |
342 // Breakdown the encoding into strings separated by $replacement_variables | |
343 // There is an entry in _strings, perhaps NULL, that precedes each _rep_vars | |
344 NameList _code; // Strings passed through to tty->print | |
345 NameList _rep_vars; // replacement variables | |
346 | |
347 NameList _parameters; // Locally defined names | |
348 FormDict _localNames; // Table of components & their types | |
349 | |
350 public: | |
351 // Public Data | |
352 const char *_name; // encoding class name | |
353 | |
354 // Public Methods | |
355 EncClass(const char *name); | |
356 ~EncClass(); | |
357 | |
358 // --------------------------- Parameters | |
359 // Add a parameter <type,name> pair | |
360 void add_parameter(const char *parameter_type, const char *parameter_name); | |
361 // Verify operand types in parameter list | |
362 bool check_parameter_types(FormDict &globals); | |
363 // Obtain the zero-based index corresponding to a replacement variable | |
364 int rep_var_index(const char *rep_var); | |
365 int num_args() { return _parameter_name.count(); } | |
366 | |
367 // --------------------------- Code Block | |
368 // Add code | |
605 | 369 void add_code(const char *string_preceding_replacement_var); |
0 | 370 // Add a replacement variable or one of its subfields |
371 // Subfields are stored with a leading '$' | |
372 void add_rep_var(char *replacement_var); | |
373 | |
374 bool verify(); | |
375 void dump(); | |
376 void output(FILE *fp); | |
377 }; | |
378 | |
379 //------------------------------MachNode--------------------------------------- | |
380 class MachNodeForm: public Form { | |
381 private: | |
382 | |
383 public: | |
384 char *_ident; // Name of this instruction | |
385 const char *_machnode_pipe; // Instruction Scheduline description class | |
386 | |
387 // Public Methods | |
388 MachNodeForm(char *id); | |
389 ~MachNodeForm(); | |
390 | |
391 virtual MachNodeForm *is_machnode() const; | |
392 | |
393 void dump(); // Debug printer | |
394 void output(FILE *fp); // Write info to output files | |
395 }; | |
396 | |
397 //------------------------------Opcode----------------------------------------- | |
398 class Opcode : public Form { | |
399 private: | |
400 | |
401 public: | |
402 // Public Data | |
403 // Strings representing instruction opcodes, user defines placement in emit | |
404 char *_primary; | |
405 char *_secondary; | |
406 char *_tertiary; | |
407 | |
408 enum opcode_type { | |
409 NOT_AN_OPCODE = -1, | |
410 PRIMARY = 1, | |
411 SECONDARY = 2, | |
412 TERTIARY = 3 | |
413 }; | |
414 | |
415 // Public Methods | |
416 Opcode(char *primary, char *secondary, char *tertiary); | |
417 ~Opcode(); | |
418 | |
419 static Opcode::opcode_type as_opcode_type(const char *designator); | |
420 | |
421 void dump(); | |
422 void output(FILE *fp); | |
423 | |
424 // --------------------------- FILE *output_routines | |
415
4d9884b01ba6
6754519: don't emit flag fixup for NaN when condition being tested doesn't need it
never
parents:
0
diff
changeset
|
425 bool print_opcode(FILE *fp, Opcode::opcode_type desired_opcode); |
0 | 426 }; |
427 | |
428 //------------------------------InsEncode-------------------------------------- | |
429 class InsEncode : public Form { | |
430 private: | |
431 // Public Data (access directly only for reads) | |
432 // The encodings can only have the values predefined by the ADLC: | |
433 // blank, RegReg, RegMem, MemReg, ... | |
434 NameList _encoding; | |
435 // NameList _parameter; | |
436 // The parameters for each encoding are preceeded by a NameList::_signal | |
437 // and follow the parameters for the previous encoding. | |
438 | |
439 // char *_encode; // Type of instruction encoding | |
440 | |
441 public: | |
442 // Public Methods | |
443 InsEncode(); | |
444 ~InsEncode(); | |
445 | |
446 // Add "encode class name" and its parameters | |
447 NameAndList *add_encode(char *encode_method_name); | |
448 // Parameters are added to the returned "NameAndList" by the parser | |
449 | |
450 // Access the list of encodings | |
451 void reset(); | |
452 const char *encode_class_iter(); | |
453 | |
454 // Returns the number of arguments to the current encoding in the iteration | |
455 int current_encoding_num_args() { | |
456 return ((NameAndList*)_encoding.current())->count(); | |
457 } | |
458 | |
459 // --------------------------- Parameters | |
460 // The following call depends upon position within encode_class_iteration | |
461 // | |
462 // Obtain parameter name from zero based index | |
463 const char *rep_var_name(InstructForm &inst, uint param_no); | |
464 // --------------------------- | |
465 | |
466 void dump(); | |
467 void output(FILE *fp); | |
468 }; | |
469 | |
470 //------------------------------Effect----------------------------------------- | |
471 class Effect : public Form { | |
472 private: | |
473 | |
474 public: | |
475 // Public Data | |
476 const char *_name; // Pre-defined name for effect | |
477 int _use_def; // Enumeration value of effect | |
478 | |
479 // Public Methods | |
480 Effect(const char *name); // Constructor | |
481 ~Effect(); // Destructor | |
482 | |
483 // Dynamic type check | |
484 virtual Effect *is_effect() const; | |
485 | |
486 // Return 'true' if this use def info equals the parameter | |
487 bool is(int use_def_kill_enum) const; | |
488 // Return 'true' if this use def info is a superset of parameter | |
489 bool isa(int use_def_kill_enum) const; | |
490 | |
491 void dump(); // Debug printer | |
492 void output(FILE *fp); // Write info to output files | |
493 }; | |
494 | |
495 //------------------------------ExpandRule------------------------------------- | |
496 class ExpandRule : public Form { | |
497 private: | |
498 NameList _expand_instrs; // ordered list of instructions and operands | |
499 | |
500 public: | |
501 // Public Data | |
502 NameList _newopers; // List of newly created operands | |
503 Dict _newopconst; // Map new operands to their constructors | |
504 | |
505 void add_instruction(NameAndList *instruction_name_and_operand_list); | |
506 void reset_instructions(); | |
507 NameAndList *iter_instructions(); | |
508 | |
509 // Public Methods | |
510 ExpandRule(); // Constructor | |
511 ~ExpandRule(); // Destructor | |
512 | |
513 void dump(); // Debug printer | |
514 void output(FILE *fp); // Write info to output files | |
515 }; | |
516 | |
517 //------------------------------RewriteRule------------------------------------ | |
518 class RewriteRule : public Form { | |
519 private: | |
520 | |
521 public: | |
522 // Public Data | |
523 SourceForm *_condition; // Rewrite condition code | |
524 InstructForm *_instrs; // List of instructions to expand to | |
525 OperandForm *_opers; // List of operands generated by expand | |
526 char *_tempParams; // Hold string until parser is finished. | |
527 char *_tempBlock; // Hold string until parser is finished. | |
528 | |
529 // Public Methods | |
530 RewriteRule(char* params, char* block) ; | |
531 ~RewriteRule(); // Destructor | |
532 void dump(); // Debug printer | |
533 void output(FILE *fp); // Write info to output files | |
534 }; | |
535 | |
536 | |
537 //==============================Operands======================================= | |
538 //------------------------------OpClassForm------------------------------------ | |
539 class OpClassForm : public Form { | |
540 public: | |
541 // Public Data | |
542 const char *_ident; // Name of this operand | |
543 NameList _oplst; // List of operand forms included in class | |
544 | |
545 // Public Methods | |
546 OpClassForm(const char *id); | |
547 ~OpClassForm(); | |
548 | |
549 // dynamic type check | |
550 virtual OpClassForm *is_opclass() const; | |
551 virtual Form::InterfaceType interface_type(FormDict &globals) const; | |
552 virtual bool stack_slots_only(FormDict &globals) const; | |
553 | |
554 virtual bool is_cisc_mem(FormDict &globals) const; | |
555 | |
556 | |
557 // Min and Max opcodes of operands in this operand class | |
558 int _minCode; | |
559 int _maxCode; | |
560 | |
561 virtual bool ideal_only() const; | |
562 virtual void dump(); // Debug printer | |
563 virtual void output(FILE *fp); // Write to output files | |
564 }; | |
565 | |
566 //------------------------------OperandForm------------------------------------ | |
567 class OperandForm : public OpClassForm { | |
568 private: | |
569 bool _ideal_only; // Not a user-defined instruction | |
570 | |
571 public: | |
572 // Public Data | |
573 NameList _parameters; // Locally defined names | |
574 FormDict _localNames; // Table of components & their types | |
575 MatchRule *_matrule; // Matching rule for this operand | |
576 Interface *_interface; // Encoding interface for this operand | |
577 Attribute *_attribs; // List of Attribute rules | |
578 Predicate *_predicate; // Predicate test for this operand | |
579 Constraint *_constraint; // Constraint Rule for this operand | |
580 ConstructRule *_construct; // Construction of operand data after matching | |
581 FormatRule *_format; // Format for assembly generation | |
582 NameList _classes; // List of opclasses which contain this oper | |
583 | |
584 ComponentList _components; // | |
585 | |
586 // Public Methods | |
587 OperandForm(const char *id); | |
588 OperandForm(const char *id, bool ideal_only); | |
589 ~OperandForm(); | |
590 | |
591 // Dynamic type check | |
592 virtual OperandForm *is_operand() const; | |
593 | |
594 virtual bool ideal_only() const; | |
595 virtual Form::InterfaceType interface_type(FormDict &globals) const; | |
596 virtual bool stack_slots_only(FormDict &globals) const; | |
597 | |
598 virtual const char *cost(); // Access ins_cost attribute | |
599 virtual uint num_leaves() const;// Leaves in complex operand | |
600 // Constants in operands' match rules | |
601 virtual uint num_consts(FormDict &globals) const; | |
602 // Constants in operand's match rule with specified type | |
603 virtual uint num_consts(FormDict &globals, Form::DataType type) const; | |
604 // Pointer Constants in operands' match rules | |
605 virtual uint num_const_ptrs(FormDict &globals) const; | |
606 // The number of input edges in the machine world == num_leaves - num_consts | |
607 virtual uint num_edges(FormDict &globals) const; | |
608 | |
609 // Check if this operand is usable for cisc-spilling | |
610 virtual bool is_cisc_reg(FormDict &globals) const; | |
611 | |
612 // node matches ideal 'Bool', grab condition codes from the ideal world | |
613 virtual bool is_ideal_bool() const; | |
614 | |
615 // Has an integer constant suitable for spill offsets | |
616 bool has_conI(FormDict &globals) const { | |
617 return (num_consts(globals,idealI) == 1) && !is_ideal_bool(); } | |
618 bool has_conL(FormDict &globals) const { | |
619 return (num_consts(globals,idealL) == 1) && !is_ideal_bool(); } | |
620 | |
621 // Node is user-defined operand for an sRegX | |
622 virtual Form::DataType is_user_name_for_sReg() const; | |
623 | |
624 // Return ideal type, if there is a single ideal type for this operand | |
625 virtual const char *ideal_type(FormDict &globals, RegisterForm *registers = NULL) const; | |
626 // If there is a single ideal type for this interface field, return it. | |
627 virtual const char *interface_ideal_type(FormDict &globals, | |
628 const char *field_name) const; | |
629 | |
630 // Return true if this operand represents a bound register class | |
631 bool is_bound_register() const; | |
632 | |
633 // Return the Register class for this operand. Returns NULL if | |
634 // operand isn't a register form. | |
635 RegClass* get_RegClass() const; | |
636 | |
637 virtual bool is_interface_field(const char *field_name, | |
638 const char * &value) const; | |
639 | |
640 // If this operand has a single ideal type, return its type | |
641 virtual Form::DataType simple_type(FormDict &globals) const; | |
642 // If this operand is an ideal constant, return its type | |
643 virtual Form::DataType is_base_constant(FormDict &globals) const; | |
644 | |
645 // "true" if this operand is a simple type that is swallowed | |
646 virtual bool swallowed(FormDict &globals) const; | |
647 | |
648 // Return register class name if a constraint specifies the register class. | |
649 virtual const char *constrained_reg_class() const; | |
650 // Return the register class associated with 'leaf'. | |
651 virtual const char *in_reg_class(uint leaf, FormDict &globals); | |
652 | |
653 // Build component list from MatchRule and operand's parameter list | |
654 virtual void build_components(); // top-level operands | |
655 | |
656 // Return zero-based position in component list; -1 if not in list. | |
657 virtual int operand_position(const char *name, int usedef); | |
658 | |
659 // Return zero-based position in component list; -1 if not in list. | |
660 virtual int constant_position(FormDict &globals, const Component *comp); | |
661 virtual int constant_position(FormDict &globals, const char *local_name); | |
662 // Return the operand form corresponding to the given index, else NULL. | |
663 virtual OperandForm *constant_operand(FormDict &globals, uint const_index); | |
664 | |
665 // Return zero-based position in component list; -1 if not in list. | |
666 virtual int register_position(FormDict &globals, const char *regname); | |
667 | |
668 const char *reduce_result() const; | |
669 // Return the name of the operand on the right hand side of the binary match | |
670 // Return NULL if there is no right hand side | |
671 const char *reduce_right(FormDict &globals) const; | |
672 const char *reduce_left(FormDict &globals) const; | |
673 | |
674 | |
675 // --------------------------- FILE *output_routines | |
676 // | |
677 // Output code for disp_is_oop, if true. | |
678 void disp_is_oop(FILE *fp, FormDict &globals); | |
679 // Generate code for internal and external format methods | |
680 void int_format(FILE *fp, FormDict &globals, uint index); | |
681 void ext_format(FILE *fp, FormDict &globals, uint index); | |
682 void format_constant(FILE *fp, uint con_index, uint con_type); | |
683 // Output code to access the value of the index'th constant | |
684 void access_constant(FILE *fp, FormDict &globals, | |
685 uint con_index); | |
686 // --------------------------- | |
687 | |
688 | |
689 virtual void dump(); // Debug printer | |
690 virtual void output(FILE *fp); // Write to output files | |
691 }; | |
692 | |
693 //------------------------------Constraint------------------------------------- | |
694 class Constraint : public Form { | |
695 private: | |
696 | |
697 public: | |
698 const char *_func; // Constraint function | |
699 const char *_arg; // function's argument | |
700 | |
701 // Public Methods | |
702 Constraint(const char *func, const char *arg); // Constructor | |
703 ~Constraint(); | |
704 | |
705 bool stack_slots_only() const; | |
706 | |
707 void dump(); // Debug printer | |
708 void output(FILE *fp); // Write info to output files | |
709 }; | |
710 | |
711 //------------------------------Predicate-------------------------------------- | |
712 class Predicate : public Form { | |
713 private: | |
714 | |
715 public: | |
716 // Public Data | |
717 char *_pred; // C++ source string for predicate | |
718 | |
719 // Public Methods | |
720 Predicate(char *pr); | |
721 ~Predicate(); | |
722 | |
723 void dump(); | |
724 void output(FILE *fp); | |
725 }; | |
726 | |
727 //------------------------------Interface-------------------------------------- | |
728 class Interface : public Form { | |
729 private: | |
730 | |
731 public: | |
732 // Public Data | |
733 const char *_name; // String representing the interface name | |
734 | |
735 // Public Methods | |
736 Interface(const char *name); | |
737 ~Interface(); | |
738 | |
739 virtual Form::InterfaceType interface_type(FormDict &globals) const; | |
740 | |
741 RegInterface *is_RegInterface(); | |
742 MemInterface *is_MemInterface(); | |
743 ConstInterface *is_ConstInterface(); | |
744 CondInterface *is_CondInterface(); | |
745 | |
746 | |
747 void dump(); | |
748 void output(FILE *fp); | |
749 }; | |
750 | |
751 //------------------------------RegInterface----------------------------------- | |
752 class RegInterface : public Interface { | |
753 private: | |
754 | |
755 public: | |
756 // Public Methods | |
757 RegInterface(); | |
758 ~RegInterface(); | |
759 | |
760 void dump(); | |
761 void output(FILE *fp); | |
762 }; | |
763 | |
764 //------------------------------ConstInterface--------------------------------- | |
765 class ConstInterface : public Interface { | |
766 private: | |
767 | |
768 public: | |
769 // Public Methods | |
770 ConstInterface(); | |
771 ~ConstInterface(); | |
772 | |
773 void dump(); | |
774 void output(FILE *fp); | |
775 }; | |
776 | |
777 //------------------------------MemInterface----------------------------------- | |
778 class MemInterface : public Interface { | |
779 private: | |
780 | |
781 public: | |
782 // Public Data | |
783 char *_base; // Base address | |
784 char *_index; // index | |
785 char *_scale; // scaling factor | |
786 char *_disp; // displacement | |
787 | |
788 // Public Methods | |
789 MemInterface(char *base, char *index, char *scale, char *disp); | |
790 ~MemInterface(); | |
791 | |
792 void dump(); | |
793 void output(FILE *fp); | |
794 }; | |
795 | |
796 //------------------------------CondInterface---------------------------------- | |
797 class CondInterface : public Interface { | |
798 private: | |
799 | |
800 public: | |
801 const char *_equal; | |
802 const char *_not_equal; | |
803 const char *_less; | |
804 const char *_greater_equal; | |
805 const char *_less_equal; | |
806 const char *_greater; | |
12323 | 807 const char *_overflow; |
808 const char *_no_overflow; | |
415
4d9884b01ba6
6754519: don't emit flag fixup for NaN when condition being tested doesn't need it
never
parents:
0
diff
changeset
|
809 const char *_equal_format; |
4d9884b01ba6
6754519: don't emit flag fixup for NaN when condition being tested doesn't need it
never
parents:
0
diff
changeset
|
810 const char *_not_equal_format; |
4d9884b01ba6
6754519: don't emit flag fixup for NaN when condition being tested doesn't need it
never
parents:
0
diff
changeset
|
811 const char *_less_format; |
4d9884b01ba6
6754519: don't emit flag fixup for NaN when condition being tested doesn't need it
never
parents:
0
diff
changeset
|
812 const char *_greater_equal_format; |
4d9884b01ba6
6754519: don't emit flag fixup for NaN when condition being tested doesn't need it
never
parents:
0
diff
changeset
|
813 const char *_less_equal_format; |
4d9884b01ba6
6754519: don't emit flag fixup for NaN when condition being tested doesn't need it
never
parents:
0
diff
changeset
|
814 const char *_greater_format; |
12323 | 815 const char *_overflow_format; |
816 const char *_no_overflow_format; | |
0 | 817 |
818 // Public Methods | |
415
4d9884b01ba6
6754519: don't emit flag fixup for NaN when condition being tested doesn't need it
never
parents:
0
diff
changeset
|
819 CondInterface(const char* equal, const char* equal_format, |
4d9884b01ba6
6754519: don't emit flag fixup for NaN when condition being tested doesn't need it
never
parents:
0
diff
changeset
|
820 const char* not_equal, const char* not_equal_format, |
4d9884b01ba6
6754519: don't emit flag fixup for NaN when condition being tested doesn't need it
never
parents:
0
diff
changeset
|
821 const char* less, const char* less_format, |
4d9884b01ba6
6754519: don't emit flag fixup for NaN when condition being tested doesn't need it
never
parents:
0
diff
changeset
|
822 const char* greater_equal, const char* greater_equal_format, |
4d9884b01ba6
6754519: don't emit flag fixup for NaN when condition being tested doesn't need it
never
parents:
0
diff
changeset
|
823 const char* less_equal, const char* less_equal_format, |
12323 | 824 const char* greater, const char* greater_format, |
825 const char* overflow, const char* overflow_format, | |
826 const char* no_overflow, const char* no_overflow_format); | |
0 | 827 ~CondInterface(); |
828 | |
829 void dump(); | |
830 void output(FILE *fp); | |
831 }; | |
832 | |
833 //------------------------------ConstructRule---------------------------------- | |
834 class ConstructRule : public Form { | |
835 private: | |
836 | |
837 public: | |
838 // Public Data | |
839 char *_expr; // String representing the match expression | |
840 char *_construct; // String representing C++ constructor code | |
841 | |
842 // Public Methods | |
843 ConstructRule(char *cnstr); | |
844 ~ConstructRule(); | |
845 | |
846 void dump(); | |
847 void output(FILE *fp); | |
848 }; | |
849 | |
850 | |
851 //==============================Shared========================================= | |
852 //------------------------------AttributeForm---------------------------------- | |
853 class AttributeForm : public Form { | |
854 private: | |
855 // counters for unique instruction or operand ID | |
856 static int _insId; // user-defined machine instruction types | |
857 static int _opId; // user-defined operand types | |
858 | |
859 int id; // hold type for this object | |
860 | |
861 public: | |
862 // Public Data | |
863 char *_attrname; // Name of attribute | |
864 int _atype; // Either INS_ATTR or OP_ATTR | |
865 char *_attrdef; // C++ source which evaluates to constant | |
866 | |
867 // Public Methods | |
868 AttributeForm(char *attr, int type, char *attrdef); | |
869 ~AttributeForm(); | |
870 | |
871 // Dynamic type check | |
872 virtual AttributeForm *is_attribute() const; | |
873 | |
874 int type() { return id;} // return this object's "id" | |
875 | |
876 static const char* _ins_cost; // "ins_cost" | |
877 static const char* _op_cost; // "op_cost" | |
878 | |
879 void dump(); // Debug printer | |
880 void output(FILE *fp); // Write output files | |
881 }; | |
882 | |
883 //------------------------------Component-------------------------------------- | |
884 class Component : public Form { | |
885 private: | |
886 | |
887 public: | |
888 // Public Data | |
889 const char *_name; // Name of this component | |
890 const char *_type; // Type of this component | |
891 int _usedef; // Value of component | |
892 | |
893 // Public Methods | |
894 Component(const char *name, const char *type, int usedef); | |
895 ~Component(); | |
896 | |
897 | |
898 // Return 'true' if this use def info equals the parameter | |
899 bool is(int use_def_kill_enum) const; | |
900 // Return 'true' if this use def info is a superset of parameter | |
901 bool isa(int use_def_kill_enum) const; | |
902 int promote_use_def_info(int new_use_def); | |
903 const char *base_type(FormDict &globals); | |
904 // Form::DataType is_base_constant(FormDict &globals); | |
905 | |
906 void dump(); // Debug printer | |
907 void output(FILE *fp); // Write to output files | |
6850 | 908 const char* getUsedefName(); |
0 | 909 |
910 public: | |
911 // Implementation depends upon working bit intersection and union. | |
912 enum use_def_enum { | |
913 INVALID = 0x0, | |
914 USE = 0x1, | |
915 DEF = 0x2, USE_DEF = 0x3, | |
916 KILL = 0x4, USE_KILL = 0x5, | |
917 SYNTHETIC = 0x8, | |
4120
f03a3c8bd5e5
7077312: Provide a CALL effect for instruct declaration in the ad file
roland
parents:
3842
diff
changeset
|
918 TEMP = USE | SYNTHETIC, |
f03a3c8bd5e5
7077312: Provide a CALL effect for instruct declaration in the ad file
roland
parents:
3842
diff
changeset
|
919 CALL = 0x10 |
0 | 920 }; |
921 }; | |
922 | |
923 | |
924 //------------------------------MatchNode-------------------------------------- | |
925 class MatchNode : public Form { | |
926 private: | |
927 | |
928 public: | |
929 // Public Data | |
930 const char *_result; // The name of the output of this node | |
931 const char *_name; // The name that appeared in the match rule | |
932 const char *_opType; // The Operation/Type matched | |
933 MatchNode *_lChild; // Left child in expression tree | |
934 MatchNode *_rChild; // Right child in expression tree | |
935 int _numleaves; // Sum of numleaves for all direct children | |
936 ArchDesc &_AD; // Reference to ArchDesc object | |
937 char *_internalop; // String representing internal operand | |
938 int _commutative_id; // id of commutative operation | |
939 | |
940 // Public Methods | |
941 MatchNode(ArchDesc &ad, const char *result = 0, const char *expr = 0, | |
942 const char *opType=0, MatchNode *lChild=NULL, | |
943 MatchNode *rChild=NULL); | |
944 MatchNode(ArchDesc &ad, MatchNode& mNode); // Shallow copy constructor; | |
945 MatchNode(ArchDesc &ad, MatchNode& mNode, int clone); // Construct clone | |
946 ~MatchNode(); | |
947 | |
948 // return 0 if not found: | |
949 // return 1 if found and position is incremented by operand offset in rule | |
950 bool find_name(const char *str, int &position) const; | |
951 bool find_type(const char *str, int &position) const; | |
603
dbbe28fc66b5
6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents:
599
diff
changeset
|
952 virtual void append_components(FormDict& locals, ComponentList& components, |
dbbe28fc66b5
6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents:
599
diff
changeset
|
953 bool def_flag = false) const; |
0 | 954 bool base_operand(uint &position, FormDict &globals, |
955 const char * &result, const char * &name, | |
956 const char * &opType) const; | |
957 // recursive count on operands | |
958 uint num_consts(FormDict &globals) const; | |
959 uint num_const_ptrs(FormDict &globals) const; | |
960 // recursive count of constants with specified type | |
961 uint num_consts(FormDict &globals, Form::DataType type) const; | |
962 // uint num_consts() const; // Local inspection only | |
963 int needs_ideal_memory_edge(FormDict &globals) const; | |
964 int needs_base_oop_edge() const; | |
965 | |
966 // Help build instruction predicates. Search for operand names. | |
967 void count_instr_names( Dict &names ); | |
968 int build_instr_pred( char *buf, const char *name, int cnt ); | |
969 void build_internalop( ); | |
970 | |
971 // Return the name of the operands associated with reducing to this operand: | |
972 // The result type, plus the left and right sides of the binary match | |
973 // Return NULL if there is no left or right hand side | |
974 bool sets_result() const; // rule "Set"s result of match | |
975 const char *reduce_right(FormDict &globals) const; | |
976 const char *reduce_left (FormDict &globals) const; | |
977 | |
978 // Recursive version of check in MatchRule | |
603
dbbe28fc66b5
6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents:
599
diff
changeset
|
979 int cisc_spill_match(FormDict& globals, RegisterForm* registers, |
dbbe28fc66b5
6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents:
599
diff
changeset
|
980 MatchNode* mRule2, const char* &operand, |
dbbe28fc66b5
6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents:
599
diff
changeset
|
981 const char* ®_type); |
0 | 982 int cisc_spill_merge(int left_result, int right_result); |
983 | |
603
dbbe28fc66b5
6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents:
599
diff
changeset
|
984 virtual bool equivalent(FormDict& globals, MatchNode* mNode2); |
0 | 985 |
986 void count_commutative_op(int& count); | |
987 void swap_commutative_op(bool atroot, int count); | |
988 | |
989 void dump(); | |
990 void output(FILE *fp); | |
991 }; | |
992 | |
993 //------------------------------MatchRule-------------------------------------- | |
994 class MatchRule : public MatchNode { | |
995 private: | |
996 | |
997 public: | |
998 // Public Data | |
999 const char *_machType; // Machine type index | |
1000 int _depth; // Expression tree depth | |
1001 char *_construct; // String representing C++ constructor code | |
1002 int _numchilds; // Number of direct children | |
1003 MatchRule *_next; // Pointer to next match rule | |
1004 | |
1005 // Public Methods | |
1006 MatchRule(ArchDesc &ad); | |
1007 MatchRule(ArchDesc &ad, MatchRule* mRule); // Shallow copy constructor; | |
1008 MatchRule(ArchDesc &ad, MatchNode* mroot, int depth, char* construct, int numleaves); | |
1009 ~MatchRule(); | |
1010 | |
603
dbbe28fc66b5
6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents:
599
diff
changeset
|
1011 virtual void append_components(FormDict& locals, ComponentList& components, bool def_flag = false) const; |
0 | 1012 // Recursive call on all operands' match rules in my match rule. |
1013 bool base_operand(uint &position, FormDict &globals, | |
1014 const char * &result, const char * &name, | |
1015 const char * &opType) const; | |
1016 | |
1017 | |
1018 bool is_base_register(FormDict &globals) const; | |
1019 Form::DataType is_base_constant(FormDict &globals) const; | |
1020 bool is_chain_rule(FormDict &globals) const; | |
1021 int is_ideal_copy() const; | |
1022 int is_expensive() const; // node matches ideal 'CosD' | |
1023 bool is_ideal_if() const; // node matches ideal 'If' | |
1024 bool is_ideal_fastlock() const; // node matches ideal 'FastLock' | |
1025 bool is_ideal_jump() const; // node matches ideal 'Jump' | |
1026 bool is_ideal_membar() const; // node matches ideal 'MemBarXXX' | |
1027 bool is_ideal_loadPC() const; // node matches ideal 'LoadPC' | |
1028 bool is_ideal_box() const; // node matches ideal 'Box' | |
1029 bool is_ideal_goto() const; // node matches ideal 'Goto' | |
1030 bool is_ideal_loopEnd() const; // node matches ideal 'LoopEnd' | |
1031 bool is_ideal_bool() const; // node matches ideal 'Bool' | |
6179
8c92982cbbc4
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
4120
diff
changeset
|
1032 bool is_vector() const; // vector instruction |
0 | 1033 Form::DataType is_ideal_load() const;// node matches ideal 'LoadXNode' |
855
f9094a5e1c8a
6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
605
diff
changeset
|
1034 // Should antidep checks be disabled for this rule |
f9094a5e1c8a
6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
605
diff
changeset
|
1035 // See definition of MatchRule::skip_antidep_check |
f9094a5e1c8a
6857159: local schedule failed with checkcast of Thread.currentThread()
never
parents:
605
diff
changeset
|
1036 bool skip_antidep_check() const; |
0 | 1037 Form::DataType is_ideal_store() const;// node matches ideal 'StoreXNode' |
1038 | |
1039 // Check if 'mRule2' is a cisc-spill variant of this MatchRule | |
603
dbbe28fc66b5
6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents:
599
diff
changeset
|
1040 int matchrule_cisc_spill_match(FormDict &globals, RegisterForm* registers, |
dbbe28fc66b5
6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents:
599
diff
changeset
|
1041 MatchRule* mRule2, const char* &operand, |
dbbe28fc66b5
6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents:
599
diff
changeset
|
1042 const char* ®_type); |
0 | 1043 |
1044 // Check if 'mRule2' is equivalent to this MatchRule | |
603
dbbe28fc66b5
6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents:
599
diff
changeset
|
1045 virtual bool equivalent(FormDict& globals, MatchNode* mRule2); |
0 | 1046 |
603
dbbe28fc66b5
6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents:
599
diff
changeset
|
1047 void matchrule_swap_commutative_op(const char* instr_ident, int count, int& match_rules_cnt); |
0 | 1048 |
1049 void dump(); | |
6850 | 1050 void output_short(FILE *fp); |
0 | 1051 void output(FILE *fp); |
1052 }; | |
1053 | |
1054 //------------------------------Attribute-------------------------------------- | |
1055 class Attribute : public Form { | |
1056 private: | |
1057 | |
1058 public: | |
1059 // Public Data | |
1060 char *_ident; // Name of predefined attribute | |
1061 char *_val; // C++ source which evaluates to constant | |
1062 int _atype; // Either INS_ATTR or OP_ATTR | |
1063 int int_val(ArchDesc &ad); // Return atoi(_val), ensuring syntax. | |
1064 | |
1065 // Public Methods | |
1066 Attribute(char *id, char* val, int type); | |
1067 ~Attribute(); | |
1068 | |
1069 void dump(); | |
1070 void output(FILE *fp); | |
1071 }; | |
1072 | |
1073 //------------------------------FormatRule------------------------------------- | |
1074 class FormatRule : public Form { | |
1075 private: | |
1076 | |
1077 public: | |
1078 // Public Data | |
1079 // There is an entry in _strings, perhaps NULL, that precedes each _rep_vars | |
1080 NameList _strings; // Strings passed through to tty->print | |
1081 NameList _rep_vars; // replacement variables | |
1082 char *_temp; // String representing the assembly code | |
1083 | |
1084 // Public Methods | |
1085 FormatRule(char *temp); | |
1086 ~FormatRule(); | |
1087 | |
1088 void dump(); | |
1089 void output(FILE *fp); | |
1090 }; | |
1972 | 1091 |
1092 #endif // SHARE_VM_ADLC_FORMSSEL_HPP |