< prev index next >
src/share/vm/adlc/dfa.cpp
Print this page
*** 369,379 ****
// rule, and prune any cases which are higher cost for the same reduction.
// In order to generate the DFA we walk the table of ideal opcode/MatchList
// pairs generated by the ADLC front end to build the contents of the case
// statements (a series of if statements).
void ArchDesc::buildDFA(FILE* fp) {
! int i;
// Remember operands that are the starting points for chain rules.
// Prevent cycles by checking if we have already generated chain.
Dict operands_chained_from(cmpstr, hashstr, Form::arena);
// Hash inputs to match rules so that final DFA contains only one entry for
--- 369,379 ----
// rule, and prune any cases which are higher cost for the same reduction.
// In order to generate the DFA we walk the table of ideal opcode/MatchList
// pairs generated by the ADLC front end to build the contents of the case
// statements (a series of if statements).
void ArchDesc::buildDFA(FILE* fp) {
! uint i;
// Remember operands that are the starting points for chain rules.
// Prevent cycles by checking if we have already generated chain.
Dict operands_chained_from(cmpstr, hashstr, Form::arena);
// Hash inputs to match rules so that final DFA contains only one entry for
*** 422,453 ****
fprintf(fp, "\n");
fprintf(fp, "\n");
if (_dfa_small) {
// Now build the individual routines just like the switch entries in large version
// Iterate over the table of MatchLists, start at first valid opcode of 1
! for (i = 1; i < _last_opcode; i++) {
if (_mlistab[i] == NULL) continue;
// Generate the routine header statement for this opcode
fprintf(fp, "void State::_sub_Op_%s(const Node *n){\n", NodeClassNames[i]);
// Generate body. Shared for both inline and out-of-line version
gen_dfa_state_body(fp, minimize, status, operands_chained_from, i);
// End of routine
fprintf(fp, "}\n");
}
}
fprintf(fp, "bool State::DFA");
! fprintf(fp, "(int opcode, const Node *n) {\n");
fprintf(fp, " switch(opcode) {\n");
// Iterate over the table of MatchLists, start at first valid opcode of 1
! for (i = 1; i < _last_opcode; i++) {
if (_mlistab[i] == NULL) continue;
// Generate the case statement for this opcode
if (_dfa_small) {
! fprintf(fp, " case Op_%s: { _sub_Op_%s(n);\n", NodeClassNames[i], NodeClassNames[i]);
} else {
! fprintf(fp, " case Op_%s: {\n", NodeClassNames[i]);
// Walk the list, compacting it
gen_dfa_state_body(fp, minimize, status, operands_chained_from, i);
}
// Print the "break"
fprintf(fp, " break;\n");
--- 422,453 ----
fprintf(fp, "\n");
fprintf(fp, "\n");
if (_dfa_small) {
// Now build the individual routines just like the switch entries in large version
// Iterate over the table of MatchLists, start at first valid opcode of 1
! for (i = 1; i < static_cast<uint>(Opcodes::_last_opcode); i++) {
if (_mlistab[i] == NULL) continue;
// Generate the routine header statement for this opcode
fprintf(fp, "void State::_sub_Op_%s(const Node *n){\n", NodeClassNames[i]);
// Generate body. Shared for both inline and out-of-line version
gen_dfa_state_body(fp, minimize, status, operands_chained_from, i);
// End of routine
fprintf(fp, "}\n");
}
}
fprintf(fp, "bool State::DFA");
! fprintf(fp, "(Opcodes opcode, const Node *n) {\n");
fprintf(fp, " switch(opcode) {\n");
// Iterate over the table of MatchLists, start at first valid opcode of 1
! for (i = 1; i < static_cast<uint>(Opcodes::_last_opcode); i++) {
if (_mlistab[i] == NULL) continue;
// Generate the case statement for this opcode
if (_dfa_small) {
! fprintf(fp, " case Opcodes::Op_%s: { _sub_Op_%s(n);\n", NodeClassNames[i], NodeClassNames[i]);
} else {
! fprintf(fp, " case Opcodes::Op_%s: {\n", NodeClassNames[i]);
// Walk the list, compacting it
gen_dfa_state_body(fp, minimize, status, operands_chained_from, i);
}
// Print the "break"
fprintf(fp, " break;\n");
*** 456,466 ****
// Generate the default case for switch(opcode)
fprintf(fp, " \n");
fprintf(fp, " default:\n");
fprintf(fp, " tty->print(\"Default case invoked for: \\n\");\n");
! fprintf(fp, " tty->print(\" opcode = %cd, \\\"%cs\\\"\\n\", opcode, NodeClassNames[opcode]);\n", '%', '%');
fprintf(fp, " return false;\n");
fprintf(fp, " }\n");
// Return status, indicating a successful match.
fprintf(fp, " return true;\n");
--- 456,466 ----
// Generate the default case for switch(opcode)
fprintf(fp, " \n");
fprintf(fp, " default:\n");
fprintf(fp, " tty->print(\"Default case invoked for: \\n\");\n");
! fprintf(fp, " tty->print(\" opcode = %cu, \\\"%cs\\\"\\n\", static_cast<uint>(opcode), NodeClassNames[static_cast<uint>(opcode)]);\n", '%', '%');
fprintf(fp, " return false;\n");
fprintf(fp, " }\n");
// Return status, indicating a successful match.
fprintf(fp, " return true;\n");
< prev index next >