Mercurial > hg > truffle
comparison src/share/vm/adlc/output_c.cpp @ 14431:1410ad6b05f1
8028401: PPC (part 117): Improve usability of adlc and format() functionality.
Summary: Add additional, more verbose syntax checks in adlc. Fix printing constant's problem in format().
Reviewed-by: kvn
author | goetz |
---|---|
date | Fri, 15 Nov 2013 12:01:00 -0800 |
parents | 044b28168e20 |
children | 318d0622a6d7 |
comparison
equal
deleted
inserted
replaced
14430:ea78de16a4a4 | 14431:1410ad6b05f1 |
---|---|
1568 for(expand->reset_instructions(); | 1568 for(expand->reset_instructions(); |
1569 (expand_instr = expand->iter_instructions()) != NULL; cnt++) { | 1569 (expand_instr = expand->iter_instructions()) != NULL; cnt++) { |
1570 new_id = expand_instr->name(); | 1570 new_id = expand_instr->name(); |
1571 | 1571 |
1572 InstructForm* expand_instruction = (InstructForm*)globalAD->globalNames()[new_id]; | 1572 InstructForm* expand_instruction = (InstructForm*)globalAD->globalNames()[new_id]; |
1573 | |
1574 if (!expand_instruction) { | |
1575 globalAD->syntax_err(node->_linenum, "In %s: instruction %s used in expand not declared\n", | |
1576 node->_ident, new_id); | |
1577 continue; | |
1578 } | |
1579 | |
1573 if (expand_instruction->has_temps()) { | 1580 if (expand_instruction->has_temps()) { |
1574 globalAD->syntax_err(node->_linenum, "In %s: expand rules using instructs with TEMPs aren't supported: %s", | 1581 globalAD->syntax_err(node->_linenum, "In %s: expand rules using instructs with TEMPs aren't supported: %s", |
1575 node->_ident, new_id); | 1582 node->_ident, new_id); |
1576 } | 1583 } |
1577 | 1584 |
1626 int prev_pos = -1; | 1633 int prev_pos = -1; |
1627 for( expand_instr->reset(); (opid = expand_instr->iter()) != NULL; ) { | 1634 for( expand_instr->reset(); (opid = expand_instr->iter()) != NULL; ) { |
1628 // Use 'parameter' at current position in list of new instruction's formals | 1635 // Use 'parameter' at current position in list of new instruction's formals |
1629 // instead of 'opid' when looking up info internal to new_inst | 1636 // instead of 'opid' when looking up info internal to new_inst |
1630 const char *parameter = formal_lst->iter(); | 1637 const char *parameter = formal_lst->iter(); |
1638 if (!parameter) { | |
1639 globalAD->syntax_err(node->_linenum, "Operand %s of expand instruction %s has" | |
1640 " no equivalent in new instruction %s.", | |
1641 opid, node->_ident, new_inst->_ident); | |
1642 assert(0, "Wrong expand"); | |
1643 } | |
1644 | |
1631 // Check for an operand which is created in the expand rule | 1645 // Check for an operand which is created in the expand rule |
1632 if ((exp_pos = node->_exprule->_newopers.index(opid)) != -1) { | 1646 if ((exp_pos = node->_exprule->_newopers.index(opid)) != -1) { |
1633 new_pos = new_inst->operand_position(parameter,Component::USE); | 1647 new_pos = new_inst->operand_position(parameter,Component::USE); |
1634 exp_pos += node->num_opnds(); | 1648 exp_pos += node->num_opnds(); |
1635 // If there is no use of the created operand, just skip it | 1649 // If there is no use of the created operand, just skip it |
2101 if ( _reg_status != LITERAL_NOT_SEEN ) { | 2115 if ( _reg_status != LITERAL_NOT_SEEN ) { |
2102 assert( _reg_status == LITERAL_SEEN, "Must have seen register literal before now"); | 2116 assert( _reg_status == LITERAL_SEEN, "Must have seen register literal before now"); |
2103 if (strcmp(rep_var,"$reg") == 0 || reg_conversion(rep_var) != NULL) { | 2117 if (strcmp(rep_var,"$reg") == 0 || reg_conversion(rep_var) != NULL) { |
2104 _reg_status = LITERAL_ACCESSED; | 2118 _reg_status = LITERAL_ACCESSED; |
2105 } else { | 2119 } else { |
2120 _AD.syntax_err(_encoding._linenum, | |
2121 "Invalid access to literal register parameter '%s' in %s.\n", | |
2122 rep_var, _encoding._name); | |
2106 assert( false, "invalid access to literal register parameter"); | 2123 assert( false, "invalid access to literal register parameter"); |
2107 } | 2124 } |
2108 } | 2125 } |
2109 // literal constant parameters must be accessed as a 'constant' field | 2126 // literal constant parameters must be accessed as a 'constant' field |
2110 if ( _constant_status != LITERAL_NOT_SEEN ) { | 2127 if (_constant_status != LITERAL_NOT_SEEN) { |
2111 assert( _constant_status == LITERAL_SEEN, "Must have seen constant literal before now"); | 2128 assert(_constant_status == LITERAL_SEEN, "Must have seen constant literal before now"); |
2112 if( strcmp(rep_var,"$constant") == 0 ) { | 2129 if (strcmp(rep_var,"$constant") == 0) { |
2113 _constant_status = LITERAL_ACCESSED; | 2130 _constant_status = LITERAL_ACCESSED; |
2114 } else { | 2131 } else { |
2115 assert( false, "invalid access to literal constant parameter"); | 2132 _AD.syntax_err(_encoding._linenum, |
2133 "Invalid access to literal constant parameter '%s' in %s.\n", | |
2134 rep_var, _encoding._name); | |
2116 } | 2135 } |
2117 } | 2136 } |
2118 } // end replacement and/or subfield | 2137 } // end replacement and/or subfield |
2119 | 2138 |
2120 } | 2139 } |