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