annotate src/share/vm/adlc/formsopt.hpp @ 1972:f95d63e2154a

6989984: Use standard include model for Hospot Summary: Replaced MakeDeps and the includeDB files with more standardized solutions. Reviewed-by: coleenp, kvn, kamg
author stefank
date Tue, 23 Nov 2010 13:22:55 -0800
parents c18cbe5936b8
children db2e64ca2d5a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
2 * Copyright (c) 1998, 2010, 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: 603
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 603
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: 603
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_FORMSOPT_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #define SHARE_VM_ADLC_FORMSOPT_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27
0
a61af66fc99e Initial load
duke
parents:
diff changeset
28 // FORMSOPT.HPP - ADL Parser Target Specific Optimization 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 OperandForm;
a61af66fc99e Initial load
duke
parents:
diff changeset
34 class OpClassForm;
a61af66fc99e Initial load
duke
parents:
diff changeset
35 class AttributeForm;
a61af66fc99e Initial load
duke
parents:
diff changeset
36 class RegisterForm;
a61af66fc99e Initial load
duke
parents:
diff changeset
37 class PipelineForm;
a61af66fc99e Initial load
duke
parents:
diff changeset
38 class SourceForm;
a61af66fc99e Initial load
duke
parents:
diff changeset
39 class EncodeForm;
a61af66fc99e Initial load
duke
parents:
diff changeset
40 class Component;
a61af66fc99e Initial load
duke
parents:
diff changeset
41 class Constraint;
a61af66fc99e Initial load
duke
parents:
diff changeset
42 class Predicate;
a61af66fc99e Initial load
duke
parents:
diff changeset
43 class MatchRule;
a61af66fc99e Initial load
duke
parents:
diff changeset
44 class Attribute;
a61af66fc99e Initial load
duke
parents:
diff changeset
45 class Effect;
a61af66fc99e Initial load
duke
parents:
diff changeset
46 class ExpandRule;
a61af66fc99e Initial load
duke
parents:
diff changeset
47 class RewriteRule;
a61af66fc99e Initial load
duke
parents:
diff changeset
48 class ConstructRule;
a61af66fc99e Initial load
duke
parents:
diff changeset
49 class FormatRule;
a61af66fc99e Initial load
duke
parents:
diff changeset
50 class Peephole;
a61af66fc99e Initial load
duke
parents:
diff changeset
51 class PeepMatch;
a61af66fc99e Initial load
duke
parents:
diff changeset
52 class PeepConstraint;
a61af66fc99e Initial load
duke
parents:
diff changeset
53 class EncClass;
a61af66fc99e Initial load
duke
parents:
diff changeset
54 class Interface;
a61af66fc99e Initial load
duke
parents:
diff changeset
55 class RegInterface;
a61af66fc99e Initial load
duke
parents:
diff changeset
56 class ConstInterface;
a61af66fc99e Initial load
duke
parents:
diff changeset
57 class MemInterface;
a61af66fc99e Initial load
duke
parents:
diff changeset
58 class CondInterface;
a61af66fc99e Initial load
duke
parents:
diff changeset
59 class Opcode;
a61af66fc99e Initial load
duke
parents:
diff changeset
60 class InsEncode;
a61af66fc99e Initial load
duke
parents:
diff changeset
61 class RegDef;
a61af66fc99e Initial load
duke
parents:
diff changeset
62 class RegClass;
a61af66fc99e Initial load
duke
parents:
diff changeset
63 class AllocClass;
a61af66fc99e Initial load
duke
parents:
diff changeset
64 class ResourceForm;
a61af66fc99e Initial load
duke
parents:
diff changeset
65 class PipeClassForm;
a61af66fc99e Initial load
duke
parents:
diff changeset
66 class PipeClassOperandForm;
a61af66fc99e Initial load
duke
parents:
diff changeset
67 class PipeClassResourceForm;
a61af66fc99e Initial load
duke
parents:
diff changeset
68 class PeepMatch;
a61af66fc99e Initial load
duke
parents:
diff changeset
69 class PeepConstraint;
a61af66fc99e Initial load
duke
parents:
diff changeset
70 class PeepReplace;
a61af66fc99e Initial load
duke
parents:
diff changeset
71 class MatchList;
a61af66fc99e Initial load
duke
parents:
diff changeset
72
a61af66fc99e Initial load
duke
parents:
diff changeset
73 class ArchDesc;
a61af66fc99e Initial load
duke
parents:
diff changeset
74
a61af66fc99e Initial load
duke
parents:
diff changeset
75 //==============================Register Allocation============================
a61af66fc99e Initial load
duke
parents:
diff changeset
76 //------------------------------RegisterForm-----------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
77 class RegisterForm : public Form {
a61af66fc99e Initial load
duke
parents:
diff changeset
78 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
79 AllocClass *_current_ac; // State used by iter_RegDefs()
a61af66fc99e Initial load
duke
parents:
diff changeset
80
a61af66fc99e Initial load
duke
parents:
diff changeset
81 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
82 // Public Data
a61af66fc99e Initial load
duke
parents:
diff changeset
83 NameList _rdefs; // List of register definition names
a61af66fc99e Initial load
duke
parents:
diff changeset
84 Dict _regDef; // map register name to RegDef*
a61af66fc99e Initial load
duke
parents:
diff changeset
85
a61af66fc99e Initial load
duke
parents:
diff changeset
86 NameList _rclasses; // List of register class names
a61af66fc99e Initial load
duke
parents:
diff changeset
87 Dict _regClass; // map register class name to RegClass*
a61af66fc99e Initial load
duke
parents:
diff changeset
88
a61af66fc99e Initial load
duke
parents:
diff changeset
89 NameList _aclasses; // List of allocation class names
a61af66fc99e Initial load
duke
parents:
diff changeset
90 Dict _allocClass; // Dictionary of allocation classes
a61af66fc99e Initial load
duke
parents:
diff changeset
91
a61af66fc99e Initial load
duke
parents:
diff changeset
92 static int _reg_ctr; // Register counter
a61af66fc99e Initial load
duke
parents:
diff changeset
93 static int RegMask_Size(); // Compute RegMask size
a61af66fc99e Initial load
duke
parents:
diff changeset
94
a61af66fc99e Initial load
duke
parents:
diff changeset
95 // Public Methods
a61af66fc99e Initial load
duke
parents:
diff changeset
96 RegisterForm();
a61af66fc99e Initial load
duke
parents:
diff changeset
97 ~RegisterForm();
a61af66fc99e Initial load
duke
parents:
diff changeset
98
a61af66fc99e Initial load
duke
parents:
diff changeset
99 void addRegDef(char *regName, char *callingConv, char *c_conv,
a61af66fc99e Initial load
duke
parents:
diff changeset
100 char * idealtype, char *encoding, char* concreteName);
a61af66fc99e Initial load
duke
parents:
diff changeset
101 RegClass *addRegClass(const char *className);
a61af66fc99e Initial load
duke
parents:
diff changeset
102 AllocClass *addAllocClass(char *allocName);
a61af66fc99e Initial load
duke
parents:
diff changeset
103 void addSpillRegClass();
a61af66fc99e Initial load
duke
parents:
diff changeset
104
a61af66fc99e Initial load
duke
parents:
diff changeset
105 // Provide iteration over all register definitions
a61af66fc99e Initial load
duke
parents:
diff changeset
106 // in the order used by the register allocator
a61af66fc99e Initial load
duke
parents:
diff changeset
107 void reset_RegDefs();
a61af66fc99e Initial load
duke
parents:
diff changeset
108 RegDef *iter_RegDefs();
a61af66fc99e Initial load
duke
parents:
diff changeset
109 RegDef *getRegDef (const char *regName);
a61af66fc99e Initial load
duke
parents:
diff changeset
110
a61af66fc99e Initial load
duke
parents:
diff changeset
111 RegClass *getRegClass(const char *className);
a61af66fc99e Initial load
duke
parents:
diff changeset
112
a61af66fc99e Initial load
duke
parents:
diff changeset
113 // Return register mask, compressed chunk and register #
a61af66fc99e Initial load
duke
parents:
diff changeset
114 uint reg_mask(char *register_class);
a61af66fc99e Initial load
duke
parents:
diff changeset
115
a61af66fc99e Initial load
duke
parents:
diff changeset
116 // Check that register classes are compatible with chunks
a61af66fc99e Initial load
duke
parents:
diff changeset
117 bool verify();
a61af66fc99e Initial load
duke
parents:
diff changeset
118
a61af66fc99e Initial load
duke
parents:
diff changeset
119 void dump(); // Debug printer
a61af66fc99e Initial load
duke
parents:
diff changeset
120 void output(FILE *fp); // Write info to output files
a61af66fc99e Initial load
duke
parents:
diff changeset
121 };
a61af66fc99e Initial load
duke
parents:
diff changeset
122
a61af66fc99e Initial load
duke
parents:
diff changeset
123 //------------------------------RegDef-----------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
124 class RegDef : public Form {
a61af66fc99e Initial load
duke
parents:
diff changeset
125 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
126 // Public Data
a61af66fc99e Initial load
duke
parents:
diff changeset
127 const char *_regname; // ADLC (Opto) Register name
a61af66fc99e Initial load
duke
parents:
diff changeset
128 const char *_callconv; // Calling convention
a61af66fc99e Initial load
duke
parents:
diff changeset
129 const char *_c_conv; // Native calling convention, 'C'
a61af66fc99e Initial load
duke
parents:
diff changeset
130 const char *_idealtype; // Ideal Type for register save/restore
a61af66fc99e Initial load
duke
parents:
diff changeset
131 const char *_concrete; // concrete register name
a61af66fc99e Initial load
duke
parents:
diff changeset
132
a61af66fc99e Initial load
duke
parents:
diff changeset
133 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
134 const char *_register_encode; // The register encoding
a61af66fc99e Initial load
duke
parents:
diff changeset
135 // The chunk and register mask bits define info for register allocation
a61af66fc99e Initial load
duke
parents:
diff changeset
136 uint32 _register_num; // Which register am I
a61af66fc99e Initial load
duke
parents:
diff changeset
137
a61af66fc99e Initial load
duke
parents:
diff changeset
138 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
139 // Public Methods
a61af66fc99e Initial load
duke
parents:
diff changeset
140 RegDef(char *regname, char *callconv, char *c_conv,
a61af66fc99e Initial load
duke
parents:
diff changeset
141 char *idealtype, char *encoding, char *concrete);
a61af66fc99e Initial load
duke
parents:
diff changeset
142 ~RegDef(); // Destructor
a61af66fc99e Initial load
duke
parents:
diff changeset
143
a61af66fc99e Initial load
duke
parents:
diff changeset
144 // Interface to define/redefine the register number
a61af66fc99e Initial load
duke
parents:
diff changeset
145 void set_register_num(uint32 new_register_num);
a61af66fc99e Initial load
duke
parents:
diff changeset
146
a61af66fc99e Initial load
duke
parents:
diff changeset
147 // Bit pattern used for generating machine code
a61af66fc99e Initial load
duke
parents:
diff changeset
148 const char *register_encode() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
149 // Register number used in machine-independent code
a61af66fc99e Initial load
duke
parents:
diff changeset
150 uint32 register_num() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
151
a61af66fc99e Initial load
duke
parents:
diff changeset
152 void dump(); // Debug printer
a61af66fc99e Initial load
duke
parents:
diff changeset
153 void output(FILE *fp); // Write info to output files
a61af66fc99e Initial load
duke
parents:
diff changeset
154 };
a61af66fc99e Initial load
duke
parents:
diff changeset
155
a61af66fc99e Initial load
duke
parents:
diff changeset
156 //------------------------------RegClass---------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
157 class RegClass : public Form {
a61af66fc99e Initial load
duke
parents:
diff changeset
158 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
159 // Public Data
a61af66fc99e Initial load
duke
parents:
diff changeset
160 const char *_classid; // Name of class
a61af66fc99e Initial load
duke
parents:
diff changeset
161 NameList _regDefs; // List of registers in class
a61af66fc99e Initial load
duke
parents:
diff changeset
162 Dict _regDef; // Dictionary of registers in class
a61af66fc99e Initial load
duke
parents:
diff changeset
163 bool _stack_or_reg; // Allowed on any stack slot
a61af66fc99e Initial load
duke
parents:
diff changeset
164
a61af66fc99e Initial load
duke
parents:
diff changeset
165 // Public Methods
a61af66fc99e Initial load
duke
parents:
diff changeset
166 RegClass(const char *classid);// Constructor
a61af66fc99e Initial load
duke
parents:
diff changeset
167
a61af66fc99e Initial load
duke
parents:
diff changeset
168 void addReg(RegDef *regDef); // Add a register to this class
a61af66fc99e Initial load
duke
parents:
diff changeset
169
a61af66fc99e Initial load
duke
parents:
diff changeset
170 uint size() const; // Number of registers in class
a61af66fc99e Initial load
duke
parents:
diff changeset
171 int regs_in_word( int wordnum, bool stack_also );
a61af66fc99e Initial load
duke
parents:
diff changeset
172
a61af66fc99e Initial load
duke
parents:
diff changeset
173 const RegDef *get_RegDef(const char *regDef_name) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
174
a61af66fc99e Initial load
duke
parents:
diff changeset
175 // Returns the lowest numbered register in the mask.
a61af66fc99e Initial load
duke
parents:
diff changeset
176 const RegDef* find_first_elem();
a61af66fc99e Initial load
duke
parents:
diff changeset
177
a61af66fc99e Initial load
duke
parents:
diff changeset
178 // Iteration support
a61af66fc99e Initial load
duke
parents:
diff changeset
179 void reset(); // Reset the following two iterators
a61af66fc99e Initial load
duke
parents:
diff changeset
180 RegDef *RegDef_iter(); // which move jointly,
a61af66fc99e Initial load
duke
parents:
diff changeset
181 const char *rd_name_iter(); // invoking either advances both.
a61af66fc99e Initial load
duke
parents:
diff changeset
182
a61af66fc99e Initial load
duke
parents:
diff changeset
183 void dump(); // Debug printer
a61af66fc99e Initial load
duke
parents:
diff changeset
184 void output(FILE *fp); // Write info to output files
a61af66fc99e Initial load
duke
parents:
diff changeset
185 };
a61af66fc99e Initial load
duke
parents:
diff changeset
186
a61af66fc99e Initial load
duke
parents:
diff changeset
187 //------------------------------AllocClass-------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
188 class AllocClass : public Form {
a61af66fc99e Initial load
duke
parents:
diff changeset
189 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
190
a61af66fc99e Initial load
duke
parents:
diff changeset
191 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
192 // Public Data
a61af66fc99e Initial load
duke
parents:
diff changeset
193 char *_classid; // Name of class
a61af66fc99e Initial load
duke
parents:
diff changeset
194 NameList _regDefs; // List of registers in class
a61af66fc99e Initial load
duke
parents:
diff changeset
195 Dict _regDef; // Dictionary of registers in class
a61af66fc99e Initial load
duke
parents:
diff changeset
196
a61af66fc99e Initial load
duke
parents:
diff changeset
197 // Public Methods
a61af66fc99e Initial load
duke
parents:
diff changeset
198 AllocClass(char *classid); // Constructor
a61af66fc99e Initial load
duke
parents:
diff changeset
199
a61af66fc99e Initial load
duke
parents:
diff changeset
200 void addReg(RegDef *regDef); // Add a register to this class
a61af66fc99e Initial load
duke
parents:
diff changeset
201 uint size() {return _regDef.Size();} // Number of registers in class
a61af66fc99e Initial load
duke
parents:
diff changeset
202
a61af66fc99e Initial load
duke
parents:
diff changeset
203 void dump(); // Debug printer
a61af66fc99e Initial load
duke
parents:
diff changeset
204 void output(FILE *fp); // Write info to output files
a61af66fc99e Initial load
duke
parents:
diff changeset
205 };
a61af66fc99e Initial load
duke
parents:
diff changeset
206
a61af66fc99e Initial load
duke
parents:
diff changeset
207
a61af66fc99e Initial load
duke
parents:
diff changeset
208 //==============================Frame Handling================================
a61af66fc99e Initial load
duke
parents:
diff changeset
209 //------------------------------FrameForm-------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
210 class FrameForm : public Form {
a61af66fc99e Initial load
duke
parents:
diff changeset
211 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
212
a61af66fc99e Initial load
duke
parents:
diff changeset
213 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
214 // Public Data
a61af66fc99e Initial load
duke
parents:
diff changeset
215 bool _direction; // Direction of stack growth
a61af66fc99e Initial load
duke
parents:
diff changeset
216 char *_sync_stack_slots;
a61af66fc99e Initial load
duke
parents:
diff changeset
217 char *_inline_cache_reg;
a61af66fc99e Initial load
duke
parents:
diff changeset
218 char *_interpreter_method_oop_reg;
a61af66fc99e Initial load
duke
parents:
diff changeset
219 char *_interpreter_frame_pointer_reg;
a61af66fc99e Initial load
duke
parents:
diff changeset
220 char *_cisc_spilling_operand_name;
a61af66fc99e Initial load
duke
parents:
diff changeset
221 char *_frame_pointer;
a61af66fc99e Initial load
duke
parents:
diff changeset
222 char *_c_frame_pointer;
a61af66fc99e Initial load
duke
parents:
diff changeset
223 char *_alignment;
a61af66fc99e Initial load
duke
parents:
diff changeset
224 bool _return_addr_loc;
a61af66fc99e Initial load
duke
parents:
diff changeset
225 bool _c_return_addr_loc;
a61af66fc99e Initial load
duke
parents:
diff changeset
226 char *_return_addr;
a61af66fc99e Initial load
duke
parents:
diff changeset
227 char *_c_return_addr;
a61af66fc99e Initial load
duke
parents:
diff changeset
228 char *_in_preserve_slots;
a61af66fc99e Initial load
duke
parents:
diff changeset
229 char *_varargs_C_out_slots_killed;
a61af66fc99e Initial load
duke
parents:
diff changeset
230 char *_calling_convention;
a61af66fc99e Initial load
duke
parents:
diff changeset
231 char *_c_calling_convention;
a61af66fc99e Initial load
duke
parents:
diff changeset
232 char *_return_value;
a61af66fc99e Initial load
duke
parents:
diff changeset
233 char *_c_return_value;
a61af66fc99e Initial load
duke
parents:
diff changeset
234
a61af66fc99e Initial load
duke
parents:
diff changeset
235 // Public Methods
a61af66fc99e Initial load
duke
parents:
diff changeset
236 FrameForm();
a61af66fc99e Initial load
duke
parents:
diff changeset
237 ~FrameForm();
a61af66fc99e Initial load
duke
parents:
diff changeset
238
a61af66fc99e Initial load
duke
parents:
diff changeset
239 void dump(); // Debug printer
a61af66fc99e Initial load
duke
parents:
diff changeset
240 void output(FILE *fp); // Write info to output files
a61af66fc99e Initial load
duke
parents:
diff changeset
241 };
a61af66fc99e Initial load
duke
parents:
diff changeset
242
a61af66fc99e Initial load
duke
parents:
diff changeset
243
a61af66fc99e Initial load
duke
parents:
diff changeset
244 //==============================Scheduling=====================================
a61af66fc99e Initial load
duke
parents:
diff changeset
245 //------------------------------PipelineForm-----------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
246 class PipelineForm : public Form {
a61af66fc99e Initial load
duke
parents:
diff changeset
247 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
248
a61af66fc99e Initial load
duke
parents:
diff changeset
249 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
250 // Public Data
a61af66fc99e Initial load
duke
parents:
diff changeset
251 NameList _reslist; // List of pipeline resources
a61af66fc99e Initial load
duke
parents:
diff changeset
252 FormDict _resdict; // Resource Name -> ResourceForm mapping
a61af66fc99e Initial load
duke
parents:
diff changeset
253 int _rescount; // Number of resources (ignores OR cases)
a61af66fc99e Initial load
duke
parents:
diff changeset
254 int _maxcycleused; // Largest cycle used relative to beginning of instruction
a61af66fc99e Initial load
duke
parents:
diff changeset
255
a61af66fc99e Initial load
duke
parents:
diff changeset
256 NameList _stages; // List of pipeline stages on architecture
a61af66fc99e Initial load
duke
parents:
diff changeset
257 int _stagecnt; // Number of stages listed
a61af66fc99e Initial load
duke
parents:
diff changeset
258
a61af66fc99e Initial load
duke
parents:
diff changeset
259 NameList _classlist; // List of pipeline classes
a61af66fc99e Initial load
duke
parents:
diff changeset
260 FormDict _classdict; // Class Name -> PipeClassForm mapping
a61af66fc99e Initial load
duke
parents:
diff changeset
261 int _classcnt; // Number of classes
a61af66fc99e Initial load
duke
parents:
diff changeset
262
a61af66fc99e Initial load
duke
parents:
diff changeset
263 NameList _noplist; // List of NOP instructions
a61af66fc99e Initial load
duke
parents:
diff changeset
264 int _nopcnt; // Number of nop instructions
a61af66fc99e Initial load
duke
parents:
diff changeset
265
a61af66fc99e Initial load
duke
parents:
diff changeset
266 bool _variableSizeInstrs; // Indicates if this architecture has variable sized instructions
a61af66fc99e Initial load
duke
parents:
diff changeset
267 bool _branchHasDelaySlot; // Indicates that branches have delay slot instructions
a61af66fc99e Initial load
duke
parents:
diff changeset
268 int _maxInstrsPerBundle; // Indicates the maximum number of instructions for ILP
a61af66fc99e Initial load
duke
parents:
diff changeset
269 int _maxBundlesPerCycle; // Indicates the maximum number of bundles for ILP
a61af66fc99e Initial load
duke
parents:
diff changeset
270 int _instrUnitSize; // The minimum instruction unit size, in bytes
a61af66fc99e Initial load
duke
parents:
diff changeset
271 int _bundleUnitSize; // The bundle unit size, in bytes
a61af66fc99e Initial load
duke
parents:
diff changeset
272 int _instrFetchUnitSize; // The size of the I-fetch unit, in bytes [must be power of 2]
a61af66fc99e Initial load
duke
parents:
diff changeset
273 int _instrFetchUnits; // The number of I-fetch units processed per cycle
a61af66fc99e Initial load
duke
parents:
diff changeset
274
a61af66fc99e Initial load
duke
parents:
diff changeset
275 // Public Methods
a61af66fc99e Initial load
duke
parents:
diff changeset
276 PipelineForm();
a61af66fc99e Initial load
duke
parents:
diff changeset
277 ~PipelineForm();
a61af66fc99e Initial load
duke
parents:
diff changeset
278
a61af66fc99e Initial load
duke
parents:
diff changeset
279 void dump(); // Debug printer
a61af66fc99e Initial load
duke
parents:
diff changeset
280 void output(FILE *fp); // Write info to output files
a61af66fc99e Initial load
duke
parents:
diff changeset
281 };
a61af66fc99e Initial load
duke
parents:
diff changeset
282
a61af66fc99e Initial load
duke
parents:
diff changeset
283 //------------------------------ResourceForm-----------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
284 class ResourceForm : public Form {
a61af66fc99e Initial load
duke
parents:
diff changeset
285 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
286 unsigned mask() const { return _resmask; };
a61af66fc99e Initial load
duke
parents:
diff changeset
287
a61af66fc99e Initial load
duke
parents:
diff changeset
288 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
289 // Public Data
a61af66fc99e Initial load
duke
parents:
diff changeset
290 unsigned _resmask; // Resource Mask (OR of resource specifier bits)
a61af66fc99e Initial load
duke
parents:
diff changeset
291
a61af66fc99e Initial load
duke
parents:
diff changeset
292 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
293
a61af66fc99e Initial load
duke
parents:
diff changeset
294 // Virtual Methods
a61af66fc99e Initial load
duke
parents:
diff changeset
295 virtual ResourceForm *is_resource() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
296
a61af66fc99e Initial load
duke
parents:
diff changeset
297 // Public Methods
a61af66fc99e Initial load
duke
parents:
diff changeset
298 ResourceForm(unsigned resmask); // Constructor
a61af66fc99e Initial load
duke
parents:
diff changeset
299 ~ResourceForm(); // Destructor
a61af66fc99e Initial load
duke
parents:
diff changeset
300
a61af66fc99e Initial load
duke
parents:
diff changeset
301 void dump(); // Debug printer
a61af66fc99e Initial load
duke
parents:
diff changeset
302 void output(FILE *fp); // Write info 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 //------------------------------PipeClassOperandForm-----------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
306 class PipeClassOperandForm : 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 const char *_stage; // Name of Stage
a61af66fc99e Initial load
duke
parents:
diff changeset
312 unsigned _iswrite; // Read or Write
a61af66fc99e Initial load
duke
parents:
diff changeset
313 unsigned _more_instrs; // Additional Instructions
a61af66fc99e Initial load
duke
parents:
diff changeset
314
a61af66fc99e Initial load
duke
parents:
diff changeset
315 // Public Methods
a61af66fc99e Initial load
duke
parents:
diff changeset
316 PipeClassOperandForm(const char *stage, unsigned iswrite, unsigned more_instrs)
a61af66fc99e Initial load
duke
parents:
diff changeset
317 : _stage(stage)
a61af66fc99e Initial load
duke
parents:
diff changeset
318 , _iswrite(iswrite)
a61af66fc99e Initial load
duke
parents:
diff changeset
319 , _more_instrs(more_instrs)
a61af66fc99e Initial load
duke
parents:
diff changeset
320 {};
a61af66fc99e Initial load
duke
parents:
diff changeset
321
a61af66fc99e Initial load
duke
parents:
diff changeset
322 ~PipeClassOperandForm() {}; // Destructor
a61af66fc99e Initial load
duke
parents:
diff changeset
323
a61af66fc99e Initial load
duke
parents:
diff changeset
324 bool isWrite() const { return _iswrite != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
325
a61af66fc99e Initial load
duke
parents:
diff changeset
326 void dump(); // Debug printer
a61af66fc99e Initial load
duke
parents:
diff changeset
327 void output(FILE *fp); // Write info to output files
a61af66fc99e Initial load
duke
parents:
diff changeset
328 };
a61af66fc99e Initial load
duke
parents:
diff changeset
329
a61af66fc99e Initial load
duke
parents:
diff changeset
330 //------------------------------PipeClassResourceForm--------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
331 class PipeClassResourceForm : public Form {
a61af66fc99e Initial load
duke
parents:
diff changeset
332 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
333
a61af66fc99e Initial load
duke
parents:
diff changeset
334 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
335 // Public Data
a61af66fc99e Initial load
duke
parents:
diff changeset
336 const char *_resource; // Resource
a61af66fc99e Initial load
duke
parents:
diff changeset
337 const char *_stage; // Stage the resource is used in
a61af66fc99e Initial load
duke
parents:
diff changeset
338 int _cycles; // Number of cycles the resource is used
a61af66fc99e Initial load
duke
parents:
diff changeset
339
a61af66fc99e Initial load
duke
parents:
diff changeset
340 // Public Methods
a61af66fc99e Initial load
duke
parents:
diff changeset
341 PipeClassResourceForm(const char *resource, const char *stage, int cycles)
a61af66fc99e Initial load
duke
parents:
diff changeset
342 // Constructor
a61af66fc99e Initial load
duke
parents:
diff changeset
343 : _resource(resource)
a61af66fc99e Initial load
duke
parents:
diff changeset
344 , _stage(stage)
a61af66fc99e Initial load
duke
parents:
diff changeset
345 , _cycles(cycles)
a61af66fc99e Initial load
duke
parents:
diff changeset
346 {};
a61af66fc99e Initial load
duke
parents:
diff changeset
347
a61af66fc99e Initial load
duke
parents:
diff changeset
348 ~PipeClassResourceForm() {}; // Destructor
a61af66fc99e Initial load
duke
parents:
diff changeset
349
a61af66fc99e Initial load
duke
parents:
diff changeset
350 void dump(); // Debug printer
a61af66fc99e Initial load
duke
parents:
diff changeset
351 void output(FILE *fp); // Write info to output files
a61af66fc99e Initial load
duke
parents:
diff changeset
352 };
a61af66fc99e Initial load
duke
parents:
diff changeset
353
a61af66fc99e Initial load
duke
parents:
diff changeset
354 //------------------------------PipeClassForm----------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
355 class PipeClassForm : public Form {
a61af66fc99e Initial load
duke
parents:
diff changeset
356 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
357
a61af66fc99e Initial load
duke
parents:
diff changeset
358 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
359
a61af66fc99e Initial load
duke
parents:
diff changeset
360 // Public Data
a61af66fc99e Initial load
duke
parents:
diff changeset
361 const char *_ident; // Name of class
a61af66fc99e Initial load
duke
parents:
diff changeset
362 int _num; // Used in name of MachNode subclass
a61af66fc99e Initial load
duke
parents:
diff changeset
363 NameList _parameters; // Locally defined names
a61af66fc99e Initial load
duke
parents:
diff changeset
364 FormDict _localNames; // Table of operands & their types
a61af66fc99e Initial load
duke
parents:
diff changeset
365 FormDict _localUsage; // Table of operand usage
a61af66fc99e Initial load
duke
parents:
diff changeset
366 FormList _resUsage; // List of resource usage
a61af66fc99e Initial load
duke
parents:
diff changeset
367 NameList _instructs; // List of instructions and machine nodes that use this pipeline class
a61af66fc99e Initial load
duke
parents:
diff changeset
368 bool _has_fixed_latency; // Always takes this number of cycles
a61af66fc99e Initial load
duke
parents:
diff changeset
369 int _fixed_latency; // Always takes this number of cycles
a61af66fc99e Initial load
duke
parents:
diff changeset
370 int _instruction_count; // Number of instructions in first bundle
a61af66fc99e Initial load
duke
parents:
diff changeset
371 bool _has_multiple_bundles; // Indicates if 1 or multiple bundles
a61af66fc99e Initial load
duke
parents:
diff changeset
372 bool _has_branch_delay_slot; // Has branch delay slot as last instruction
a61af66fc99e Initial load
duke
parents:
diff changeset
373 bool _force_serialization; // This node serializes relative to surrounding nodes
a61af66fc99e Initial load
duke
parents:
diff changeset
374 bool _may_have_no_code; // This node may generate no code based on register allocation
a61af66fc99e Initial load
duke
parents:
diff changeset
375
a61af66fc99e Initial load
duke
parents:
diff changeset
376 // Virtual Methods
a61af66fc99e Initial load
duke
parents:
diff changeset
377 virtual PipeClassForm *is_pipeclass() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
378
a61af66fc99e Initial load
duke
parents:
diff changeset
379 // Public Methods
a61af66fc99e Initial load
duke
parents:
diff changeset
380 PipeClassForm(const char *id, int num);
a61af66fc99e Initial load
duke
parents:
diff changeset
381 // Constructor
a61af66fc99e Initial load
duke
parents:
diff changeset
382 ~PipeClassForm(); // Destructor
a61af66fc99e Initial load
duke
parents:
diff changeset
383
a61af66fc99e Initial load
duke
parents:
diff changeset
384 bool hasFixedLatency() { return _has_fixed_latency; }
a61af66fc99e Initial load
duke
parents:
diff changeset
385 int fixedLatency() { return _fixed_latency; }
a61af66fc99e Initial load
duke
parents:
diff changeset
386
a61af66fc99e Initial load
duke
parents:
diff changeset
387 void setFixedLatency(int fixed_latency) { _has_fixed_latency = 1; _fixed_latency = fixed_latency; }
a61af66fc99e Initial load
duke
parents:
diff changeset
388
a61af66fc99e Initial load
duke
parents:
diff changeset
389 void setInstructionCount(int i) { _instruction_count = i; }
a61af66fc99e Initial load
duke
parents:
diff changeset
390 void setMultipleBundles(bool b) { _has_multiple_bundles = b; }
a61af66fc99e Initial load
duke
parents:
diff changeset
391 void setBranchDelay(bool s) { _has_branch_delay_slot = s; }
a61af66fc99e Initial load
duke
parents:
diff changeset
392 void setForceSerialization(bool s) { _force_serialization = s; }
a61af66fc99e Initial load
duke
parents:
diff changeset
393 void setMayHaveNoCode(bool s) { _may_have_no_code = s; }
a61af66fc99e Initial load
duke
parents:
diff changeset
394
a61af66fc99e Initial load
duke
parents:
diff changeset
395 int InstructionCount() const { return _instruction_count; }
a61af66fc99e Initial load
duke
parents:
diff changeset
396 bool hasMultipleBundles() const { return _has_multiple_bundles; }
a61af66fc99e Initial load
duke
parents:
diff changeset
397 bool hasBranchDelay() const { return _has_branch_delay_slot; }
a61af66fc99e Initial load
duke
parents:
diff changeset
398 bool forceSerialization() const { return _force_serialization; }
a61af66fc99e Initial load
duke
parents:
diff changeset
399 bool mayHaveNoCode() const { return _may_have_no_code; }
a61af66fc99e Initial load
duke
parents:
diff changeset
400
a61af66fc99e Initial load
duke
parents:
diff changeset
401 void dump(); // Debug printer
a61af66fc99e Initial load
duke
parents:
diff changeset
402 void output(FILE *fp); // Write info to output files
a61af66fc99e Initial load
duke
parents:
diff changeset
403 };
a61af66fc99e Initial load
duke
parents:
diff changeset
404
a61af66fc99e Initial load
duke
parents:
diff changeset
405
a61af66fc99e Initial load
duke
parents:
diff changeset
406 //==============================Peephole Optimization==========================
a61af66fc99e Initial load
duke
parents:
diff changeset
407 //------------------------------Peephole---------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
408 class Peephole : public Form {
a61af66fc99e Initial load
duke
parents:
diff changeset
409 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
410 static int _peephole_counter;// Incremented by each peephole rule parsed
a61af66fc99e Initial load
duke
parents:
diff changeset
411 int _peephole_number;// Remember my order in architecture description
a61af66fc99e Initial load
duke
parents:
diff changeset
412 PeepMatch *_match; // Instruction pattern to match
a61af66fc99e Initial load
duke
parents:
diff changeset
413 PeepConstraint *_constraint; // List of additional constraints
a61af66fc99e Initial load
duke
parents:
diff changeset
414 PeepReplace *_replace; // Instruction pattern to substitute in
a61af66fc99e Initial load
duke
parents:
diff changeset
415
a61af66fc99e Initial load
duke
parents:
diff changeset
416 Peephole *_next;
a61af66fc99e Initial load
duke
parents:
diff changeset
417
a61af66fc99e Initial load
duke
parents:
diff changeset
418 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
419 // Public Methods
a61af66fc99e Initial load
duke
parents:
diff changeset
420 Peephole();
a61af66fc99e Initial load
duke
parents:
diff changeset
421 ~Peephole();
a61af66fc99e Initial load
duke
parents:
diff changeset
422
a61af66fc99e Initial load
duke
parents:
diff changeset
423 // Append a peephole rule with the same root instruction
a61af66fc99e Initial load
duke
parents:
diff changeset
424 void append_peephole(Peephole *next_peephole);
a61af66fc99e Initial load
duke
parents:
diff changeset
425
a61af66fc99e Initial load
duke
parents:
diff changeset
426 // Store the components of this peephole rule
a61af66fc99e Initial load
duke
parents:
diff changeset
427 void add_match(PeepMatch *only_one_match);
a61af66fc99e Initial load
duke
parents:
diff changeset
428 void append_constraint(PeepConstraint *next_constraint);
a61af66fc99e Initial load
duke
parents:
diff changeset
429 void add_replace(PeepReplace *only_one_replacement);
a61af66fc99e Initial load
duke
parents:
diff changeset
430
a61af66fc99e Initial load
duke
parents:
diff changeset
431 // Access the components of this peephole rule
a61af66fc99e Initial load
duke
parents:
diff changeset
432 int peephole_number() { return _peephole_number; }
a61af66fc99e Initial load
duke
parents:
diff changeset
433 PeepMatch *match() { return _match; }
a61af66fc99e Initial load
duke
parents:
diff changeset
434 PeepConstraint *constraints() { return _constraint; }
a61af66fc99e Initial load
duke
parents:
diff changeset
435 PeepReplace *replacement() { return _replace; }
a61af66fc99e Initial load
duke
parents:
diff changeset
436 Peephole *next() { return _next; }
a61af66fc99e Initial load
duke
parents:
diff changeset
437
a61af66fc99e Initial load
duke
parents:
diff changeset
438 void dump(); // Debug printer
a61af66fc99e Initial load
duke
parents:
diff changeset
439 void output(FILE *fp); // Write info to output files
a61af66fc99e Initial load
duke
parents:
diff changeset
440 };
a61af66fc99e Initial load
duke
parents:
diff changeset
441
a61af66fc99e Initial load
duke
parents:
diff changeset
442
a61af66fc99e Initial load
duke
parents:
diff changeset
443 class PeepMatch : public Form {
a61af66fc99e Initial load
duke
parents:
diff changeset
444 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
445 char *_rule;
a61af66fc99e Initial load
duke
parents:
diff changeset
446 // NameList _depth; // Depth of this instruction
a61af66fc99e Initial load
duke
parents:
diff changeset
447 NameList _parent;
a61af66fc99e Initial load
duke
parents:
diff changeset
448 NameList _position;
a61af66fc99e Initial load
duke
parents:
diff changeset
449 NameList _instrs; // List of instructions in match rule
a61af66fc99e Initial load
duke
parents:
diff changeset
450 NameList _input; // input position in parent's instruction
a61af66fc99e Initial load
duke
parents:
diff changeset
451 int _max_position;
a61af66fc99e Initial load
duke
parents:
diff changeset
452
a61af66fc99e Initial load
duke
parents:
diff changeset
453 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
454 // Public Methods
a61af66fc99e Initial load
duke
parents:
diff changeset
455 PeepMatch(char *rule);
a61af66fc99e Initial load
duke
parents:
diff changeset
456 ~PeepMatch();
a61af66fc99e Initial load
duke
parents:
diff changeset
457
a61af66fc99e Initial load
duke
parents:
diff changeset
458 // Insert info into the match-rule
a61af66fc99e Initial load
duke
parents:
diff changeset
459 void add_instruction(int parent, int position, const char *name, int input);
a61af66fc99e Initial load
duke
parents:
diff changeset
460
a61af66fc99e Initial load
duke
parents:
diff changeset
461 // Access info about instructions in the peep-match rule
a61af66fc99e Initial load
duke
parents:
diff changeset
462 int max_position();
603
dbbe28fc66b5 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 0
diff changeset
463 const char *instruction_name(int position);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
464 // Iterate through all info on matched instructions
a61af66fc99e Initial load
duke
parents:
diff changeset
465 void reset();
603
dbbe28fc66b5 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 0
diff changeset
466 void next_instruction(int &parent, int &position, const char* &name, int &input);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
467 // 'true' if current position in iteration is a placeholder, not matched.
a61af66fc99e Initial load
duke
parents:
diff changeset
468 bool is_placeholder();
a61af66fc99e Initial load
duke
parents:
diff changeset
469
a61af66fc99e Initial load
duke
parents:
diff changeset
470 void dump();
a61af66fc99e Initial load
duke
parents:
diff changeset
471 void output(FILE *fp);
a61af66fc99e Initial load
duke
parents:
diff changeset
472 };
a61af66fc99e Initial load
duke
parents:
diff changeset
473
a61af66fc99e Initial load
duke
parents:
diff changeset
474
a61af66fc99e Initial load
duke
parents:
diff changeset
475 class PeepConstraint : public Form {
a61af66fc99e Initial load
duke
parents:
diff changeset
476 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
477 PeepConstraint *_next; // Additional constraints ANDed together
a61af66fc99e Initial load
duke
parents:
diff changeset
478
a61af66fc99e Initial load
duke
parents:
diff changeset
479 public:
603
dbbe28fc66b5 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 0
diff changeset
480 const int _left_inst;
dbbe28fc66b5 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 0
diff changeset
481 const char* _left_op;
dbbe28fc66b5 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 0
diff changeset
482 const char* _relation;
dbbe28fc66b5 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 0
diff changeset
483 const int _right_inst;
dbbe28fc66b5 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 0
diff changeset
484 const char* _right_op;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
485
a61af66fc99e Initial load
duke
parents:
diff changeset
486 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
487 // Public Methods
603
dbbe28fc66b5 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 0
diff changeset
488 PeepConstraint(int left_inst, char* left_op, char* relation,
dbbe28fc66b5 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 0
diff changeset
489 int right_inst, char* right_op);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
490 ~PeepConstraint();
a61af66fc99e Initial load
duke
parents:
diff changeset
491
a61af66fc99e Initial load
duke
parents:
diff changeset
492 // Check if constraints use instruction at position
603
dbbe28fc66b5 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 0
diff changeset
493 bool constrains_instruction(int position);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
494
a61af66fc99e Initial load
duke
parents:
diff changeset
495 // Add another constraint
a61af66fc99e Initial load
duke
parents:
diff changeset
496 void append(PeepConstraint *next_peep_constraint);
a61af66fc99e Initial load
duke
parents:
diff changeset
497 // Access the next constraint in the list
a61af66fc99e Initial load
duke
parents:
diff changeset
498 PeepConstraint *next();
a61af66fc99e Initial load
duke
parents:
diff changeset
499
a61af66fc99e Initial load
duke
parents:
diff changeset
500 void dump();
a61af66fc99e Initial load
duke
parents:
diff changeset
501 void output(FILE *fp);
a61af66fc99e Initial load
duke
parents:
diff changeset
502 };
a61af66fc99e Initial load
duke
parents:
diff changeset
503
a61af66fc99e Initial load
duke
parents:
diff changeset
504
a61af66fc99e Initial load
duke
parents:
diff changeset
505 class PeepReplace : public Form {
a61af66fc99e Initial load
duke
parents:
diff changeset
506 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
507 char *_rule;
a61af66fc99e Initial load
duke
parents:
diff changeset
508 NameList _instruction;
a61af66fc99e Initial load
duke
parents:
diff changeset
509 NameList _operand_inst_num;
a61af66fc99e Initial load
duke
parents:
diff changeset
510 NameList _operand_op_name;
a61af66fc99e Initial load
duke
parents:
diff changeset
511
a61af66fc99e Initial load
duke
parents:
diff changeset
512 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
513
a61af66fc99e Initial load
duke
parents:
diff changeset
514 // Public Methods
a61af66fc99e Initial load
duke
parents:
diff changeset
515 PeepReplace(char *rule);
a61af66fc99e Initial load
duke
parents:
diff changeset
516 ~PeepReplace();
a61af66fc99e Initial load
duke
parents:
diff changeset
517
a61af66fc99e Initial load
duke
parents:
diff changeset
518 // Add contents of peepreplace
a61af66fc99e Initial load
duke
parents:
diff changeset
519 void add_instruction(char *root);
a61af66fc99e Initial load
duke
parents:
diff changeset
520 void add_operand( int inst_num, char *inst_operand );
a61af66fc99e Initial load
duke
parents:
diff changeset
521
a61af66fc99e Initial load
duke
parents:
diff changeset
522 // Access contents of peepreplace
a61af66fc99e Initial load
duke
parents:
diff changeset
523 void reset();
a61af66fc99e Initial load
duke
parents:
diff changeset
524 void next_instruction(const char * &root);
603
dbbe28fc66b5 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 0
diff changeset
525 void next_operand(int &inst_num, const char * &inst_operand );
0
a61af66fc99e Initial load
duke
parents:
diff changeset
526
a61af66fc99e Initial load
duke
parents:
diff changeset
527 // Utilities
a61af66fc99e Initial load
duke
parents:
diff changeset
528 void dump();
a61af66fc99e Initial load
duke
parents:
diff changeset
529 void output(FILE *fp);
a61af66fc99e Initial load
duke
parents:
diff changeset
530 };
a61af66fc99e Initial load
duke
parents:
diff changeset
531
a61af66fc99e Initial load
duke
parents:
diff changeset
532
a61af66fc99e Initial load
duke
parents:
diff changeset
533 class PeepChild : public Form {
a61af66fc99e Initial load
duke
parents:
diff changeset
534 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
535 const int _inst_num; // Number of instruction (-1 if only named)
a61af66fc99e Initial load
duke
parents:
diff changeset
536 const char *_inst_op; // Instruction's operand, NULL if number == -1
a61af66fc99e Initial load
duke
parents:
diff changeset
537 const char *_inst_name; // Name of the instruction
a61af66fc99e Initial load
duke
parents:
diff changeset
538
a61af66fc99e Initial load
duke
parents:
diff changeset
539 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
540 PeepChild(char *inst_name)
a61af66fc99e Initial load
duke
parents:
diff changeset
541 : _inst_num(-1), _inst_op(NULL), _inst_name(inst_name) {};
a61af66fc99e Initial load
duke
parents:
diff changeset
542 PeepChild(int inst_num, char *inst_op, char *inst_name)
a61af66fc99e Initial load
duke
parents:
diff changeset
543 : _inst_num(inst_num), _inst_op(inst_op), _inst_name(inst_name) {};
a61af66fc99e Initial load
duke
parents:
diff changeset
544 ~PeepChild();
a61af66fc99e Initial load
duke
parents:
diff changeset
545
a61af66fc99e Initial load
duke
parents:
diff changeset
546 bool use_leaf_operand() { return _inst_num != -1; };
a61af66fc99e Initial load
duke
parents:
diff changeset
547 bool generate_an_instruction() { return _inst_num == -1; }
a61af66fc99e Initial load
duke
parents:
diff changeset
548
a61af66fc99e Initial load
duke
parents:
diff changeset
549 void dump();
a61af66fc99e Initial load
duke
parents:
diff changeset
550 void output(FILE *fp);
a61af66fc99e Initial load
duke
parents:
diff changeset
551 };
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
552
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
553 #endif // SHARE_VM_ADLC_FORMSOPT_HPP