annotate src/share/vm/adlc/archDesc.cpp @ 14456:abec000618bf

Merge
author kvn
date Tue, 28 Jan 2014 12:25:34 -0800
parents d16be2b85802 ad6695638a35
children cd5d10655495
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 //
14223
de6a9e811145 8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013
mikael
parents: 12972
diff changeset
2 // Copyright (c) 1997, 2013, 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: 968
diff changeset
19 // Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 968
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: 968
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
a61af66fc99e Initial load
duke
parents:
diff changeset
25
a61af66fc99e Initial load
duke
parents:
diff changeset
26 // archDesc.cpp - Internal format for architecture definition
a61af66fc99e Initial load
duke
parents:
diff changeset
27 #include "adlc.hpp"
a61af66fc99e Initial load
duke
parents:
diff changeset
28
a61af66fc99e Initial load
duke
parents:
diff changeset
29 static FILE *errfile = stderr;
a61af66fc99e Initial load
duke
parents:
diff changeset
30
a61af66fc99e Initial load
duke
parents:
diff changeset
31 //--------------------------- utility functions -----------------------------
10389
f15fe46d8c00 8015266: fix some -Wsign-compare warnings in adlc
twisti
parents: 8875
diff changeset
32 inline char toUpper(char lower) {
f15fe46d8c00 8015266: fix some -Wsign-compare warnings in adlc
twisti
parents: 8875
diff changeset
33 return (('a' <= lower && lower <= 'z') ? ((char) (lower + ('A'-'a'))) : lower);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
34 }
a61af66fc99e Initial load
duke
parents:
diff changeset
35 char *toUpper(const char *str) {
a61af66fc99e Initial load
duke
parents:
diff changeset
36 char *upper = new char[strlen(str)+1];
a61af66fc99e Initial load
duke
parents:
diff changeset
37 char *result = upper;
a61af66fc99e Initial load
duke
parents:
diff changeset
38 const char *end = str + strlen(str);
a61af66fc99e Initial load
duke
parents:
diff changeset
39 for (; str < end; ++str, ++upper) {
a61af66fc99e Initial load
duke
parents:
diff changeset
40 *upper = toUpper(*str);
a61af66fc99e Initial load
duke
parents:
diff changeset
41 }
a61af66fc99e Initial load
duke
parents:
diff changeset
42 *upper = '\0';
a61af66fc99e Initial load
duke
parents:
diff changeset
43 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
44 }
a61af66fc99e Initial load
duke
parents:
diff changeset
45
a61af66fc99e Initial load
duke
parents:
diff changeset
46 //---------------------------ChainList Methods-------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
47 ChainList::ChainList() {
a61af66fc99e Initial load
duke
parents:
diff changeset
48 }
a61af66fc99e Initial load
duke
parents:
diff changeset
49
a61af66fc99e Initial load
duke
parents:
diff changeset
50 void ChainList::insert(const char *name, const char *cost, const char *rule) {
a61af66fc99e Initial load
duke
parents:
diff changeset
51 _name.addName(name);
a61af66fc99e Initial load
duke
parents:
diff changeset
52 _cost.addName(cost);
a61af66fc99e Initial load
duke
parents:
diff changeset
53 _rule.addName(rule);
a61af66fc99e Initial load
duke
parents:
diff changeset
54 }
a61af66fc99e Initial load
duke
parents:
diff changeset
55
a61af66fc99e Initial load
duke
parents:
diff changeset
56 bool ChainList::search(const char *name) {
a61af66fc99e Initial load
duke
parents:
diff changeset
57 return _name.search(name);
a61af66fc99e Initial load
duke
parents:
diff changeset
58 }
a61af66fc99e Initial load
duke
parents:
diff changeset
59
a61af66fc99e Initial load
duke
parents:
diff changeset
60 void ChainList::reset() {
a61af66fc99e Initial load
duke
parents:
diff changeset
61 _name.reset();
a61af66fc99e Initial load
duke
parents:
diff changeset
62 _cost.reset();
a61af66fc99e Initial load
duke
parents:
diff changeset
63 _rule.reset();
a61af66fc99e Initial load
duke
parents:
diff changeset
64 }
a61af66fc99e Initial load
duke
parents:
diff changeset
65
a61af66fc99e Initial load
duke
parents:
diff changeset
66 bool ChainList::iter(const char * &name, const char * &cost, const char * &rule) {
a61af66fc99e Initial load
duke
parents:
diff changeset
67 bool notDone = false;
a61af66fc99e Initial load
duke
parents:
diff changeset
68 const char *n = _name.iter();
a61af66fc99e Initial load
duke
parents:
diff changeset
69 const char *c = _cost.iter();
a61af66fc99e Initial load
duke
parents:
diff changeset
70 const char *r = _rule.iter();
a61af66fc99e Initial load
duke
parents:
diff changeset
71
a61af66fc99e Initial load
duke
parents:
diff changeset
72 if (n && c && r) {
a61af66fc99e Initial load
duke
parents:
diff changeset
73 notDone = true;
a61af66fc99e Initial load
duke
parents:
diff changeset
74 name = n;
a61af66fc99e Initial load
duke
parents:
diff changeset
75 cost = c;
a61af66fc99e Initial load
duke
parents:
diff changeset
76 rule = r;
a61af66fc99e Initial load
duke
parents:
diff changeset
77 }
a61af66fc99e Initial load
duke
parents:
diff changeset
78
a61af66fc99e Initial load
duke
parents:
diff changeset
79 return notDone;
a61af66fc99e Initial load
duke
parents:
diff changeset
80 }
a61af66fc99e Initial load
duke
parents:
diff changeset
81
a61af66fc99e Initial load
duke
parents:
diff changeset
82 void ChainList::dump() {
a61af66fc99e Initial load
duke
parents:
diff changeset
83 output(stderr);
a61af66fc99e Initial load
duke
parents:
diff changeset
84 }
a61af66fc99e Initial load
duke
parents:
diff changeset
85
a61af66fc99e Initial load
duke
parents:
diff changeset
86 void ChainList::output(FILE *fp) {
a61af66fc99e Initial load
duke
parents:
diff changeset
87 fprintf(fp, "\nChain Rules: output resets iterator\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
88 const char *cost = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
89 const char *name = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
90 const char *rule = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
91 bool chains_exist = false;
a61af66fc99e Initial load
duke
parents:
diff changeset
92 for(reset(); (iter(name,cost,rule)) == true; ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
93 fprintf(fp, "Chain to <%s> at cost #%s using %s_rule\n",name, cost ? cost : "0", rule);
a61af66fc99e Initial load
duke
parents:
diff changeset
94 // // Check for transitive chain rules
a61af66fc99e Initial load
duke
parents:
diff changeset
95 // Form *form = (Form *)_globalNames[rule];
a61af66fc99e Initial load
duke
parents:
diff changeset
96 // if (form->is_instruction()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
97 // // chain_rule(fp, indent, name, cost, rule);
a61af66fc99e Initial load
duke
parents:
diff changeset
98 // chain_rule(fp, indent, name, cost, rule);
a61af66fc99e Initial load
duke
parents:
diff changeset
99 // }
a61af66fc99e Initial load
duke
parents:
diff changeset
100 }
a61af66fc99e Initial load
duke
parents:
diff changeset
101 reset();
a61af66fc99e Initial load
duke
parents:
diff changeset
102 if( ! chains_exist ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
103 fprintf(fp, "No entries in this ChainList\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
104 }
a61af66fc99e Initial load
duke
parents:
diff changeset
105 }
a61af66fc99e Initial load
duke
parents:
diff changeset
106
a61af66fc99e Initial load
duke
parents:
diff changeset
107
a61af66fc99e Initial load
duke
parents:
diff changeset
108 //---------------------------MatchList Methods-------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
109 bool MatchList::search(const char *opc, const char *res, const char *lch,
a61af66fc99e Initial load
duke
parents:
diff changeset
110 const char *rch, Predicate *pr) {
a61af66fc99e Initial load
duke
parents:
diff changeset
111 bool tmp = false;
a61af66fc99e Initial load
duke
parents:
diff changeset
112 if ((res == _resultStr) || (res && _resultStr && !strcmp(res, _resultStr))) {
a61af66fc99e Initial load
duke
parents:
diff changeset
113 if ((lch == _lchild) || (lch && _lchild && !strcmp(lch, _lchild))) {
a61af66fc99e Initial load
duke
parents:
diff changeset
114 if ((rch == _rchild) || (rch && _rchild && !strcmp(rch, _rchild))) {
a61af66fc99e Initial load
duke
parents:
diff changeset
115 char * predStr = get_pred();
a61af66fc99e Initial load
duke
parents:
diff changeset
116 char * prStr = pr?pr->_pred:NULL;
475
284d0af00d53 6771309: debugging AD files is difficult without #line directives in generated code
jrose
parents: 433
diff changeset
117 if (ADLParser::equivalent_expressions(prStr, predStr)) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
118 return true;
a61af66fc99e Initial load
duke
parents:
diff changeset
119 }
a61af66fc99e Initial load
duke
parents:
diff changeset
120 }
a61af66fc99e Initial load
duke
parents:
diff changeset
121 }
a61af66fc99e Initial load
duke
parents:
diff changeset
122 }
a61af66fc99e Initial load
duke
parents:
diff changeset
123 if (_next) {
a61af66fc99e Initial load
duke
parents:
diff changeset
124 tmp = _next->search(opc, res, lch, rch, pr);
a61af66fc99e Initial load
duke
parents:
diff changeset
125 }
a61af66fc99e Initial load
duke
parents:
diff changeset
126 return tmp;
a61af66fc99e Initial load
duke
parents:
diff changeset
127 }
a61af66fc99e Initial load
duke
parents:
diff changeset
128
a61af66fc99e Initial load
duke
parents:
diff changeset
129
a61af66fc99e Initial load
duke
parents:
diff changeset
130 void MatchList::dump() {
a61af66fc99e Initial load
duke
parents:
diff changeset
131 output(stderr);
a61af66fc99e Initial load
duke
parents:
diff changeset
132 }
a61af66fc99e Initial load
duke
parents:
diff changeset
133
a61af66fc99e Initial load
duke
parents:
diff changeset
134 void MatchList::output(FILE *fp) {
a61af66fc99e Initial load
duke
parents:
diff changeset
135 fprintf(fp, "\nMatchList output is Unimplemented();\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
136 }
a61af66fc99e Initial load
duke
parents:
diff changeset
137
a61af66fc99e Initial load
duke
parents:
diff changeset
138
a61af66fc99e Initial load
duke
parents:
diff changeset
139 //---------------------------ArchDesc Constructor and Destructor-------------
a61af66fc99e Initial load
duke
parents:
diff changeset
140
a61af66fc99e Initial load
duke
parents:
diff changeset
141 ArchDesc::ArchDesc()
a61af66fc99e Initial load
duke
parents:
diff changeset
142 : _globalNames(cmpstr,hashstr, Form::arena),
a61af66fc99e Initial load
duke
parents:
diff changeset
143 _globalDefs(cmpstr,hashstr, Form::arena),
a61af66fc99e Initial load
duke
parents:
diff changeset
144 _preproc_table(cmpstr,hashstr, Form::arena),
a61af66fc99e Initial load
duke
parents:
diff changeset
145 _idealIndex(cmpstr,hashstr, Form::arena),
a61af66fc99e Initial load
duke
parents:
diff changeset
146 _internalOps(cmpstr,hashstr, Form::arena),
a61af66fc99e Initial load
duke
parents:
diff changeset
147 _internalMatch(cmpstr,hashstr, Form::arena),
a61af66fc99e Initial load
duke
parents:
diff changeset
148 _chainRules(cmpstr,hashstr, Form::arena),
14449
ad6695638a35 8030863: PPC64: (part 220): ConstantTableBase for calls between args and jvms
goetz
parents: 12972
diff changeset
149 _cisc_spill_operand(NULL),
ad6695638a35 8030863: PPC64: (part 220): ConstantTableBase for calls between args and jvms
goetz
parents: 12972
diff changeset
150 _needs_clone_jvms(false) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
151
a61af66fc99e Initial load
duke
parents:
diff changeset
152 // Initialize the opcode to MatchList table with NULLs
a61af66fc99e Initial load
duke
parents:
diff changeset
153 for( int i=0; i<_last_opcode; ++i ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
154 _mlistab[i] = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
155 }
a61af66fc99e Initial load
duke
parents:
diff changeset
156
a61af66fc99e Initial load
duke
parents:
diff changeset
157 // Set-up the global tables
a61af66fc99e Initial load
duke
parents:
diff changeset
158 initKeywords(_globalNames); // Initialize the Name Table with keywords
a61af66fc99e Initial load
duke
parents:
diff changeset
159
a61af66fc99e Initial load
duke
parents:
diff changeset
160 // Prime user-defined types with predefined types: Set, RegI, RegF, ...
a61af66fc99e Initial load
duke
parents:
diff changeset
161 initBaseOpTypes();
a61af66fc99e Initial load
duke
parents:
diff changeset
162
a61af66fc99e Initial load
duke
parents:
diff changeset
163 // Initialize flags & counters
a61af66fc99e Initial load
duke
parents:
diff changeset
164 _TotalLines = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
165 _no_output = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
166 _quiet_mode = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
167 _disable_warnings = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
168 _dfa_debug = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
169 _dfa_small = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
170 _adl_debug = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
171 _adlocation_debug = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
172 _internalOpCounter = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
173 _cisc_spill_debug = false;
a61af66fc99e Initial load
duke
parents:
diff changeset
174 _short_branch_debug = false;
a61af66fc99e Initial load
duke
parents:
diff changeset
175
a61af66fc99e Initial load
duke
parents:
diff changeset
176 // Initialize match rule flags
a61af66fc99e Initial load
duke
parents:
diff changeset
177 for (int i = 0; i < _last_opcode; i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
178 _has_match_rule[i] = false;
a61af66fc99e Initial load
duke
parents:
diff changeset
179 }
a61af66fc99e Initial load
duke
parents:
diff changeset
180
a61af66fc99e Initial load
duke
parents:
diff changeset
181 // Error/Warning Counts
a61af66fc99e Initial load
duke
parents:
diff changeset
182 _syntax_errs = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
183 _semantic_errs = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
184 _warnings = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
185 _internal_errs = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
186
a61af66fc99e Initial load
duke
parents:
diff changeset
187 // Initialize I/O Files
a61af66fc99e Initial load
duke
parents:
diff changeset
188 _ADL_file._name = NULL; _ADL_file._fp = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
189 // Machine dependent output files
433
c1345e85f901 6767659: Conversion from i486 to x86 missed some entries in makefiles
kvn
parents: 196
diff changeset
190 _DFA_file._name = NULL; _DFA_file._fp = NULL;
c1345e85f901 6767659: Conversion from i486 to x86 missed some entries in makefiles
kvn
parents: 196
diff changeset
191 _HPP_file._name = NULL; _HPP_file._fp = NULL;
c1345e85f901 6767659: Conversion from i486 to x86 missed some entries in makefiles
kvn
parents: 196
diff changeset
192 _CPP_file._name = NULL; _CPP_file._fp = NULL;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
193 _bug_file._name = "bugs.out"; _bug_file._fp = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
194
a61af66fc99e Initial load
duke
parents:
diff changeset
195 // Initialize Register & Pipeline Form Pointers
a61af66fc99e Initial load
duke
parents:
diff changeset
196 _register = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
197 _encode = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
198 _pipeline = NULL;
6850
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
199 _frame = NULL;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
200 }
a61af66fc99e Initial load
duke
parents:
diff changeset
201
a61af66fc99e Initial load
duke
parents:
diff changeset
202 ArchDesc::~ArchDesc() {
a61af66fc99e Initial load
duke
parents:
diff changeset
203 // Clean-up and quit
a61af66fc99e Initial load
duke
parents:
diff changeset
204
a61af66fc99e Initial load
duke
parents:
diff changeset
205 }
a61af66fc99e Initial load
duke
parents:
diff changeset
206
a61af66fc99e Initial load
duke
parents:
diff changeset
207 //---------------------------ArchDesc methods: Public ----------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
208 // Store forms according to type
a61af66fc99e Initial load
duke
parents:
diff changeset
209 void ArchDesc::addForm(PreHeaderForm *ptr) { _pre_header.addForm(ptr); };
a61af66fc99e Initial load
duke
parents:
diff changeset
210 void ArchDesc::addForm(HeaderForm *ptr) { _header.addForm(ptr); };
a61af66fc99e Initial load
duke
parents:
diff changeset
211 void ArchDesc::addForm(SourceForm *ptr) { _source.addForm(ptr); };
a61af66fc99e Initial load
duke
parents:
diff changeset
212 void ArchDesc::addForm(EncodeForm *ptr) { _encode = ptr; };
a61af66fc99e Initial load
duke
parents:
diff changeset
213 void ArchDesc::addForm(InstructForm *ptr) { _instructions.addForm(ptr); };
a61af66fc99e Initial load
duke
parents:
diff changeset
214 void ArchDesc::addForm(MachNodeForm *ptr) { _machnodes.addForm(ptr); };
a61af66fc99e Initial load
duke
parents:
diff changeset
215 void ArchDesc::addForm(OperandForm *ptr) { _operands.addForm(ptr); };
a61af66fc99e Initial load
duke
parents:
diff changeset
216 void ArchDesc::addForm(OpClassForm *ptr) { _opclass.addForm(ptr); };
a61af66fc99e Initial load
duke
parents:
diff changeset
217 void ArchDesc::addForm(AttributeForm *ptr) { _attributes.addForm(ptr); };
a61af66fc99e Initial load
duke
parents:
diff changeset
218 void ArchDesc::addForm(RegisterForm *ptr) { _register = ptr; };
a61af66fc99e Initial load
duke
parents:
diff changeset
219 void ArchDesc::addForm(FrameForm *ptr) { _frame = ptr; };
a61af66fc99e Initial load
duke
parents:
diff changeset
220 void ArchDesc::addForm(PipelineForm *ptr) { _pipeline = ptr; };
a61af66fc99e Initial load
duke
parents:
diff changeset
221
a61af66fc99e Initial load
duke
parents:
diff changeset
222 // Build MatchList array and construct MatchLists
a61af66fc99e Initial load
duke
parents:
diff changeset
223 void ArchDesc::generateMatchLists() {
a61af66fc99e Initial load
duke
parents:
diff changeset
224 // Call inspection routines to populate array
a61af66fc99e Initial load
duke
parents:
diff changeset
225 inspectOperands();
a61af66fc99e Initial load
duke
parents:
diff changeset
226 inspectInstructions();
a61af66fc99e Initial load
duke
parents:
diff changeset
227 }
a61af66fc99e Initial load
duke
parents:
diff changeset
228
a61af66fc99e Initial load
duke
parents:
diff changeset
229 // Build MatchList structures for operands
a61af66fc99e Initial load
duke
parents:
diff changeset
230 void ArchDesc::inspectOperands() {
a61af66fc99e Initial load
duke
parents:
diff changeset
231
a61af66fc99e Initial load
duke
parents:
diff changeset
232 // Iterate through all operands
a61af66fc99e Initial load
duke
parents:
diff changeset
233 _operands.reset();
a61af66fc99e Initial load
duke
parents:
diff changeset
234 OperandForm *op;
a61af66fc99e Initial load
duke
parents:
diff changeset
235 for( ; (op = (OperandForm*)_operands.iter()) != NULL;) {
a61af66fc99e Initial load
duke
parents:
diff changeset
236 // Construct list of top-level operands (components)
a61af66fc99e Initial load
duke
parents:
diff changeset
237 op->build_components();
a61af66fc99e Initial load
duke
parents:
diff changeset
238
a61af66fc99e Initial load
duke
parents:
diff changeset
239 // Ensure that match field is defined.
a61af66fc99e Initial load
duke
parents:
diff changeset
240 if ( op->_matrule == NULL ) continue;
a61af66fc99e Initial load
duke
parents:
diff changeset
241
a61af66fc99e Initial load
duke
parents:
diff changeset
242 // Type check match rules
a61af66fc99e Initial load
duke
parents:
diff changeset
243 check_optype(op->_matrule);
a61af66fc99e Initial load
duke
parents:
diff changeset
244
a61af66fc99e Initial load
duke
parents:
diff changeset
245 // Construct chain rules
a61af66fc99e Initial load
duke
parents:
diff changeset
246 build_chain_rule(op);
a61af66fc99e Initial load
duke
parents:
diff changeset
247
a61af66fc99e Initial load
duke
parents:
diff changeset
248 MatchRule &mrule = *op->_matrule;
a61af66fc99e Initial load
duke
parents:
diff changeset
249 Predicate *pred = op->_predicate;
a61af66fc99e Initial load
duke
parents:
diff changeset
250
a61af66fc99e Initial load
duke
parents:
diff changeset
251 // Grab the machine type of the operand
a61af66fc99e Initial load
duke
parents:
diff changeset
252 const char *rootOp = op->_ident;
a61af66fc99e Initial load
duke
parents:
diff changeset
253 mrule._machType = rootOp;
a61af66fc99e Initial load
duke
parents:
diff changeset
254
a61af66fc99e Initial load
duke
parents:
diff changeset
255 // Check for special cases
a61af66fc99e Initial load
duke
parents:
diff changeset
256 if (strcmp(rootOp,"Universe")==0) continue;
a61af66fc99e Initial load
duke
parents:
diff changeset
257 if (strcmp(rootOp,"label")==0) continue;
a61af66fc99e Initial load
duke
parents:
diff changeset
258 // !!!!! !!!!!
a61af66fc99e Initial load
duke
parents:
diff changeset
259 assert( strcmp(rootOp,"sReg") != 0, "Disable untyped 'sReg'");
a61af66fc99e Initial load
duke
parents:
diff changeset
260 if (strcmp(rootOp,"sRegI")==0) continue;
a61af66fc99e Initial load
duke
parents:
diff changeset
261 if (strcmp(rootOp,"sRegP")==0) continue;
a61af66fc99e Initial load
duke
parents:
diff changeset
262 if (strcmp(rootOp,"sRegF")==0) continue;
a61af66fc99e Initial load
duke
parents:
diff changeset
263 if (strcmp(rootOp,"sRegD")==0) continue;
a61af66fc99e Initial load
duke
parents:
diff changeset
264 if (strcmp(rootOp,"sRegL")==0) continue;
a61af66fc99e Initial load
duke
parents:
diff changeset
265
a61af66fc99e Initial load
duke
parents:
diff changeset
266 // Cost for this match
a61af66fc99e Initial load
duke
parents:
diff changeset
267 const char *costStr = op->cost();
a61af66fc99e Initial load
duke
parents:
diff changeset
268 const char *defaultCost =
a61af66fc99e Initial load
duke
parents:
diff changeset
269 ((AttributeForm*)_globalNames[AttributeForm::_op_cost])->_attrdef;
a61af66fc99e Initial load
duke
parents:
diff changeset
270 const char *cost = costStr? costStr : defaultCost;
a61af66fc99e Initial load
duke
parents:
diff changeset
271
a61af66fc99e Initial load
duke
parents:
diff changeset
272 // Find result type for match.
a61af66fc99e Initial load
duke
parents:
diff changeset
273 const char *result = op->reduce_result();
a61af66fc99e Initial load
duke
parents:
diff changeset
274 bool has_root = false;
a61af66fc99e Initial load
duke
parents:
diff changeset
275
a61af66fc99e Initial load
duke
parents:
diff changeset
276 // Construct a MatchList for this entry
a61af66fc99e Initial load
duke
parents:
diff changeset
277 buildMatchList(op->_matrule, result, rootOp, pred, cost);
a61af66fc99e Initial load
duke
parents:
diff changeset
278 }
a61af66fc99e Initial load
duke
parents:
diff changeset
279 }
a61af66fc99e Initial load
duke
parents:
diff changeset
280
a61af66fc99e Initial load
duke
parents:
diff changeset
281 // Build MatchList structures for instructions
a61af66fc99e Initial load
duke
parents:
diff changeset
282 void ArchDesc::inspectInstructions() {
a61af66fc99e Initial load
duke
parents:
diff changeset
283
a61af66fc99e Initial load
duke
parents:
diff changeset
284 // Iterate through all instructions
a61af66fc99e Initial load
duke
parents:
diff changeset
285 _instructions.reset();
a61af66fc99e Initial load
duke
parents:
diff changeset
286 InstructForm *instr;
a61af66fc99e Initial load
duke
parents:
diff changeset
287 for( ; (instr = (InstructForm*)_instructions.iter()) != NULL; ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
288 // Construct list of top-level operands (components)
a61af66fc99e Initial load
duke
parents:
diff changeset
289 instr->build_components();
a61af66fc99e Initial load
duke
parents:
diff changeset
290
a61af66fc99e Initial load
duke
parents:
diff changeset
291 // Ensure that match field is defined.
a61af66fc99e Initial load
duke
parents:
diff changeset
292 if ( instr->_matrule == NULL ) continue;
a61af66fc99e Initial load
duke
parents:
diff changeset
293
a61af66fc99e Initial load
duke
parents:
diff changeset
294 MatchRule &mrule = *instr->_matrule;
a61af66fc99e Initial load
duke
parents:
diff changeset
295 Predicate *pred = instr->build_predicate();
a61af66fc99e Initial load
duke
parents:
diff changeset
296
a61af66fc99e Initial load
duke
parents:
diff changeset
297 // Grab the machine type of the operand
a61af66fc99e Initial load
duke
parents:
diff changeset
298 const char *rootOp = instr->_ident;
a61af66fc99e Initial load
duke
parents:
diff changeset
299 mrule._machType = rootOp;
a61af66fc99e Initial load
duke
parents:
diff changeset
300
a61af66fc99e Initial load
duke
parents:
diff changeset
301 // Cost for this match
a61af66fc99e Initial load
duke
parents:
diff changeset
302 const char *costStr = instr->cost();
a61af66fc99e Initial load
duke
parents:
diff changeset
303 const char *defaultCost =
a61af66fc99e Initial load
duke
parents:
diff changeset
304 ((AttributeForm*)_globalNames[AttributeForm::_ins_cost])->_attrdef;
a61af66fc99e Initial load
duke
parents:
diff changeset
305 const char *cost = costStr? costStr : defaultCost;
a61af66fc99e Initial load
duke
parents:
diff changeset
306
a61af66fc99e Initial load
duke
parents:
diff changeset
307 // Find result type for match
a61af66fc99e Initial load
duke
parents:
diff changeset
308 const char *result = instr->reduce_result();
a61af66fc99e Initial load
duke
parents:
diff changeset
309
3853
11211f7cb5a0 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 3842
diff changeset
310 if ( instr->is_ideal_branch() && instr->label_position() == -1 ||
11211f7cb5a0 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 3842
diff changeset
311 !instr->is_ideal_branch() && instr->label_position() != -1) {
11211f7cb5a0 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 3842
diff changeset
312 syntax_err(instr->_linenum, "%s: Only branches to a label are supported\n", rootOp);
11211f7cb5a0 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 3842
diff changeset
313 }
11211f7cb5a0 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 3842
diff changeset
314
0
a61af66fc99e Initial load
duke
parents:
diff changeset
315 Attribute *attr = instr->_attribs;
a61af66fc99e Initial load
duke
parents:
diff changeset
316 while (attr != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
317 if (strcmp(attr->_ident,"ins_short_branch") == 0 &&
a61af66fc99e Initial load
duke
parents:
diff changeset
318 attr->int_val(*this) != 0) {
3842
c7b60b601eb4 7069452: Cleanup NodeFlags
kvn
parents: 1972
diff changeset
319 if (!instr->is_ideal_branch() || instr->label_position() == -1) {
c7b60b601eb4 7069452: Cleanup NodeFlags
kvn
parents: 1972
diff changeset
320 syntax_err(instr->_linenum, "%s: Only short branch to a label is supported\n", rootOp);
c7b60b601eb4 7069452: Cleanup NodeFlags
kvn
parents: 1972
diff changeset
321 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
322 instr->set_short_branch(true);
a61af66fc99e Initial load
duke
parents:
diff changeset
323 } else if (strcmp(attr->_ident,"ins_alignment") == 0 &&
a61af66fc99e Initial load
duke
parents:
diff changeset
324 attr->int_val(*this) != 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
325 instr->set_alignment(attr->int_val(*this));
a61af66fc99e Initial load
duke
parents:
diff changeset
326 }
a61af66fc99e Initial load
duke
parents:
diff changeset
327 attr = (Attribute *)attr->_next;
a61af66fc99e Initial load
duke
parents:
diff changeset
328 }
a61af66fc99e Initial load
duke
parents:
diff changeset
329
a61af66fc99e Initial load
duke
parents:
diff changeset
330 if (!instr->is_short_branch()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
331 buildMatchList(instr->_matrule, result, mrule._machType, pred, cost);
a61af66fc99e Initial load
duke
parents:
diff changeset
332 }
a61af66fc99e Initial load
duke
parents:
diff changeset
333 }
a61af66fc99e Initial load
duke
parents:
diff changeset
334 }
a61af66fc99e Initial load
duke
parents:
diff changeset
335
a61af66fc99e Initial load
duke
parents:
diff changeset
336 static int setsResult(MatchRule &mrule) {
a61af66fc99e Initial load
duke
parents:
diff changeset
337 if (strcmp(mrule._name,"Set") == 0) return 1;
a61af66fc99e Initial load
duke
parents:
diff changeset
338 return 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
339 }
a61af66fc99e Initial load
duke
parents:
diff changeset
340
a61af66fc99e Initial load
duke
parents:
diff changeset
341 const char *ArchDesc::getMatchListIndex(MatchRule &mrule) {
a61af66fc99e Initial load
duke
parents:
diff changeset
342 if (setsResult(mrule)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
343 // right child
a61af66fc99e Initial load
duke
parents:
diff changeset
344 return mrule._rChild->_opType;
a61af66fc99e Initial load
duke
parents:
diff changeset
345 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
346 // first entry
a61af66fc99e Initial load
duke
parents:
diff changeset
347 return mrule._opType;
a61af66fc99e Initial load
duke
parents:
diff changeset
348 }
a61af66fc99e Initial load
duke
parents:
diff changeset
349 }
a61af66fc99e Initial load
duke
parents:
diff changeset
350
a61af66fc99e Initial load
duke
parents:
diff changeset
351
a61af66fc99e Initial load
duke
parents:
diff changeset
352 //------------------------------result of reduction----------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
353
a61af66fc99e Initial load
duke
parents:
diff changeset
354
a61af66fc99e Initial load
duke
parents:
diff changeset
355 //------------------------------left reduction---------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
356 // Return the left reduction associated with an internal name
a61af66fc99e Initial load
duke
parents:
diff changeset
357 const char *ArchDesc::reduceLeft(char *internalName) {
a61af66fc99e Initial load
duke
parents:
diff changeset
358 const char *left = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
359 MatchNode *mnode = (MatchNode*)_internalMatch[internalName];
a61af66fc99e Initial load
duke
parents:
diff changeset
360 if (mnode->_lChild) {
a61af66fc99e Initial load
duke
parents:
diff changeset
361 mnode = mnode->_lChild;
a61af66fc99e Initial load
duke
parents:
diff changeset
362 left = mnode->_internalop ? mnode->_internalop : mnode->_opType;
a61af66fc99e Initial load
duke
parents:
diff changeset
363 }
a61af66fc99e Initial load
duke
parents:
diff changeset
364 return left;
a61af66fc99e Initial load
duke
parents:
diff changeset
365 }
a61af66fc99e Initial load
duke
parents:
diff changeset
366
a61af66fc99e Initial load
duke
parents:
diff changeset
367
a61af66fc99e Initial load
duke
parents:
diff changeset
368 //------------------------------right reduction--------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
369 const char *ArchDesc::reduceRight(char *internalName) {
a61af66fc99e Initial load
duke
parents:
diff changeset
370 const char *right = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
371 MatchNode *mnode = (MatchNode*)_internalMatch[internalName];
a61af66fc99e Initial load
duke
parents:
diff changeset
372 if (mnode->_rChild) {
a61af66fc99e Initial load
duke
parents:
diff changeset
373 mnode = mnode->_rChild;
a61af66fc99e Initial load
duke
parents:
diff changeset
374 right = mnode->_internalop ? mnode->_internalop : mnode->_opType;
a61af66fc99e Initial load
duke
parents:
diff changeset
375 }
a61af66fc99e Initial load
duke
parents:
diff changeset
376 return right;
a61af66fc99e Initial load
duke
parents:
diff changeset
377 }
a61af66fc99e Initial load
duke
parents:
diff changeset
378
a61af66fc99e Initial load
duke
parents:
diff changeset
379
a61af66fc99e Initial load
duke
parents:
diff changeset
380 //------------------------------check_optype-----------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
381 void ArchDesc::check_optype(MatchRule *mrule) {
a61af66fc99e Initial load
duke
parents:
diff changeset
382 MatchRule *rule = mrule;
a61af66fc99e Initial load
duke
parents:
diff changeset
383
a61af66fc99e Initial load
duke
parents:
diff changeset
384 // !!!!!
a61af66fc99e Initial load
duke
parents:
diff changeset
385 // // Cycle through the list of match rules
a61af66fc99e Initial load
duke
parents:
diff changeset
386 // while(mrule) {
a61af66fc99e Initial load
duke
parents:
diff changeset
387 // // Check for a filled in type field
a61af66fc99e Initial load
duke
parents:
diff changeset
388 // if (mrule->_opType == NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
389 // const Form *form = operands[_result];
a61af66fc99e Initial load
duke
parents:
diff changeset
390 // OpClassForm *opcForm = form ? form->is_opclass() : NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
391 // assert(opcForm != NULL, "Match Rule contains invalid operand name.");
a61af66fc99e Initial load
duke
parents:
diff changeset
392 // }
a61af66fc99e Initial load
duke
parents:
diff changeset
393 // char *opType = opcForm->_ident;
a61af66fc99e Initial load
duke
parents:
diff changeset
394 // }
a61af66fc99e Initial load
duke
parents:
diff changeset
395 }
a61af66fc99e Initial load
duke
parents:
diff changeset
396
a61af66fc99e Initial load
duke
parents:
diff changeset
397 //------------------------------add_chain_rule_entry--------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
398 void ArchDesc::add_chain_rule_entry(const char *src, const char *cost,
a61af66fc99e Initial load
duke
parents:
diff changeset
399 const char *result) {
a61af66fc99e Initial load
duke
parents:
diff changeset
400 // Look-up the operation in chain rule table
a61af66fc99e Initial load
duke
parents:
diff changeset
401 ChainList *lst = (ChainList *)_chainRules[src];
a61af66fc99e Initial load
duke
parents:
diff changeset
402 if (lst == NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
403 lst = new ChainList();
a61af66fc99e Initial load
duke
parents:
diff changeset
404 _chainRules.Insert(src, lst);
a61af66fc99e Initial load
duke
parents:
diff changeset
405 }
a61af66fc99e Initial load
duke
parents:
diff changeset
406 if (!lst->search(result)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
407 if (cost == NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
408 cost = ((AttributeForm*)_globalNames[AttributeForm::_op_cost])->_attrdef;
a61af66fc99e Initial load
duke
parents:
diff changeset
409 }
a61af66fc99e Initial load
duke
parents:
diff changeset
410 lst->insert(result, cost, result);
a61af66fc99e Initial load
duke
parents:
diff changeset
411 }
a61af66fc99e Initial load
duke
parents:
diff changeset
412 }
a61af66fc99e Initial load
duke
parents:
diff changeset
413
a61af66fc99e Initial load
duke
parents:
diff changeset
414 //------------------------------build_chain_rule-------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
415 void ArchDesc::build_chain_rule(OperandForm *oper) {
a61af66fc99e Initial load
duke
parents:
diff changeset
416 MatchRule *rule;
a61af66fc99e Initial load
duke
parents:
diff changeset
417
a61af66fc99e Initial load
duke
parents:
diff changeset
418 // Check for chain rules here
a61af66fc99e Initial load
duke
parents:
diff changeset
419 // If this is only a chain rule
a61af66fc99e Initial load
duke
parents:
diff changeset
420 if ((oper->_matrule) && (oper->_matrule->_lChild == NULL) &&
a61af66fc99e Initial load
duke
parents:
diff changeset
421 (oper->_matrule->_rChild == NULL)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
422
603
dbbe28fc66b5 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 475
diff changeset
423 {
dbbe28fc66b5 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 475
diff changeset
424 const Form *form = _globalNames[oper->_matrule->_opType];
dbbe28fc66b5 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 475
diff changeset
425 if ((form) && form->is_operand() &&
dbbe28fc66b5 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 475
diff changeset
426 (form->ideal_only() == false)) {
dbbe28fc66b5 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 475
diff changeset
427 add_chain_rule_entry(oper->_matrule->_opType, oper->cost(), oper->_ident);
dbbe28fc66b5 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 475
diff changeset
428 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
429 }
a61af66fc99e Initial load
duke
parents:
diff changeset
430 // Check for additional chain rules
a61af66fc99e Initial load
duke
parents:
diff changeset
431 if (oper->_matrule->_next) {
a61af66fc99e Initial load
duke
parents:
diff changeset
432 rule = oper->_matrule;
a61af66fc99e Initial load
duke
parents:
diff changeset
433 do {
a61af66fc99e Initial load
duke
parents:
diff changeset
434 rule = rule->_next;
a61af66fc99e Initial load
duke
parents:
diff changeset
435 // Any extra match rules after the first must be chain rules
a61af66fc99e Initial load
duke
parents:
diff changeset
436 const Form *form = _globalNames[rule->_opType];
a61af66fc99e Initial load
duke
parents:
diff changeset
437 if ((form) && form->is_operand() &&
a61af66fc99e Initial load
duke
parents:
diff changeset
438 (form->ideal_only() == false)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
439 add_chain_rule_entry(rule->_opType, oper->cost(), oper->_ident);
a61af66fc99e Initial load
duke
parents:
diff changeset
440 }
a61af66fc99e Initial load
duke
parents:
diff changeset
441 } while(rule->_next != NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
442 }
a61af66fc99e Initial load
duke
parents:
diff changeset
443 }
a61af66fc99e Initial load
duke
parents:
diff changeset
444 else if ((oper->_matrule) && (oper->_matrule->_next)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
445 // Regardles of whether the first matchrule is a chain rule, check the list
a61af66fc99e Initial load
duke
parents:
diff changeset
446 rule = oper->_matrule;
a61af66fc99e Initial load
duke
parents:
diff changeset
447 do {
a61af66fc99e Initial load
duke
parents:
diff changeset
448 rule = rule->_next;
a61af66fc99e Initial load
duke
parents:
diff changeset
449 // Any extra match rules after the first must be chain rules
a61af66fc99e Initial load
duke
parents:
diff changeset
450 const Form *form = _globalNames[rule->_opType];
a61af66fc99e Initial load
duke
parents:
diff changeset
451 if ((form) && form->is_operand() &&
a61af66fc99e Initial load
duke
parents:
diff changeset
452 (form->ideal_only() == false)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
453 assert( oper->cost(), "This case expects NULL cost, not default cost");
a61af66fc99e Initial load
duke
parents:
diff changeset
454 add_chain_rule_entry(rule->_opType, oper->cost(), oper->_ident);
a61af66fc99e Initial load
duke
parents:
diff changeset
455 }
a61af66fc99e Initial load
duke
parents:
diff changeset
456 } while(rule->_next != NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
457 }
a61af66fc99e Initial load
duke
parents:
diff changeset
458
a61af66fc99e Initial load
duke
parents:
diff changeset
459 }
a61af66fc99e Initial load
duke
parents:
diff changeset
460
a61af66fc99e Initial load
duke
parents:
diff changeset
461 //------------------------------buildMatchList---------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
462 // operands and instructions provide the result
a61af66fc99e Initial load
duke
parents:
diff changeset
463 void ArchDesc::buildMatchList(MatchRule *mrule, const char *resultStr,
a61af66fc99e Initial load
duke
parents:
diff changeset
464 const char *rootOp, Predicate *pred,
a61af66fc99e Initial load
duke
parents:
diff changeset
465 const char *cost) {
a61af66fc99e Initial load
duke
parents:
diff changeset
466 const char *leftstr, *rightstr;
a61af66fc99e Initial load
duke
parents:
diff changeset
467 MatchNode *mnode;
a61af66fc99e Initial load
duke
parents:
diff changeset
468
a61af66fc99e Initial load
duke
parents:
diff changeset
469 leftstr = rightstr = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
470 // Check for chain rule, and do not generate a match list for it
a61af66fc99e Initial load
duke
parents:
diff changeset
471 if ( mrule->is_chain_rule(_globalNames) ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
472 return;
a61af66fc99e Initial load
duke
parents:
diff changeset
473 }
a61af66fc99e Initial load
duke
parents:
diff changeset
474
a61af66fc99e Initial load
duke
parents:
diff changeset
475 // Identify index position among ideal operands
a61af66fc99e Initial load
duke
parents:
diff changeset
476 intptr_t index = _last_opcode;
a61af66fc99e Initial load
duke
parents:
diff changeset
477 const char *indexStr = getMatchListIndex(*mrule);
a61af66fc99e Initial load
duke
parents:
diff changeset
478 index = (intptr_t)_idealIndex[indexStr];
a61af66fc99e Initial load
duke
parents:
diff changeset
479 if (index == 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
480 fprintf(stderr, "Ideal node missing: %s\n", indexStr);
a61af66fc99e Initial load
duke
parents:
diff changeset
481 assert(index != 0, "Failed lookup of ideal node\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
482 }
a61af66fc99e Initial load
duke
parents:
diff changeset
483
a61af66fc99e Initial load
duke
parents:
diff changeset
484 // Check that this will be placed appropriately in the DFA
a61af66fc99e Initial load
duke
parents:
diff changeset
485 if (index >= _last_opcode) {
a61af66fc99e Initial load
duke
parents:
diff changeset
486 fprintf(stderr, "Invalid match rule %s <-- ( %s )\n",
a61af66fc99e Initial load
duke
parents:
diff changeset
487 resultStr ? resultStr : " ",
a61af66fc99e Initial load
duke
parents:
diff changeset
488 rootOp ? rootOp : " ");
a61af66fc99e Initial load
duke
parents:
diff changeset
489 assert(index < _last_opcode, "Matching item not in ideal graph\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
490 return;
a61af66fc99e Initial load
duke
parents:
diff changeset
491 }
a61af66fc99e Initial load
duke
parents:
diff changeset
492
a61af66fc99e Initial load
duke
parents:
diff changeset
493
a61af66fc99e Initial load
duke
parents:
diff changeset
494 // Walk the MatchRule, generating MatchList entries for each level
a61af66fc99e Initial load
duke
parents:
diff changeset
495 // of the rule (each nesting of parentheses)
a61af66fc99e Initial load
duke
parents:
diff changeset
496 // Check for "Set"
a61af66fc99e Initial load
duke
parents:
diff changeset
497 if (!strcmp(mrule->_opType, "Set")) {
a61af66fc99e Initial load
duke
parents:
diff changeset
498 mnode = mrule->_rChild;
a61af66fc99e Initial load
duke
parents:
diff changeset
499 buildMList(mnode, rootOp, resultStr, pred, cost);
a61af66fc99e Initial load
duke
parents:
diff changeset
500 return;
a61af66fc99e Initial load
duke
parents:
diff changeset
501 }
a61af66fc99e Initial load
duke
parents:
diff changeset
502 // Build MatchLists for children
a61af66fc99e Initial load
duke
parents:
diff changeset
503 // Check each child for an internal operand name, and use that name
a61af66fc99e Initial load
duke
parents:
diff changeset
504 // for the parent's matchlist entry if it exists
a61af66fc99e Initial load
duke
parents:
diff changeset
505 mnode = mrule->_lChild;
a61af66fc99e Initial load
duke
parents:
diff changeset
506 if (mnode) {
a61af66fc99e Initial load
duke
parents:
diff changeset
507 buildMList(mnode, NULL, NULL, NULL, NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
508 leftstr = mnode->_internalop ? mnode->_internalop : mnode->_opType;
a61af66fc99e Initial load
duke
parents:
diff changeset
509 }
a61af66fc99e Initial load
duke
parents:
diff changeset
510 mnode = mrule->_rChild;
a61af66fc99e Initial load
duke
parents:
diff changeset
511 if (mnode) {
a61af66fc99e Initial load
duke
parents:
diff changeset
512 buildMList(mnode, NULL, NULL, NULL, NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
513 rightstr = mnode->_internalop ? mnode->_internalop : mnode->_opType;
a61af66fc99e Initial load
duke
parents:
diff changeset
514 }
a61af66fc99e Initial load
duke
parents:
diff changeset
515 // Search for an identical matchlist entry already on the list
a61af66fc99e Initial load
duke
parents:
diff changeset
516 if ((_mlistab[index] == NULL) ||
a61af66fc99e Initial load
duke
parents:
diff changeset
517 (_mlistab[index] &&
a61af66fc99e Initial load
duke
parents:
diff changeset
518 !_mlistab[index]->search(rootOp, resultStr, leftstr, rightstr, pred))) {
a61af66fc99e Initial load
duke
parents:
diff changeset
519 // Place this match rule at front of list
a61af66fc99e Initial load
duke
parents:
diff changeset
520 MatchList *mList =
a61af66fc99e Initial load
duke
parents:
diff changeset
521 new MatchList(_mlistab[index], pred, cost,
a61af66fc99e Initial load
duke
parents:
diff changeset
522 rootOp, resultStr, leftstr, rightstr);
a61af66fc99e Initial load
duke
parents:
diff changeset
523 _mlistab[index] = mList;
a61af66fc99e Initial load
duke
parents:
diff changeset
524 }
a61af66fc99e Initial load
duke
parents:
diff changeset
525 }
a61af66fc99e Initial load
duke
parents:
diff changeset
526
a61af66fc99e Initial load
duke
parents:
diff changeset
527 // Recursive call for construction of match lists
a61af66fc99e Initial load
duke
parents:
diff changeset
528 void ArchDesc::buildMList(MatchNode *node, const char *rootOp,
a61af66fc99e Initial load
duke
parents:
diff changeset
529 const char *resultOp, Predicate *pred,
a61af66fc99e Initial load
duke
parents:
diff changeset
530 const char *cost) {
a61af66fc99e Initial load
duke
parents:
diff changeset
531 const char *leftstr, *rightstr;
a61af66fc99e Initial load
duke
parents:
diff changeset
532 const char *resultop;
a61af66fc99e Initial load
duke
parents:
diff changeset
533 const char *opcode;
a61af66fc99e Initial load
duke
parents:
diff changeset
534 MatchNode *mnode;
a61af66fc99e Initial load
duke
parents:
diff changeset
535 Form *form;
a61af66fc99e Initial load
duke
parents:
diff changeset
536
a61af66fc99e Initial load
duke
parents:
diff changeset
537 leftstr = rightstr = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
538 // Do not process leaves of the Match Tree if they are not ideal
a61af66fc99e Initial load
duke
parents:
diff changeset
539 if ((node) && (node->_lChild == NULL) && (node->_rChild == NULL) &&
a61af66fc99e Initial load
duke
parents:
diff changeset
540 ((form = (Form *)_globalNames[node->_opType]) != NULL) &&
a61af66fc99e Initial load
duke
parents:
diff changeset
541 (!form->ideal_only())) {
a61af66fc99e Initial load
duke
parents:
diff changeset
542 return;
a61af66fc99e Initial load
duke
parents:
diff changeset
543 }
a61af66fc99e Initial load
duke
parents:
diff changeset
544
a61af66fc99e Initial load
duke
parents:
diff changeset
545 // Identify index position among ideal operands
a61af66fc99e Initial load
duke
parents:
diff changeset
546 intptr_t index = _last_opcode;
a61af66fc99e Initial load
duke
parents:
diff changeset
547 const char *indexStr = node ? node->_opType : (char *) " ";
a61af66fc99e Initial load
duke
parents:
diff changeset
548 index = (intptr_t)_idealIndex[indexStr];
a61af66fc99e Initial load
duke
parents:
diff changeset
549 if (index == 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
550 fprintf(stderr, "error: operand \"%s\" not found\n", indexStr);
a61af66fc99e Initial load
duke
parents:
diff changeset
551 assert(0, "fatal error");
a61af66fc99e Initial load
duke
parents:
diff changeset
552 }
a61af66fc99e Initial load
duke
parents:
diff changeset
553
a61af66fc99e Initial load
duke
parents:
diff changeset
554 // Build MatchLists for children
a61af66fc99e Initial load
duke
parents:
diff changeset
555 // Check each child for an internal operand name, and use that name
a61af66fc99e Initial load
duke
parents:
diff changeset
556 // for the parent's matchlist entry if it exists
a61af66fc99e Initial load
duke
parents:
diff changeset
557 mnode = node->_lChild;
a61af66fc99e Initial load
duke
parents:
diff changeset
558 if (mnode) {
a61af66fc99e Initial load
duke
parents:
diff changeset
559 buildMList(mnode, NULL, NULL, NULL, NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
560 leftstr = mnode->_internalop ? mnode->_internalop : mnode->_opType;
a61af66fc99e Initial load
duke
parents:
diff changeset
561 }
a61af66fc99e Initial load
duke
parents:
diff changeset
562 mnode = node->_rChild;
a61af66fc99e Initial load
duke
parents:
diff changeset
563 if (mnode) {
a61af66fc99e Initial load
duke
parents:
diff changeset
564 buildMList(mnode, NULL, NULL, NULL, NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
565 rightstr = mnode->_internalop ? mnode->_internalop : mnode->_opType;
a61af66fc99e Initial load
duke
parents:
diff changeset
566 }
a61af66fc99e Initial load
duke
parents:
diff changeset
567 // Grab the string for the opcode of this list entry
a61af66fc99e Initial load
duke
parents:
diff changeset
568 if (rootOp == NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
569 opcode = (node->_internalop) ? node->_internalop : node->_opType;
a61af66fc99e Initial load
duke
parents:
diff changeset
570 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
571 opcode = rootOp;
a61af66fc99e Initial load
duke
parents:
diff changeset
572 }
a61af66fc99e Initial load
duke
parents:
diff changeset
573 // Grab the string for the result of this list entry
a61af66fc99e Initial load
duke
parents:
diff changeset
574 if (resultOp == NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
575 resultop = (node->_internalop) ? node->_internalop : node->_opType;
a61af66fc99e Initial load
duke
parents:
diff changeset
576 }
a61af66fc99e Initial load
duke
parents:
diff changeset
577 else resultop = resultOp;
a61af66fc99e Initial load
duke
parents:
diff changeset
578 // Search for an identical matchlist entry already on the list
a61af66fc99e Initial load
duke
parents:
diff changeset
579 if ((_mlistab[index] == NULL) || (_mlistab[index] &&
a61af66fc99e Initial load
duke
parents:
diff changeset
580 !_mlistab[index]->search(opcode, resultop, leftstr, rightstr, pred))) {
a61af66fc99e Initial load
duke
parents:
diff changeset
581 // Place this match rule at front of list
a61af66fc99e Initial load
duke
parents:
diff changeset
582 MatchList *mList =
a61af66fc99e Initial load
duke
parents:
diff changeset
583 new MatchList(_mlistab[index],pred,cost,
a61af66fc99e Initial load
duke
parents:
diff changeset
584 opcode, resultop, leftstr, rightstr);
a61af66fc99e Initial load
duke
parents:
diff changeset
585 _mlistab[index] = mList;
a61af66fc99e Initial load
duke
parents:
diff changeset
586 }
a61af66fc99e Initial load
duke
parents:
diff changeset
587 }
a61af66fc99e Initial load
duke
parents:
diff changeset
588
a61af66fc99e Initial load
duke
parents:
diff changeset
589 // Count number of OperandForms defined
a61af66fc99e Initial load
duke
parents:
diff changeset
590 int ArchDesc::operandFormCount() {
a61af66fc99e Initial load
duke
parents:
diff changeset
591 // Only interested in ones with non-NULL match rule
a61af66fc99e Initial load
duke
parents:
diff changeset
592 int count = 0; _operands.reset();
a61af66fc99e Initial load
duke
parents:
diff changeset
593 OperandForm *cur;
a61af66fc99e Initial load
duke
parents:
diff changeset
594 for( ; (cur = (OperandForm*)_operands.iter()) != NULL; ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
595 if (cur->_matrule != NULL) ++count;
a61af66fc99e Initial load
duke
parents:
diff changeset
596 };
a61af66fc99e Initial load
duke
parents:
diff changeset
597 return count;
a61af66fc99e Initial load
duke
parents:
diff changeset
598 }
a61af66fc99e Initial load
duke
parents:
diff changeset
599
a61af66fc99e Initial load
duke
parents:
diff changeset
600 // Count number of OpClassForms defined
a61af66fc99e Initial load
duke
parents:
diff changeset
601 int ArchDesc::opclassFormCount() {
a61af66fc99e Initial load
duke
parents:
diff changeset
602 // Only interested in ones with non-NULL match rule
a61af66fc99e Initial load
duke
parents:
diff changeset
603 int count = 0; _operands.reset();
a61af66fc99e Initial load
duke
parents:
diff changeset
604 OpClassForm *cur;
a61af66fc99e Initial load
duke
parents:
diff changeset
605 for( ; (cur = (OpClassForm*)_opclass.iter()) != NULL; ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
606 ++count;
a61af66fc99e Initial load
duke
parents:
diff changeset
607 };
a61af66fc99e Initial load
duke
parents:
diff changeset
608 return count;
a61af66fc99e Initial load
duke
parents:
diff changeset
609 }
a61af66fc99e Initial load
duke
parents:
diff changeset
610
a61af66fc99e Initial load
duke
parents:
diff changeset
611 // Count number of InstructForms defined
a61af66fc99e Initial load
duke
parents:
diff changeset
612 int ArchDesc::instructFormCount() {
a61af66fc99e Initial load
duke
parents:
diff changeset
613 // Only interested in ones with non-NULL match rule
a61af66fc99e Initial load
duke
parents:
diff changeset
614 int count = 0; _instructions.reset();
a61af66fc99e Initial load
duke
parents:
diff changeset
615 InstructForm *cur;
a61af66fc99e Initial load
duke
parents:
diff changeset
616 for( ; (cur = (InstructForm*)_instructions.iter()) != NULL; ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
617 if (cur->_matrule != NULL) ++count;
a61af66fc99e Initial load
duke
parents:
diff changeset
618 };
a61af66fc99e Initial load
duke
parents:
diff changeset
619 return count;
a61af66fc99e Initial load
duke
parents:
diff changeset
620 }
a61af66fc99e Initial load
duke
parents:
diff changeset
621
a61af66fc99e Initial load
duke
parents:
diff changeset
622
a61af66fc99e Initial load
duke
parents:
diff changeset
623 //------------------------------get_preproc_def--------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
624 // Return the textual binding for a given CPP flag name.
a61af66fc99e Initial load
duke
parents:
diff changeset
625 // Return NULL if there is no binding, or it has been #undef-ed.
a61af66fc99e Initial load
duke
parents:
diff changeset
626 char* ArchDesc::get_preproc_def(const char* flag) {
6850
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
627 // In case of syntax errors, flag may take the value NULL.
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
628 SourceForm* deff = NULL;
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
629 if (flag != NULL)
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
630 deff = (SourceForm*) _preproc_table[flag];
0
a61af66fc99e Initial load
duke
parents:
diff changeset
631 return (deff == NULL) ? NULL : deff->_code;
a61af66fc99e Initial load
duke
parents:
diff changeset
632 }
a61af66fc99e Initial load
duke
parents:
diff changeset
633
a61af66fc99e Initial load
duke
parents:
diff changeset
634
a61af66fc99e Initial load
duke
parents:
diff changeset
635 //------------------------------set_preproc_def--------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
636 // Change or create a textual binding for a given CPP flag name.
a61af66fc99e Initial load
duke
parents:
diff changeset
637 // Giving NULL means the flag name is to be #undef-ed.
a61af66fc99e Initial load
duke
parents:
diff changeset
638 // In any case, _preproc_list collects all names either #defined or #undef-ed.
a61af66fc99e Initial load
duke
parents:
diff changeset
639 void ArchDesc::set_preproc_def(const char* flag, const char* def) {
a61af66fc99e Initial load
duke
parents:
diff changeset
640 SourceForm* deff = (SourceForm*) _preproc_table[flag];
a61af66fc99e Initial load
duke
parents:
diff changeset
641 if (deff == NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
642 deff = new SourceForm(NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
643 _preproc_table.Insert(flag, deff);
a61af66fc99e Initial load
duke
parents:
diff changeset
644 _preproc_list.addName(flag); // this supports iteration
a61af66fc99e Initial load
duke
parents:
diff changeset
645 }
a61af66fc99e Initial load
duke
parents:
diff changeset
646 deff->_code = (char*) def;
a61af66fc99e Initial load
duke
parents:
diff changeset
647 }
a61af66fc99e Initial load
duke
parents:
diff changeset
648
a61af66fc99e Initial load
duke
parents:
diff changeset
649
a61af66fc99e Initial load
duke
parents:
diff changeset
650 bool ArchDesc::verify() {
a61af66fc99e Initial load
duke
parents:
diff changeset
651
a61af66fc99e Initial load
duke
parents:
diff changeset
652 if (_register)
a61af66fc99e Initial load
duke
parents:
diff changeset
653 assert( _register->verify(), "Register declarations failed verification");
a61af66fc99e Initial load
duke
parents:
diff changeset
654 if (!_quiet_mode)
a61af66fc99e Initial load
duke
parents:
diff changeset
655 fprintf(stderr,"\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
656 // fprintf(stderr,"---------------------------- Verify Operands ---------------\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
657 // _operands.verify();
a61af66fc99e Initial load
duke
parents:
diff changeset
658 // fprintf(stderr,"\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
659 // fprintf(stderr,"---------------------------- Verify Operand Classes --------\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
660 // _opclass.verify();
a61af66fc99e Initial load
duke
parents:
diff changeset
661 // fprintf(stderr,"\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
662 // fprintf(stderr,"---------------------------- Verify Attributes ------------\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
663 // _attributes.verify();
a61af66fc99e Initial load
duke
parents:
diff changeset
664 // fprintf(stderr,"\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
665 if (!_quiet_mode)
a61af66fc99e Initial load
duke
parents:
diff changeset
666 fprintf(stderr,"---------------------------- Verify Instructions ----------------------------\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
667 _instructions.verify();
a61af66fc99e Initial load
duke
parents:
diff changeset
668 if (!_quiet_mode)
a61af66fc99e Initial load
duke
parents:
diff changeset
669 fprintf(stderr,"\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
670 // if ( _encode ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
671 // fprintf(stderr,"---------------------------- Verify Encodings --------------\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
672 // _encode->verify();
a61af66fc99e Initial load
duke
parents:
diff changeset
673 // }
a61af66fc99e Initial load
duke
parents:
diff changeset
674
a61af66fc99e Initial load
duke
parents:
diff changeset
675 //if (_pipeline) _pipeline->verify();
a61af66fc99e Initial load
duke
parents:
diff changeset
676
a61af66fc99e Initial load
duke
parents:
diff changeset
677 return true;
a61af66fc99e Initial load
duke
parents:
diff changeset
678 }
a61af66fc99e Initial load
duke
parents:
diff changeset
679
a61af66fc99e Initial load
duke
parents:
diff changeset
680
a61af66fc99e Initial load
duke
parents:
diff changeset
681 void ArchDesc::dump() {
a61af66fc99e Initial load
duke
parents:
diff changeset
682 _pre_header.dump();
a61af66fc99e Initial load
duke
parents:
diff changeset
683 _header.dump();
a61af66fc99e Initial load
duke
parents:
diff changeset
684 _source.dump();
a61af66fc99e Initial load
duke
parents:
diff changeset
685 if (_register) _register->dump();
a61af66fc99e Initial load
duke
parents:
diff changeset
686 fprintf(stderr,"\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
687 fprintf(stderr,"------------------ Dump Operands ---------------------\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
688 _operands.dump();
a61af66fc99e Initial load
duke
parents:
diff changeset
689 fprintf(stderr,"\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
690 fprintf(stderr,"------------------ Dump Operand Classes --------------\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
691 _opclass.dump();
a61af66fc99e Initial load
duke
parents:
diff changeset
692 fprintf(stderr,"\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
693 fprintf(stderr,"------------------ Dump Attributes ------------------\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
694 _attributes.dump();
a61af66fc99e Initial load
duke
parents:
diff changeset
695 fprintf(stderr,"\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
696 fprintf(stderr,"------------------ Dump Instructions -----------------\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
697 _instructions.dump();
a61af66fc99e Initial load
duke
parents:
diff changeset
698 if ( _encode ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
699 fprintf(stderr,"------------------ Dump Encodings --------------------\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
700 _encode->dump();
a61af66fc99e Initial load
duke
parents:
diff changeset
701 }
a61af66fc99e Initial load
duke
parents:
diff changeset
702 if (_pipeline) _pipeline->dump();
a61af66fc99e Initial load
duke
parents:
diff changeset
703 }
a61af66fc99e Initial load
duke
parents:
diff changeset
704
a61af66fc99e Initial load
duke
parents:
diff changeset
705
a61af66fc99e Initial load
duke
parents:
diff changeset
706 //------------------------------init_keywords----------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
707 // Load the kewords into the global name table
a61af66fc99e Initial load
duke
parents:
diff changeset
708 void ArchDesc::initKeywords(FormDict& names) {
a61af66fc99e Initial load
duke
parents:
diff changeset
709 // Insert keyword strings into Global Name Table. Keywords have a NULL value
a61af66fc99e Initial load
duke
parents:
diff changeset
710 // field for quick easy identification when checking identifiers.
a61af66fc99e Initial load
duke
parents:
diff changeset
711 names.Insert("instruct", NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
712 names.Insert("operand", NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
713 names.Insert("attribute", NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
714 names.Insert("source", NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
715 names.Insert("register", NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
716 names.Insert("pipeline", NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
717 names.Insert("constraint", NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
718 names.Insert("predicate", NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
719 names.Insert("encode", NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
720 names.Insert("enc_class", NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
721 names.Insert("interface", NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
722 names.Insert("opcode", NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
723 names.Insert("ins_encode", NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
724 names.Insert("match", NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
725 names.Insert("effect", NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
726 names.Insert("expand", NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
727 names.Insert("rewrite", NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
728 names.Insert("reg_def", NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
729 names.Insert("reg_class", NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
730 names.Insert("alloc_class", NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
731 names.Insert("resource", NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
732 names.Insert("pipe_class", NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
733 names.Insert("pipe_desc", NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
734 }
a61af66fc99e Initial load
duke
parents:
diff changeset
735
a61af66fc99e Initial load
duke
parents:
diff changeset
736
a61af66fc99e Initial load
duke
parents:
diff changeset
737 //------------------------------internal_err----------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
738 // Issue a parser error message, and skip to the end of the current line
a61af66fc99e Initial load
duke
parents:
diff changeset
739 void ArchDesc::internal_err(const char *fmt, ...) {
a61af66fc99e Initial load
duke
parents:
diff changeset
740 va_list args;
a61af66fc99e Initial load
duke
parents:
diff changeset
741
a61af66fc99e Initial load
duke
parents:
diff changeset
742 va_start(args, fmt);
a61af66fc99e Initial load
duke
parents:
diff changeset
743 _internal_errs += emit_msg(0, INTERNAL_ERR, 0, fmt, args);
a61af66fc99e Initial load
duke
parents:
diff changeset
744 va_end(args);
a61af66fc99e Initial load
duke
parents:
diff changeset
745
a61af66fc99e Initial load
duke
parents:
diff changeset
746 _no_output = 1;
a61af66fc99e Initial load
duke
parents:
diff changeset
747 }
a61af66fc99e Initial load
duke
parents:
diff changeset
748
a61af66fc99e Initial load
duke
parents:
diff changeset
749 //------------------------------syntax_err----------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
750 // Issue a parser error message, and skip to the end of the current line
a61af66fc99e Initial load
duke
parents:
diff changeset
751 void ArchDesc::syntax_err(int lineno, const char *fmt, ...) {
a61af66fc99e Initial load
duke
parents:
diff changeset
752 va_list args;
a61af66fc99e Initial load
duke
parents:
diff changeset
753
a61af66fc99e Initial load
duke
parents:
diff changeset
754 va_start(args, fmt);
a61af66fc99e Initial load
duke
parents:
diff changeset
755 _internal_errs += emit_msg(0, SYNERR, lineno, fmt, args);
a61af66fc99e Initial load
duke
parents:
diff changeset
756 va_end(args);
a61af66fc99e Initial load
duke
parents:
diff changeset
757
a61af66fc99e Initial load
duke
parents:
diff changeset
758 _no_output = 1;
a61af66fc99e Initial load
duke
parents:
diff changeset
759 }
a61af66fc99e Initial load
duke
parents:
diff changeset
760
a61af66fc99e Initial load
duke
parents:
diff changeset
761 //------------------------------emit_msg---------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
762 // Emit a user message, typically a warning or error
a61af66fc99e Initial load
duke
parents:
diff changeset
763 int ArchDesc::emit_msg(int quiet, int flag, int line, const char *fmt,
a61af66fc99e Initial load
duke
parents:
diff changeset
764 va_list args) {
a61af66fc99e Initial load
duke
parents:
diff changeset
765 static int last_lineno = -1;
a61af66fc99e Initial load
duke
parents:
diff changeset
766 int i;
a61af66fc99e Initial load
duke
parents:
diff changeset
767 const char *pref;
a61af66fc99e Initial load
duke
parents:
diff changeset
768
a61af66fc99e Initial load
duke
parents:
diff changeset
769 switch(flag) {
a61af66fc99e Initial load
duke
parents:
diff changeset
770 case 0: pref = "Warning: "; break;
a61af66fc99e Initial load
duke
parents:
diff changeset
771 case 1: pref = "Syntax Error: "; break;
a61af66fc99e Initial load
duke
parents:
diff changeset
772 case 2: pref = "Semantic Error: "; break;
a61af66fc99e Initial load
duke
parents:
diff changeset
773 case 3: pref = "Internal Error: "; break;
a61af66fc99e Initial load
duke
parents:
diff changeset
774 default: assert(0, ""); break;
a61af66fc99e Initial load
duke
parents:
diff changeset
775 }
a61af66fc99e Initial load
duke
parents:
diff changeset
776
a61af66fc99e Initial load
duke
parents:
diff changeset
777 if (line == last_lineno) return 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
778 last_lineno = line;
a61af66fc99e Initial load
duke
parents:
diff changeset
779
a61af66fc99e Initial load
duke
parents:
diff changeset
780 if (!quiet) { /* no output if in quiet mode */
a61af66fc99e Initial load
duke
parents:
diff changeset
781 i = fprintf(errfile, "%s(%d) ", _ADL_file._name, line);
a61af66fc99e Initial load
duke
parents:
diff changeset
782 while (i++ <= 15) fputc(' ', errfile);
a61af66fc99e Initial load
duke
parents:
diff changeset
783 fprintf(errfile, "%-8s:", pref);
a61af66fc99e Initial load
duke
parents:
diff changeset
784 vfprintf(errfile, fmt, args);
6850
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
785 fprintf(errfile, "\n");
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
786 fflush(errfile);
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
787 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
788 return 1;
a61af66fc99e Initial load
duke
parents:
diff changeset
789 }
a61af66fc99e Initial load
duke
parents:
diff changeset
790
a61af66fc99e Initial load
duke
parents:
diff changeset
791
a61af66fc99e Initial load
duke
parents:
diff changeset
792 // ---------------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
793 //--------Utilities to build mappings for machine registers ------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
794 // ---------------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
795
a61af66fc99e Initial load
duke
parents:
diff changeset
796 // Construct the name of the register mask.
a61af66fc99e Initial load
duke
parents:
diff changeset
797 static const char *getRegMask(const char *reg_class_name) {
a61af66fc99e Initial load
duke
parents:
diff changeset
798 if( reg_class_name == NULL ) return "RegMask::Empty";
a61af66fc99e Initial load
duke
parents:
diff changeset
799
a61af66fc99e Initial load
duke
parents:
diff changeset
800 if (strcmp(reg_class_name,"Universe")==0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
801 return "RegMask::Empty";
a61af66fc99e Initial load
duke
parents:
diff changeset
802 } else if (strcmp(reg_class_name,"stack_slots")==0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
803 return "(Compile::current()->FIRST_STACK_mask())";
a61af66fc99e Initial load
duke
parents:
diff changeset
804 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
805 char *rc_name = toUpper(reg_class_name);
a61af66fc99e Initial load
duke
parents:
diff changeset
806 const char *mask = "_mask";
4121
db2e64ca2d5a 7090968: Allow adlc register class to depend on runtime conditions
roland
parents: 4120
diff changeset
807 int length = (int)strlen(rc_name) + (int)strlen(mask) + 5;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
808 char *regMask = new char[length];
4121
db2e64ca2d5a 7090968: Allow adlc register class to depend on runtime conditions
roland
parents: 4120
diff changeset
809 sprintf(regMask,"%s%s()", rc_name, mask);
8875
70c52efb2cbd 8006008: Memory leak in hotspot/src/share/vm/adlc/archDesc.cpp
neliasso
parents: 6850
diff changeset
810 delete[] rc_name;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
811 return regMask;
a61af66fc99e Initial load
duke
parents:
diff changeset
812 }
a61af66fc99e Initial load
duke
parents:
diff changeset
813 }
a61af66fc99e Initial load
duke
parents:
diff changeset
814
a61af66fc99e Initial load
duke
parents:
diff changeset
815 // Convert a register class name to its register mask.
a61af66fc99e Initial load
duke
parents:
diff changeset
816 const char *ArchDesc::reg_class_to_reg_mask(const char *rc_name) {
a61af66fc99e Initial load
duke
parents:
diff changeset
817 const char *reg_mask = "RegMask::Empty";
a61af66fc99e Initial load
duke
parents:
diff changeset
818
a61af66fc99e Initial load
duke
parents:
diff changeset
819 if( _register ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
820 RegClass *reg_class = _register->getRegClass(rc_name);
a61af66fc99e Initial load
duke
parents:
diff changeset
821 if (reg_class == NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
822 syntax_err(0, "Use of an undefined register class %s", rc_name);
a61af66fc99e Initial load
duke
parents:
diff changeset
823 return reg_mask;
a61af66fc99e Initial load
duke
parents:
diff changeset
824 }
a61af66fc99e Initial load
duke
parents:
diff changeset
825
a61af66fc99e Initial load
duke
parents:
diff changeset
826 // Construct the name of the register mask.
a61af66fc99e Initial load
duke
parents:
diff changeset
827 reg_mask = getRegMask(rc_name);
a61af66fc99e Initial load
duke
parents:
diff changeset
828 }
a61af66fc99e Initial load
duke
parents:
diff changeset
829
a61af66fc99e Initial load
duke
parents:
diff changeset
830 return reg_mask;
a61af66fc99e Initial load
duke
parents:
diff changeset
831 }
a61af66fc99e Initial load
duke
parents:
diff changeset
832
a61af66fc99e Initial load
duke
parents:
diff changeset
833
a61af66fc99e Initial load
duke
parents:
diff changeset
834 // Obtain the name of the RegMask for an OperandForm
a61af66fc99e Initial load
duke
parents:
diff changeset
835 const char *ArchDesc::reg_mask(OperandForm &opForm) {
a61af66fc99e Initial load
duke
parents:
diff changeset
836 const char *regMask = "RegMask::Empty";
a61af66fc99e Initial load
duke
parents:
diff changeset
837
a61af66fc99e Initial load
duke
parents:
diff changeset
838 // Check constraints on result's register class
a61af66fc99e Initial load
duke
parents:
diff changeset
839 const char *result_class = opForm.constrained_reg_class();
6850
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
840 if (result_class == NULL) {
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
841 opForm.dump();
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
842 syntax_err(opForm._linenum,
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
843 "Use of an undefined result class for operand: %s",
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
844 opForm._ident);
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
845 abort();
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
846 }
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
847
0
a61af66fc99e Initial load
duke
parents:
diff changeset
848 regMask = reg_class_to_reg_mask( result_class );
a61af66fc99e Initial load
duke
parents:
diff changeset
849
a61af66fc99e Initial load
duke
parents:
diff changeset
850 return regMask;
a61af66fc99e Initial load
duke
parents:
diff changeset
851 }
a61af66fc99e Initial load
duke
parents:
diff changeset
852
a61af66fc99e Initial load
duke
parents:
diff changeset
853 // Obtain the name of the RegMask for an InstructForm
a61af66fc99e Initial load
duke
parents:
diff changeset
854 const char *ArchDesc::reg_mask(InstructForm &inForm) {
a61af66fc99e Initial load
duke
parents:
diff changeset
855 const char *result = inForm.reduce_result();
6850
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
856
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
857 if (result == NULL) {
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
858 syntax_err(inForm._linenum,
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
859 "Did not find result operand or RegMask"
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
860 " for this instruction: %s",
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
861 inForm._ident);
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
862 abort();
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
863 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
864
a61af66fc99e Initial load
duke
parents:
diff changeset
865 // Instructions producing 'Universe' use RegMask::Empty
a61af66fc99e Initial load
duke
parents:
diff changeset
866 if( strcmp(result,"Universe")==0 ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
867 return "RegMask::Empty";
a61af66fc99e Initial load
duke
parents:
diff changeset
868 }
a61af66fc99e Initial load
duke
parents:
diff changeset
869
a61af66fc99e Initial load
duke
parents:
diff changeset
870 // Lookup this result operand and get its register class
a61af66fc99e Initial load
duke
parents:
diff changeset
871 Form *form = (Form*)_globalNames[result];
6850
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
872 if (form == NULL) {
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
873 syntax_err(inForm._linenum,
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
874 "Did not find result operand for result: %s", result);
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
875 abort();
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
876 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
877 OperandForm *oper = form->is_operand();
6850
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
878 if (oper == NULL) {
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
879 syntax_err(inForm._linenum, "Form is not an OperandForm:");
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
880 form->dump();
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
881 abort();
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
882 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
883 return reg_mask( *oper );
a61af66fc99e Initial load
duke
parents:
diff changeset
884 }
a61af66fc99e Initial load
duke
parents:
diff changeset
885
a61af66fc99e Initial load
duke
parents:
diff changeset
886
a61af66fc99e Initial load
duke
parents:
diff changeset
887 // Obtain the STACK_OR_reg_mask name for an OperandForm
a61af66fc99e Initial load
duke
parents:
diff changeset
888 char *ArchDesc::stack_or_reg_mask(OperandForm &opForm) {
a61af66fc99e Initial load
duke
parents:
diff changeset
889 // name of cisc_spillable version
a61af66fc99e Initial load
duke
parents:
diff changeset
890 const char *reg_mask_name = reg_mask(opForm);
6850
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
891
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
892 if (reg_mask_name == NULL) {
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
893 syntax_err(opForm._linenum,
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
894 "Did not find reg_mask for opForm: %s",
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
895 opForm._ident);
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
896 abort();
d336b3173277 8000592: Improve adlc usability
kvn
parents: 6848
diff changeset
897 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
898
a61af66fc99e Initial load
duke
parents:
diff changeset
899 const char *stack_or = "STACK_OR_";
a61af66fc99e Initial load
duke
parents:
diff changeset
900 int length = (int)strlen(stack_or) + (int)strlen(reg_mask_name) + 1;
a61af66fc99e Initial load
duke
parents:
diff changeset
901 char *result = new char[length];
a61af66fc99e Initial load
duke
parents:
diff changeset
902 sprintf(result,"%s%s", stack_or, reg_mask_name);
a61af66fc99e Initial load
duke
parents:
diff changeset
903
a61af66fc99e Initial load
duke
parents:
diff changeset
904 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
905 }
a61af66fc99e Initial load
duke
parents:
diff changeset
906
a61af66fc99e Initial load
duke
parents:
diff changeset
907 // Record that the register class must generate a stack_or_reg_mask
a61af66fc99e Initial load
duke
parents:
diff changeset
908 void ArchDesc::set_stack_or_reg(const char *reg_class_name) {
a61af66fc99e Initial load
duke
parents:
diff changeset
909 if( _register ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
910 RegClass *reg_class = _register->getRegClass(reg_class_name);
a61af66fc99e Initial load
duke
parents:
diff changeset
911 reg_class->_stack_or_reg = true;
a61af66fc99e Initial load
duke
parents:
diff changeset
912 }
a61af66fc99e Initial load
duke
parents:
diff changeset
913 }
a61af66fc99e Initial load
duke
parents:
diff changeset
914
a61af66fc99e Initial load
duke
parents:
diff changeset
915
a61af66fc99e Initial load
duke
parents:
diff changeset
916 // Return the type signature for the ideal operation
a61af66fc99e Initial load
duke
parents:
diff changeset
917 const char *ArchDesc::getIdealType(const char *idealOp) {
a61af66fc99e Initial load
duke
parents:
diff changeset
918 // Find last character in idealOp, it specifies the type
a61af66fc99e Initial load
duke
parents:
diff changeset
919 char last_char = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
920 const char *ptr = idealOp;
6179
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 4121
diff changeset
921 for (; *ptr != '\0'; ++ptr) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
922 last_char = *ptr;
a61af66fc99e Initial load
duke
parents:
diff changeset
923 }
a61af66fc99e Initial load
duke
parents:
diff changeset
924
6179
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 4121
diff changeset
925 // Match Vector types.
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 4121
diff changeset
926 if (strncmp(idealOp, "Vec",3)==0) {
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 4121
diff changeset
927 switch(last_char) {
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 4121
diff changeset
928 case 'S': return "TypeVect::VECTS";
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 4121
diff changeset
929 case 'D': return "TypeVect::VECTD";
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 4121
diff changeset
930 case 'X': return "TypeVect::VECTX";
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 4121
diff changeset
931 case 'Y': return "TypeVect::VECTY";
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 4121
diff changeset
932 default:
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 4121
diff changeset
933 internal_err("Vector type %s with unrecognized type\n",idealOp);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 4121
diff changeset
934 }
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 4121
diff changeset
935 }
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 4121
diff changeset
936
0
a61af66fc99e Initial load
duke
parents:
diff changeset
937 // !!!!!
6179
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 4121
diff changeset
938 switch(last_char) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
939 case 'I': return "TypeInt::INT";
a61af66fc99e Initial load
duke
parents:
diff changeset
940 case 'P': return "TypePtr::BOTTOM";
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
941 case 'N': return "TypeNarrowOop::BOTTOM";
0
a61af66fc99e Initial load
duke
parents:
diff changeset
942 case 'F': return "Type::FLOAT";
a61af66fc99e Initial load
duke
parents:
diff changeset
943 case 'D': return "Type::DOUBLE";
a61af66fc99e Initial load
duke
parents:
diff changeset
944 case 'L': return "TypeLong::LONG";
a61af66fc99e Initial load
duke
parents:
diff changeset
945 case 's': return "TypeInt::CC /*flags*/";
a61af66fc99e Initial load
duke
parents:
diff changeset
946 default:
a61af66fc99e Initial load
duke
parents:
diff changeset
947 return NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
948 // !!!!!
a61af66fc99e Initial load
duke
parents:
diff changeset
949 // internal_err("Ideal type %s with unrecognized type\n",idealOp);
a61af66fc99e Initial load
duke
parents:
diff changeset
950 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
951 }
a61af66fc99e Initial load
duke
parents:
diff changeset
952
a61af66fc99e Initial load
duke
parents:
diff changeset
953 return NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
954 }
a61af66fc99e Initial load
duke
parents:
diff changeset
955
a61af66fc99e Initial load
duke
parents:
diff changeset
956
a61af66fc99e Initial load
duke
parents:
diff changeset
957
a61af66fc99e Initial load
duke
parents:
diff changeset
958 OperandForm *ArchDesc::constructOperand(const char *ident,
a61af66fc99e Initial load
duke
parents:
diff changeset
959 bool ideal_only) {
a61af66fc99e Initial load
duke
parents:
diff changeset
960 OperandForm *opForm = new OperandForm(ident, ideal_only);
a61af66fc99e Initial load
duke
parents:
diff changeset
961 _globalNames.Insert(ident, opForm);
a61af66fc99e Initial load
duke
parents:
diff changeset
962 addForm(opForm);
a61af66fc99e Initial load
duke
parents:
diff changeset
963
a61af66fc99e Initial load
duke
parents:
diff changeset
964 return opForm;
a61af66fc99e Initial load
duke
parents:
diff changeset
965 }
a61af66fc99e Initial load
duke
parents:
diff changeset
966
a61af66fc99e Initial load
duke
parents:
diff changeset
967
a61af66fc99e Initial load
duke
parents:
diff changeset
968 // Import predefined base types: Set = 1, RegI, RegP, ...
a61af66fc99e Initial load
duke
parents:
diff changeset
969 void ArchDesc::initBaseOpTypes() {
a61af66fc99e Initial load
duke
parents:
diff changeset
970 // Create OperandForm and assign type for each opcode.
a61af66fc99e Initial load
duke
parents:
diff changeset
971 for (int i = 1; i < _last_machine_leaf; ++i) {
a61af66fc99e Initial load
duke
parents:
diff changeset
972 char *ident = (char *)NodeClassNames[i];
a61af66fc99e Initial load
duke
parents:
diff changeset
973 constructOperand(ident, true);
a61af66fc99e Initial load
duke
parents:
diff changeset
974 }
a61af66fc99e Initial load
duke
parents:
diff changeset
975 // Create InstructForm and assign type for each ideal instruction.
a61af66fc99e Initial load
duke
parents:
diff changeset
976 for ( int j = _last_machine_leaf+1; j < _last_opcode; ++j) {
a61af66fc99e Initial load
duke
parents:
diff changeset
977 char *ident = (char *)NodeClassNames[j];
6848
8e47bac5643a 7054512: Compress class pointers after perm gen removal
roland
parents: 6179
diff changeset
978 if(!strcmp(ident, "ConI") || !strcmp(ident, "ConP") ||
8e47bac5643a 7054512: Compress class pointers after perm gen removal
roland
parents: 6179
diff changeset
979 !strcmp(ident, "ConN") || !strcmp(ident, "ConNKlass") ||
0
a61af66fc99e Initial load
duke
parents:
diff changeset
980 !strcmp(ident, "ConF") || !strcmp(ident, "ConD") ||
a61af66fc99e Initial load
duke
parents:
diff changeset
981 !strcmp(ident, "ConL") || !strcmp(ident, "Con" ) ||
a61af66fc99e Initial load
duke
parents:
diff changeset
982 !strcmp(ident, "Bool") ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
983 constructOperand(ident, true);
a61af66fc99e Initial load
duke
parents:
diff changeset
984 }
a61af66fc99e Initial load
duke
parents:
diff changeset
985 else {
a61af66fc99e Initial load
duke
parents:
diff changeset
986 InstructForm *insForm = new InstructForm(ident, true);
a61af66fc99e Initial load
duke
parents:
diff changeset
987 // insForm->_opcode = nextUserOpType(ident);
a61af66fc99e Initial load
duke
parents:
diff changeset
988 _globalNames.Insert(ident,insForm);
a61af66fc99e Initial load
duke
parents:
diff changeset
989 addForm(insForm);
a61af66fc99e Initial load
duke
parents:
diff changeset
990 }
a61af66fc99e Initial load
duke
parents:
diff changeset
991 }
a61af66fc99e Initial load
duke
parents:
diff changeset
992
a61af66fc99e Initial load
duke
parents:
diff changeset
993 { OperandForm *opForm;
a61af66fc99e Initial load
duke
parents:
diff changeset
994 // Create operand type "Universe" for return instructions.
a61af66fc99e Initial load
duke
parents:
diff changeset
995 const char *ident = "Universe";
a61af66fc99e Initial load
duke
parents:
diff changeset
996 opForm = constructOperand(ident, false);
a61af66fc99e Initial load
duke
parents:
diff changeset
997
a61af66fc99e Initial load
duke
parents:
diff changeset
998 // Create operand type "label" for branch targets
a61af66fc99e Initial load
duke
parents:
diff changeset
999 ident = "label";
a61af66fc99e Initial load
duke
parents:
diff changeset
1000 opForm = constructOperand(ident, false);
a61af66fc99e Initial load
duke
parents:
diff changeset
1001
a61af66fc99e Initial load
duke
parents:
diff changeset
1002 // !!!!! Update - when adding a new sReg/stackSlot type
a61af66fc99e Initial load
duke
parents:
diff changeset
1003 // Create operand types "sReg[IPFDL]" for stack slot registers
a61af66fc99e Initial load
duke
parents:
diff changeset
1004 opForm = constructOperand("sRegI", false);
a61af66fc99e Initial load
duke
parents:
diff changeset
1005 opForm->_constraint = new Constraint("ALLOC_IN_RC", "stack_slots");
a61af66fc99e Initial load
duke
parents:
diff changeset
1006 opForm = constructOperand("sRegP", false);
a61af66fc99e Initial load
duke
parents:
diff changeset
1007 opForm->_constraint = new Constraint("ALLOC_IN_RC", "stack_slots");
a61af66fc99e Initial load
duke
parents:
diff changeset
1008 opForm = constructOperand("sRegF", false);
a61af66fc99e Initial load
duke
parents:
diff changeset
1009 opForm->_constraint = new Constraint("ALLOC_IN_RC", "stack_slots");
a61af66fc99e Initial load
duke
parents:
diff changeset
1010 opForm = constructOperand("sRegD", false);
a61af66fc99e Initial load
duke
parents:
diff changeset
1011 opForm->_constraint = new Constraint("ALLOC_IN_RC", "stack_slots");
a61af66fc99e Initial load
duke
parents:
diff changeset
1012 opForm = constructOperand("sRegL", false);
a61af66fc99e Initial load
duke
parents:
diff changeset
1013 opForm->_constraint = new Constraint("ALLOC_IN_RC", "stack_slots");
a61af66fc99e Initial load
duke
parents:
diff changeset
1014
a61af66fc99e Initial load
duke
parents:
diff changeset
1015 // Create operand type "method" for call targets
a61af66fc99e Initial load
duke
parents:
diff changeset
1016 ident = "method";
a61af66fc99e Initial load
duke
parents:
diff changeset
1017 opForm = constructOperand(ident, false);
a61af66fc99e Initial load
duke
parents:
diff changeset
1018 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1019
a61af66fc99e Initial load
duke
parents:
diff changeset
1020 // Create Effect Forms for each of the legal effects
a61af66fc99e Initial load
duke
parents:
diff changeset
1021 // USE, DEF, USE_DEF, KILL, USE_KILL
a61af66fc99e Initial load
duke
parents:
diff changeset
1022 {
a61af66fc99e Initial load
duke
parents:
diff changeset
1023 const char *ident = "USE";
a61af66fc99e Initial load
duke
parents:
diff changeset
1024 Effect *eForm = new Effect(ident);
a61af66fc99e Initial load
duke
parents:
diff changeset
1025 _globalNames.Insert(ident, eForm);
a61af66fc99e Initial load
duke
parents:
diff changeset
1026 ident = "DEF";
a61af66fc99e Initial load
duke
parents:
diff changeset
1027 eForm = new Effect(ident);
a61af66fc99e Initial load
duke
parents:
diff changeset
1028 _globalNames.Insert(ident, eForm);
a61af66fc99e Initial load
duke
parents:
diff changeset
1029 ident = "USE_DEF";
a61af66fc99e Initial load
duke
parents:
diff changeset
1030 eForm = new Effect(ident);
a61af66fc99e Initial load
duke
parents:
diff changeset
1031 _globalNames.Insert(ident, eForm);
a61af66fc99e Initial load
duke
parents:
diff changeset
1032 ident = "KILL";
a61af66fc99e Initial load
duke
parents:
diff changeset
1033 eForm = new Effect(ident);
a61af66fc99e Initial load
duke
parents:
diff changeset
1034 _globalNames.Insert(ident, eForm);
a61af66fc99e Initial load
duke
parents:
diff changeset
1035 ident = "USE_KILL";
a61af66fc99e Initial load
duke
parents:
diff changeset
1036 eForm = new Effect(ident);
a61af66fc99e Initial load
duke
parents:
diff changeset
1037 _globalNames.Insert(ident, eForm);
a61af66fc99e Initial load
duke
parents:
diff changeset
1038 ident = "TEMP";
a61af66fc99e Initial load
duke
parents:
diff changeset
1039 eForm = new Effect(ident);
a61af66fc99e Initial load
duke
parents:
diff changeset
1040 _globalNames.Insert(ident, eForm);
4120
f03a3c8bd5e5 7077312: Provide a CALL effect for instruct declaration in the ad file
roland
parents: 3853
diff changeset
1041 ident = "CALL";
f03a3c8bd5e5 7077312: Provide a CALL effect for instruct declaration in the ad file
roland
parents: 3853
diff changeset
1042 eForm = new Effect(ident);
f03a3c8bd5e5 7077312: Provide a CALL effect for instruct declaration in the ad file
roland
parents: 3853
diff changeset
1043 _globalNames.Insert(ident, eForm);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1044 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1045
a61af66fc99e Initial load
duke
parents:
diff changeset
1046 //
a61af66fc99e Initial load
duke
parents:
diff changeset
1047 // Build mapping from ideal names to ideal indices
a61af66fc99e Initial load
duke
parents:
diff changeset
1048 int idealIndex = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
1049 for (idealIndex = 1; idealIndex < _last_machine_leaf; ++idealIndex) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1050 const char *idealName = NodeClassNames[idealIndex];
603
dbbe28fc66b5 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 475
diff changeset
1051 _idealIndex.Insert((void*) idealName, (void*) (intptr_t) idealIndex);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1052 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1053 for ( idealIndex = _last_machine_leaf+1;
a61af66fc99e Initial load
duke
parents:
diff changeset
1054 idealIndex < _last_opcode; ++idealIndex) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1055 const char *idealName = NodeClassNames[idealIndex];
603
dbbe28fc66b5 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 475
diff changeset
1056 _idealIndex.Insert((void*) idealName, (void*) (intptr_t) idealIndex);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1057 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1058
a61af66fc99e Initial load
duke
parents:
diff changeset
1059 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1060
a61af66fc99e Initial load
duke
parents:
diff changeset
1061
a61af66fc99e Initial load
duke
parents:
diff changeset
1062 //---------------------------addSUNcopyright-------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
1063 // output SUN copyright info
a61af66fc99e Initial load
duke
parents:
diff changeset
1064 void ArchDesc::addSunCopyright(char* legal, int size, FILE *fp) {
968
5fdbe2cdf565 6879689: Fix warning about ignored return value when compiling with -O2
andrew
parents: 628
diff changeset
1065 size_t count = fwrite(legal, 1, size, fp);
5fdbe2cdf565 6879689: Fix warning about ignored return value when compiling with -O2
andrew
parents: 628
diff changeset
1066 assert(count == (size_t) size, "copyright info truncated");
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1067 fprintf(fp,"\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
1068 fprintf(fp,"// Machine Generated File. Do Not Edit!\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
1069 fprintf(fp,"\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
1070 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1071
a61af66fc99e Initial load
duke
parents:
diff changeset
1072
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
1073 //---------------------------addIncludeGuardStart--------------------------
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
1074 // output the start of an include guard.
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
1075 void ArchDesc::addIncludeGuardStart(ADLFILE &adlfile, const char* guardString) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1076 // Build #include lines
a61af66fc99e Initial load
duke
parents:
diff changeset
1077 fprintf(adlfile._fp, "\n");
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
1078 fprintf(adlfile._fp, "#ifndef %s\n", guardString);
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
1079 fprintf(adlfile._fp, "#define %s\n", guardString);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1080 fprintf(adlfile._fp, "\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
1081
a61af66fc99e Initial load
duke
parents:
diff changeset
1082 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1083
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
1084 //---------------------------addIncludeGuardEnd--------------------------
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
1085 // output the end of an include guard.
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
1086 void ArchDesc::addIncludeGuardEnd(ADLFILE &adlfile, const char* guardString) {
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
1087 // Build #include lines
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
1088 fprintf(adlfile._fp, "\n");
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
1089 fprintf(adlfile._fp, "#endif // %s\n", guardString);
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
1090
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
1091 }
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
1092
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
1093 //---------------------------addInclude--------------------------
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
1094 // output the #include line for this file.
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
1095 void ArchDesc::addInclude(ADLFILE &adlfile, const char* fileName) {
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
1096 fprintf(adlfile._fp, "#include \"%s\"\n", fileName);
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
1097
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
1098 }
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
1099
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
1100 void ArchDesc::addInclude(ADLFILE &adlfile, const char* includeDir, const char* fileName) {
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
1101 fprintf(adlfile._fp, "#include \"%s/%s\"\n", includeDir, fileName);
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
1102
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
1103 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1104
a61af66fc99e Initial load
duke
parents:
diff changeset
1105 //---------------------------addPreprocessorChecks-----------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
1106 // Output C preprocessor code to verify the backend compilation environment.
a61af66fc99e Initial load
duke
parents:
diff changeset
1107 // The idea is to force code produced by "adlc -DHS64" to be compiled by a
a61af66fc99e Initial load
duke
parents:
diff changeset
1108 // command of the form "CC ... -DHS64 ...", so that any #ifdefs in the source
a61af66fc99e Initial load
duke
parents:
diff changeset
1109 // blocks select C code that is consistent with adlc's selections of AD code.
a61af66fc99e Initial load
duke
parents:
diff changeset
1110 void ArchDesc::addPreprocessorChecks(FILE *fp) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1111 const char* flag;
a61af66fc99e Initial load
duke
parents:
diff changeset
1112 _preproc_list.reset();
a61af66fc99e Initial load
duke
parents:
diff changeset
1113 if (_preproc_list.count() > 0 && !_preproc_list.current_is_signal()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1114 fprintf(fp, "// Check consistency of C++ compilation with ADLC options:\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
1115 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1116 for (_preproc_list.reset(); (flag = _preproc_list.iter()) != NULL; ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1117 if (_preproc_list.current_is_signal()) break;
a61af66fc99e Initial load
duke
parents:
diff changeset
1118 char* def = get_preproc_def(flag);
a61af66fc99e Initial load
duke
parents:
diff changeset
1119 fprintf(fp, "// Check adlc ");
a61af66fc99e Initial load
duke
parents:
diff changeset
1120 if (def)
a61af66fc99e Initial load
duke
parents:
diff changeset
1121 fprintf(fp, "-D%s=%s\n", flag, def);
a61af66fc99e Initial load
duke
parents:
diff changeset
1122 else fprintf(fp, "-U%s\n", flag);
a61af66fc99e Initial load
duke
parents:
diff changeset
1123 fprintf(fp, "#%s %s\n",
a61af66fc99e Initial load
duke
parents:
diff changeset
1124 def ? "ifndef" : "ifdef", flag);
a61af66fc99e Initial load
duke
parents:
diff changeset
1125 fprintf(fp, "# error \"%s %s be defined\"\n",
a61af66fc99e Initial load
duke
parents:
diff changeset
1126 flag, def ? "must" : "must not");
a61af66fc99e Initial load
duke
parents:
diff changeset
1127 fprintf(fp, "#endif // %s\n", flag);
a61af66fc99e Initial load
duke
parents:
diff changeset
1128 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1129 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1130
a61af66fc99e Initial load
duke
parents:
diff changeset
1131
a61af66fc99e Initial load
duke
parents:
diff changeset
1132 // Convert operand name into enum name
a61af66fc99e Initial load
duke
parents:
diff changeset
1133 const char *ArchDesc::machOperEnum(const char *opName) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1134 return ArchDesc::getMachOperEnum(opName);
a61af66fc99e Initial load
duke
parents:
diff changeset
1135 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1136
a61af66fc99e Initial load
duke
parents:
diff changeset
1137 // Convert operand name into enum name
a61af66fc99e Initial load
duke
parents:
diff changeset
1138 const char *ArchDesc::getMachOperEnum(const char *opName) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1139 return (opName ? toUpper(opName) : opName);
a61af66fc99e Initial load
duke
parents:
diff changeset
1140 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1141
a61af66fc99e Initial load
duke
parents:
diff changeset
1142 //---------------------------buildMustCloneMap-----------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
1143 // Flag cases when machine needs cloned values or instructions
a61af66fc99e Initial load
duke
parents:
diff changeset
1144 void ArchDesc::buildMustCloneMap(FILE *fp_hpp, FILE *fp_cpp) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1145 // Build external declarations for mappings
a61af66fc99e Initial load
duke
parents:
diff changeset
1146 fprintf(fp_hpp, "// Mapping from machine-independent opcode to boolean\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
1147 fprintf(fp_hpp, "// Flag cases where machine needs cloned values or instructions\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
1148 fprintf(fp_hpp, "extern const char must_clone[];\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
1149 fprintf(fp_hpp, "\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
1150
a61af66fc99e Initial load
duke
parents:
diff changeset
1151 // Build mapping from ideal names to ideal indices
a61af66fc99e Initial load
duke
parents:
diff changeset
1152 fprintf(fp_cpp, "\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
1153 fprintf(fp_cpp, "// Mapping from machine-independent opcode to boolean\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
1154 fprintf(fp_cpp, "const char must_clone[] = {\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
1155 for (int idealIndex = 0; idealIndex < _last_opcode; ++idealIndex) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1156 int must_clone = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
1157 const char *idealName = NodeClassNames[idealIndex];
a61af66fc99e Initial load
duke
parents:
diff changeset
1158 // Previously selected constants for cloning
a61af66fc99e Initial load
duke
parents:
diff changeset
1159 // !!!!!
a61af66fc99e Initial load
duke
parents:
diff changeset
1160 // These are the current machine-dependent clones
a61af66fc99e Initial load
duke
parents:
diff changeset
1161 if ( strcmp(idealName,"CmpI") == 0
a61af66fc99e Initial load
duke
parents:
diff changeset
1162 || strcmp(idealName,"CmpU") == 0
a61af66fc99e Initial load
duke
parents:
diff changeset
1163 || strcmp(idealName,"CmpP") == 0
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
1164 || strcmp(idealName,"CmpN") == 0
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1165 || strcmp(idealName,"CmpL") == 0
a61af66fc99e Initial load
duke
parents:
diff changeset
1166 || strcmp(idealName,"CmpD") == 0
a61af66fc99e Initial load
duke
parents:
diff changeset
1167 || strcmp(idealName,"CmpF") == 0
a61af66fc99e Initial load
duke
parents:
diff changeset
1168 || strcmp(idealName,"FastLock") == 0
a61af66fc99e Initial load
duke
parents:
diff changeset
1169 || strcmp(idealName,"FastUnlock") == 0
12323
c9ccd7b85f20 8024924: Intrinsify java.lang.Math.addExact
rbackman
parents: 10389
diff changeset
1170 || strcmp(idealName,"AddExactI") == 0
12972
59e8ad757e19 8026844: Various Math functions needs intrinsification
rbackman
parents: 12323
diff changeset
1171 || strcmp(idealName,"AddExactL") == 0
59e8ad757e19 8026844: Various Math functions needs intrinsification
rbackman
parents: 12323
diff changeset
1172 || strcmp(idealName,"SubExactI") == 0
59e8ad757e19 8026844: Various Math functions needs intrinsification
rbackman
parents: 12323
diff changeset
1173 || strcmp(idealName,"SubExactL") == 0
59e8ad757e19 8026844: Various Math functions needs intrinsification
rbackman
parents: 12323
diff changeset
1174 || strcmp(idealName,"MulExactI") == 0
59e8ad757e19 8026844: Various Math functions needs intrinsification
rbackman
parents: 12323
diff changeset
1175 || strcmp(idealName,"MulExactL") == 0
59e8ad757e19 8026844: Various Math functions needs intrinsification
rbackman
parents: 12323
diff changeset
1176 || strcmp(idealName,"NegExactI") == 0
59e8ad757e19 8026844: Various Math functions needs intrinsification
rbackman
parents: 12323
diff changeset
1177 || strcmp(idealName,"NegExactL") == 0
12323
c9ccd7b85f20 8024924: Intrinsify java.lang.Math.addExact
rbackman
parents: 10389
diff changeset
1178 || strcmp(idealName,"FlagsProj") == 0
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1179 || strcmp(idealName,"Bool") == 0
a61af66fc99e Initial load
duke
parents:
diff changeset
1180 || strcmp(idealName,"Binary") == 0 ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1181 // Removed ConI from the must_clone list. CPUs that cannot use
a61af66fc99e Initial load
duke
parents:
diff changeset
1182 // large constants as immediates manifest the constant as an
a61af66fc99e Initial load
duke
parents:
diff changeset
1183 // instruction. The must_clone flag prevents the constant from
a61af66fc99e Initial load
duke
parents:
diff changeset
1184 // floating up out of loops.
a61af66fc99e Initial load
duke
parents:
diff changeset
1185 must_clone = 1;
a61af66fc99e Initial load
duke
parents:
diff changeset
1186 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1187 fprintf(fp_cpp, " %d%s // %s: %d\n", must_clone,
a61af66fc99e Initial load
duke
parents:
diff changeset
1188 (idealIndex != (_last_opcode - 1)) ? "," : " // no trailing comma",
a61af66fc99e Initial load
duke
parents:
diff changeset
1189 idealName, idealIndex);
a61af66fc99e Initial load
duke
parents:
diff changeset
1190 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1191 // Finish defining table
a61af66fc99e Initial load
duke
parents:
diff changeset
1192 fprintf(fp_cpp, "};\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
1193 }