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

Unified Diff: src/trusted/validator_arm/inst_classes.h

Issue 10356115: Clean up code to clarify we are only tracking the condition flags of APSR. (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_arm/inst_classes.h
===================================================================
--- src/trusted/validator_arm/inst_classes.h (revision 8588)
+++ src/trusted/validator_arm/inst_classes.h (working copy)
@@ -223,21 +223,22 @@
};
// Interface class to pull out S (update) bit from bit 20, which
-// defines if the flags register is updated by the instruction.
-class UpdatesFlagsRegisterBit20Interface {
+// defines if the condition bits in APSR are updated by the instruction.
+class UpdatesConditionsBit20Interface {
public:
- inline UpdatesFlagsRegisterBit20Interface() {}
- // Returns true if bit is set that states that the flags register is updated.
+ inline UpdatesConditionsBit20Interface() {}
+ // Returns true if bit is set that states that the condition bits
+ // APSR is updated.
static inline bool is_updated(const Instruction i) {
return i.bit(20);
}
- // Returns the flags register if it is used.
- static inline Register reg_if_updated(const Instruction i) {
- return is_updated(i) ? kRegisterFlags : kRegisterNone;
+ // Returns the conditions register if it is used.
+ static inline Register conds_if_updated(const Instruction i) {
+ return is_updated(i) ? kConditions : kRegisterNone;
}
private:
- NACL_DISALLOW_COPY_AND_ASSIGN(UpdatesFlagsRegisterBit20Interface);
+ NACL_DISALLOW_COPY_AND_ASSIGN(UpdatesConditionsBit20Interface);
};
// A class decoder is designed to decode a set of instructions that
@@ -278,11 +279,16 @@
// Gets the set of registers affected when an instruction executes. This set
// is complete, and includes
// - explicit destination register(s),
- // - changes to flags,
+ // - changes to condition flags,
// - indexed-addressing writeback,
// - changes to r15 by branches,
// - implicit register results, like branch-with-link.
//
+ // Note: If you are unsure if an instruction changes condition flags, be
+ // conservative and add it to the set of registers returned by this
+ // function. Failure to do so may cause a potential break in pattern
+ // atomicity, which checks that two instructions run under the same condition.
+ //
// The default implementation returns a ridiculous bitmask that suggests that
// all possible side effects will occur -- override if this is not
// appropriate. :-)
« no previous file with comments | « src/trusted/validator_arm/baseline_classes_statics.cc ('k') | src/trusted/validator_arm/inst_classes_testers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698