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

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)
@@ -1252,7 +1252,8 @@
explicit MarkedInstruction(Instruction instruction_) :
Instruction(instruction_),
instruction_class(get_instruction_class(instruction_)),
- rex { }, opcode_in_modrm(false), opcode_in_imm(false) {
+ rex { }, opcode_in_modrm(false), opcode_in_imm(false),
+ rm_half_enabled(false) {
if (has_flag("branch_hint")) {
optional_prefixes.insert("branch_hint");
}
@@ -1386,6 +1387,7 @@
} rex;
bool opcode_in_modrm : 1;
bool opcode_in_imm : 1;
+ bool rm_half_enabled : 1;
static InstructionClass get_instruction_class(
const Instruction &instruction) {
@@ -1691,6 +1693,7 @@
print_opcode_recognition(false);
print_immediate_arguments();
}
+ print_instruction_processing();
}
void print_one_size_definition_modrm_register(void) {
@@ -1749,6 +1752,7 @@
} else {
print_immediate_arguments();
}
+ print_instruction_processing();
}
void print_one_size_definition_modrm_memory(void) {
@@ -1803,10 +1807,13 @@
};
if (operand.enabled) {
auto it = operand_type.find(operand.source);
- if (it != operand_type.end() &&
- (strcmp(it->second, "rm") ||
- enabled(Actions::kParseOperandPositions))) {
- fprintf(out_file, " @operand%zd_%s", operand_index, it->second);
+ if (it != operand_type.end()) {
+ if (enabled(Actions::kParseOperandPositions) ||
+ strcmp(it->second, "rm")) {
+ fprintf(out_file, " @operand%zd_%s", operand_index, it->second);
pasko-google - do not use 2012/05/12 13:54:31 80
pasko-google - do not use 2012/05/12 13:54:31 80
+ } else {
+ rm_half_enabled = true;
pasko-google - do not use 2012/05/12 13:54:31 if (enabled(Actions::kParseOperandPositions) || op
khim 2012/05/12 14:32:16 Done.
+ }
}
}
if (operand.enabled || enabled(Actions::kParseOperandPositions)) {
@@ -1825,6 +1832,7 @@
} else {
print_immediate_arguments();
}
+ print_instruction_processing();
}
}
@@ -1838,6 +1846,22 @@
first_delimiter = false;
}
+ void print_instruction_processing() {
pasko-google - do not use 2012/05/12 13:54:31 print_inst_end_actions
khim 2012/05/12 14:32:16 Done.
+ if (enabled(Actions::kParseOperands)) {
+ if (!enabled(Actions::kParseOperandPositions)) {
+ int operands_count = rm_half_enabled ? -1 : 0;
+ for (auto operand_it = operands.begin();
+ operand_it != operands.end(); ++operand_it) {
+ auto &operand = *operand_it;
+ if (operand.enabled) {
+ ++operands_count;
+ }
+ }
+ 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) {

Powered by Google App Engine
This is Rietveld 408576698