1 //
2 // Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
3 // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 //
5 // This code is free software; you can redistribute it and/or modify it
6 // under the terms of the GNU General Public License version 2 only, as
7 // published by the Free Software Foundation.
8 //
9 // This code is distributed in the hope that it will be useful, but WITHOUT
10 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 // version 2 for more details (a copy is included in the LICENSE file that
13 // accompanied this code).
14 //
15 // You should have received a copy of the GNU General Public License version
16 // 2 along with this work; if not, write to the Free Software Foundation,
17 // Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 //
19 // Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 // or visit www.oracle.com if you need additional information or have any
21 // questions.
22 //
290
291 // Ensure that match field is defined.
292 if ( instr->_matrule == NULL ) continue;
293
294 MatchRule &mrule = *instr->_matrule;
295 Predicate *pred = instr->build_predicate();
296
297 // Grab the machine type of the operand
298 const char *rootOp = instr->_ident;
299 mrule._machType = rootOp;
300
301 // Cost for this match
302 const char *costStr = instr->cost();
303 const char *defaultCost =
304 ((AttributeForm*)_globalNames[AttributeForm::_ins_cost])->_attrdef;
305 const char *cost = costStr? costStr : defaultCost;
306
307 // Find result type for match
308 const char *result = instr->reduce_result();
309
310 if ( instr->is_ideal_branch() && instr->label_position() == -1 ||
311 !instr->is_ideal_branch() && instr->label_position() != -1) {
312 syntax_err(instr->_linenum, "%s: Only branches to a label are supported\n", rootOp);
313 }
314
315 Attribute *attr = instr->_attribs;
316 while (attr != NULL) {
317 if (strcmp(attr->_ident,"ins_short_branch") == 0 &&
318 attr->int_val(*this) != 0) {
319 if (!instr->is_ideal_branch() || instr->label_position() == -1) {
320 syntax_err(instr->_linenum, "%s: Only short branch to a label is supported\n", rootOp);
321 }
322 instr->set_short_branch(true);
323 } else if (strcmp(attr->_ident,"ins_alignment") == 0 &&
324 attr->int_val(*this) != 0) {
325 instr->set_alignment(attr->int_val(*this));
326 }
327 attr = (Attribute *)attr->_next;
328 }
329
330 if (!instr->is_short_branch()) {
331 buildMatchList(instr->_matrule, result, mrule._machType, pred, cost);
|
1 //
2 // Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
3 // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 //
5 // This code is free software; you can redistribute it and/or modify it
6 // under the terms of the GNU General Public License version 2 only, as
7 // published by the Free Software Foundation.
8 //
9 // This code is distributed in the hope that it will be useful, but WITHOUT
10 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 // version 2 for more details (a copy is included in the LICENSE file that
13 // accompanied this code).
14 //
15 // You should have received a copy of the GNU General Public License version
16 // 2 along with this work; if not, write to the Free Software Foundation,
17 // Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 //
19 // Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 // or visit www.oracle.com if you need additional information or have any
21 // questions.
22 //
290
291 // Ensure that match field is defined.
292 if ( instr->_matrule == NULL ) continue;
293
294 MatchRule &mrule = *instr->_matrule;
295 Predicate *pred = instr->build_predicate();
296
297 // Grab the machine type of the operand
298 const char *rootOp = instr->_ident;
299 mrule._machType = rootOp;
300
301 // Cost for this match
302 const char *costStr = instr->cost();
303 const char *defaultCost =
304 ((AttributeForm*)_globalNames[AttributeForm::_ins_cost])->_attrdef;
305 const char *cost = costStr? costStr : defaultCost;
306
307 // Find result type for match
308 const char *result = instr->reduce_result();
309
310 if (( instr->is_ideal_branch() && instr->label_position() == -1) ||
311 (!instr->is_ideal_branch() && instr->label_position() != -1)) {
312 syntax_err(instr->_linenum, "%s: Only branches to a label are supported\n", rootOp);
313 }
314
315 Attribute *attr = instr->_attribs;
316 while (attr != NULL) {
317 if (strcmp(attr->_ident,"ins_short_branch") == 0 &&
318 attr->int_val(*this) != 0) {
319 if (!instr->is_ideal_branch() || instr->label_position() == -1) {
320 syntax_err(instr->_linenum, "%s: Only short branch to a label is supported\n", rootOp);
321 }
322 instr->set_short_branch(true);
323 } else if (strcmp(attr->_ident,"ins_alignment") == 0 &&
324 attr->int_val(*this) != 0) {
325 instr->set_alignment(attr->int_val(*this));
326 }
327 attr = (Attribute *)attr->_next;
328 }
329
330 if (!instr->is_short_branch()) {
331 buildMatchList(instr->_matrule, result, mrule._machType, pred, cost);
|