Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Unified Diff: src/trusted/validator_ragel/unreviewed/gen-dfa.cc

Issue 10392066: validator_ragel: Use different actions for different types of commands (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/trusted/validator_ragel/unreviewed/gen-dfa.cc
===================================================================
--- src/trusted/validator_ragel/unreviewed/gen-dfa.cc (revision 8571)
+++ src/trusted/validator_ragel/unreviewed/gen-dfa.cc (working copy)
@@ -1691,6 +1691,7 @@
print_opcode_recognition(false);
print_immediate_arguments();
}
+ print_inst_end_actions(false);
}
void print_one_size_definition_modrm_register(void) {
@@ -1749,6 +1750,7 @@
} else {
print_immediate_arguments();
}
+ print_inst_end_actions(false);
}
void print_one_size_definition_modrm_memory(void) {
@@ -1825,6 +1827,7 @@
} else {
print_immediate_arguments();
}
+ print_inst_end_actions(true);
}
}
@@ -1838,6 +1841,33 @@
first_delimiter = false;
}
+ void print_inst_end_actions(bool memory_access) {
+ if (enabled(Actions::kParseOperands)) {
+ if (!enabled(Actions::kParseOperandPositions)) {
+ int operands_count = 0;
+ for (auto operand_it = operands.begin();
+ operand_it != operands.end(); ++operand_it) {
+ auto &operand = *operand_it;
+ if (operand.enabled) {
+ ++operands_count;
+ if (memory_access) {
+ static const char cc[] = { 'E', 'M', 'N', 'Q', 'R', 'U', 'W' };
+ for (size_t c_it = 0; c_it < arraysize(cc); ++c_it) {
+ auto c = cc[c_it];
+ if (operand.source == c) {
+ /* Memory operand is processed with action @check_access. */
+ --operands_count;
+ break;
+ }
+ }
+ }
+ }
+ }
+ fprintf(out_file, " @process_%d_operands", operands_count);
+ }
+ }
+ }
+
bool mod_reg_is_used() {
for (auto operand_it = operands.begin();
operand_it != operands.end(); ++operand_it) {
« no previous file with comments | « src/trusted/validator_ragel/gen/validator-x86_64_table.c ('k') | src/trusted/validator_ragel/unreviewed/validator-x86_64.rl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698