Skip to content

Commit

Permalink
Add some inline comments for definitions
Browse files Browse the repository at this point in the history
Summary: Got a bit confused writing register property. Try to document some definitions when checking past diffs.

Reviewed By: NTillmann

Differential Revision: D51873671

fbshipit-source-id: 1478196cb7367cfe3aa37923e4c7c44b7101fa75
  • Loading branch information
ssj933 authored and facebook-github-bot committed Dec 6, 2023
1 parent bf1ea9e commit c572f97
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
9 changes: 9 additions & 0 deletions libredex/RedexProperties.def
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@
#error "You must define REDEX_PROPS!"
#endif

/**
* Negative: This property is by default preserved, and need to be explicitly destroyed
* before final state.
* DefaultInitial: This property will be established at beginning of all Redex passes
* (unless disabled explicitly) by default.
* DefaultFinal: This property will be required at end of all Redex passes (unless
* disabled explicitly) by default.
* DefaultPreserve: This property will be preserved by default after establised.
*/
// REDEX_PROPS(Name, Negative, DefaultInitial, DefaultFinal, DefaultPreserve)
REDEX_PROPS(DexLimitsObeyed, false, false, true, false)
REDEX_PROPS(HasSourceBlocks, false, false, false, true)
Expand Down
12 changes: 12 additions & 0 deletions libredex/RedexProperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,30 @@ struct PropertyInteraction {
};

namespace interactions {
// Not specified property will have Destroys interaction for
// passes by default unless specified with Negative or DefaultPreserve
inline const PropertyInteraction Destroys = // default
PropertyInteraction(false, false, false, false);
// Preserve established property for passes.
// DefaultPreserve will preserve the property by default.
inline const PropertyInteraction Preserves =
PropertyInteraction(false, false, true, false);
// Requires property for passes will be checked if they have
// already been established.
inline const PropertyInteraction Requires =
PropertyInteraction(false, true, false, false);
// Establishes a property for passes. DefaultInitial property
// will be established at beginning by default.
// In deep check mode, after each pass eastablished property
// will be running their own checks.
inline const PropertyInteraction Establishes =
PropertyInteraction(true, false, false, false);
inline const PropertyInteraction RequiresAndEstablishes =
PropertyInteraction(true, true, true, false);
inline const PropertyInteraction RequiresAndPreserves =
PropertyInteraction(false, true, true, false);
// Establish a property and add it to final require list with other
// default finals.
inline const PropertyInteraction EstablishesAndRequiresFinally =
PropertyInteraction(true, false, false, true);
} // namespace interactions
Expand Down

0 comments on commit c572f97

Please sign in to comment.