annotate src/share/vm/adlc/formssel.hpp @ 8804:91bf0bdae37b

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