18 #ifndef __CPUI_ACTION__ 19 #define __CPUI_ACTION__ 37 bool contains(
const string &nm)
const {
return (list.find(nm)!=list.end()); }
56 rule_oneactperfunc = 16,
58 rule_warnings_on = 64,
59 rule_warnings_given = 128
64 status_breakstarthit=2,
88 bool checkStartBreak(
void);
89 bool checkActionBreak(
void);
93 Action(uint4 f,
const string &nm,
const string &g);
96 virtual bool turnOnDebug(
const string &nm);
97 virtual bool turnOffDebug(
const string &nm);
99 virtual void printStatistics(ostream &s)
const;
101 bool setBreakPoint(uint4 tp,
const string &specify);
102 bool setWarning(
bool val,
const string &specify);
103 bool disableRule(
const string &specify);
104 bool enableRule(
const string &specify);
105 const string &
getName(
void)
const {
return name; }
106 const string &
getGroup(
void)
const {
return basegroup; }
118 virtual void resetStats(
void);
119 virtual int4 apply(
Funcdata &data)=0;
128 virtual int4 print(ostream &s,int4 num,int4 depth)
const;
129 virtual void printState(ostream &s)
const;
132 virtual Action *getSubAction(
const string &specify);
133 virtual Rule *getSubRule(
const string &specify);
149 void addAction(
Action *ac);
152 virtual void resetStats(
void);
154 virtual int4 print(ostream &s,int4 num,int4 depth)
const;
155 virtual void printState(ostream &s)
const;
156 virtual Action *getSubAction(
const string &specify);
157 virtual Rule *getSubRule(
const string &specify);
158 #ifdef OPACTION_DEBUG 159 virtual bool turnOnDebug(
const string &nm);
160 virtual bool turnOffDebug(
const string &nm);
162 virtual void printStatistics(ostream &s)
const;
211 Rule(
const string &g,uint4 fl,
const string &nm);
221 bool isDisabled(
void)
const {
return ((flags & type_disable)!=0); }
234 virtual void getOpList(vector<uint4> &oplist)
const;
247 #ifdef OPACTION_DEBUG 248 virtual bool turnOnDebug(
const string &nm);
249 virtual bool turnOffDebug(
const string &nm);
260 vector<Rule *> allrules;
262 PcodeOpTree::const_iterator op_state;
268 void addRule(
Rule *rl);
271 virtual void resetStats(
void);
273 virtual int4 print(ostream &s,int4 num,int4 depth)
const;
274 virtual void printState(ostream &s)
const;
275 virtual Rule *getSubRule(
const string &specify);
276 virtual void printStatistics(ostream &s)
const;
277 #ifdef OPACTION_DEBUG 278 virtual bool turnOnDebug(
const string &nm);
279 virtual bool turnOffDebug(
const string &nm);
296 string currentactname;
297 map<string,ActionGroupList> groupmap;
298 map<string,Action *> actionmap;
299 static const char universalname[];
300 void registerAction(
const string &nm,
Action *act);
301 Action *getAction(
const string &nm)
const;
302 Action *deriveAction(
const string &baseaction,
const string &grp);
306 void registerUniversal(
Action *act);
310 Action *setCurrent(
const string &actname);
311 Action *toggleAction(
const string &grp,
const string &basegrp,
bool val);
313 void setGroup(
const string &grp,
const char **argv);
314 void cloneGroup(
const string &oldname,
const string &newname);
315 bool addToGroup(
const string &grp,
const string &basegroup);
316 bool removeFromGroup(
const string &grp,
const string &basegroup);
vector< Action * >::iterator state
Current action being applied.
Definition: action.hh:145
uint4 status
Current status.
Definition: action.hh:80
const string & getName(void) const
Return the name of this Rule.
Definition: action.hh:213
uint4 getNumApply(void)
Definition: action.hh:109
void turnOnWarnings(void)
Enable warnings for this Rule.
Definition: action.hh:219
virtual ~Action(void)
Destructor.
Definition: action.hh:94
A pool of Rules that apply simultaneously.
Definition: action.hh:259
string name
Name of the action.
Definition: action.hh:85
uint4 getStatus(void) const
Get the current status of this Action.
Definition: action.hh:107
const string & getGroup(void) const
Get the Action's group.
Definition: action.hh:106
The list of groups defining a root Action.
Definition: action.hh:29
Container for data structures associated with a single function.
Definition: funcdata.hh:45
bool isDisabled(void) const
Return true if this Rule is disabled.
Definition: action.hh:221
int4 lcount
Changes not including last call to apply()
Definition: action.hh:78
ActionPool(uint4 f, const string &nm)
Construct providing properties and name.
Definition: action.hh:266
bool contains(const string &nm) const
Check if this ActionGroupList contains a given group.
Definition: action.hh:37
bool checkActionBreak(void)
Check action breakpoint.
Definition: action.cc:115
typeflags
Properties associated with a Rule.
Definition: action.hh:195
uint4 getNumTests(void)
Get number of attempted applications.
Definition: action.hh:215
vector< Action * > list
List of actions to perform in the group.
Definition: action.hh:144
ruleflags
Boolean behavior properties governing this particular Action.
Definition: action.hh:53
Large scale transformations applied to the varnode/op graph.
Definition: action.hh:50
string basegroup
Base group this action belongs to.
Definition: action.hh:86
void clearBreak(uint4 tp)
Clear a breakpoint on this Rule.
Definition: action.hh:218
ActionRestartGroup(uint4 f, const string &nm, int4 max)
Construct this providing maximum number of restarts.
Definition: action.hh:175
uint4 getBreakPoint(void) const
Return breakpoint toggles.
Definition: action.hh:225
Action * getCurrent(void) const
Get the current root Action.
Definition: action.hh:307
uint4 breakpoint
Breakpoint properties.
Definition: action.hh:81
Lowest level operation of the p-code language.
Definition: op.hh:58
statusflags
Boolean properties describing the status of an action.
Definition: action.hh:62
void turnOffWarnings(void)
Disable warnings for this Rule.
Definition: action.hh:220
uint4 count_apply
Number of times apply() made changes.
Definition: action.hh:84
virtual void restoreXml(const Element *el, Funcdata *fd)
Load specifics of action from XML.
Definition: action.hh:131
ActionGroup(uint4 f, const string &nm)
Construct given properties and a name.
Definition: action.hh:147
void issueWarning(Architecture *glb)
Warn that this Action has applied.
Definition: action.cc:39
Manager for all the major decompiler subsystems.
Definition: architecture.hh:117
Classes related to basic blocks and control-flow structuring.
virtual int4 applyOp(PcodeOp *op, Funcdata &data)
Attempt to apply this Rule.
Definition: action.hh:243
virtual ~Rule(void)
Destructor.
Definition: action.hh:212
A group of actions (generally) applied in sequence.
Definition: action.hh:142
const string & getCurrentName(void) const
Get the name of the current root Action.
Definition: action.hh:308
An XML element. A node in the DOM tree.
Definition: xml.hh:150
Class for performing a single transformation on a PcodeOp or Varnode.
Definition: action.hh:192
void clearDisable(void)
Enable this Rule (within its pool)
Definition: action.hh:223
virtual Action * clone(const ActionGroupList &grouplist) const
Clone the Action.
Definition: action.cc:873
ActionDatabase(void)
Constructor.
Definition: action.hh:304
virtual void saveXml(ostream &s) const
Save specifics of this action to stream.
Definition: action.hh:130
uint4 getNumTests(void)
Get the number of times apply() was invoked.
Definition: action.hh:108
const string & getGroup(void) const
Return the group this Rule belongs to.
Definition: action.hh:214
const string & getName(void) const
Get the Action's name.
Definition: action.hh:105
virtual void reset(Funcdata &data)
Reset the Action for a new function.
Definition: action.cc:890
virtual void resetStats(void)
Reset all the counts to zero.
Definition: action.cc:900
Database of root Action objects that can be used to transform a function.
Definition: action.hh:294
uint4 flags
Behavior properties.
Definition: action.hh:82
Action which checks if restart (sub)actions have been generated and restarts itself.
Definition: action.hh:171
void turnOffWarnings(void)
Disable warnings for this Action.
Definition: action.hh:91
void setBreak(uint4 tp)
Set a breakpoint on this Rule.
Definition: action.hh:217
Value indicating the end of the op-code values.
Definition: opcodes.hh:127
void turnOnWarnings(void)
Enable warnings for this Action.
Definition: action.hh:90
breakflags
Break points associated with an Action.
Definition: action.hh:71
uint4 getNumApply(void)
Get number of successful applications.
Definition: action.hh:216
uint4 count_tests
Number of times apply() has been called.
Definition: action.hh:83
virtual void printStatistics(ostream &s) const
Dump statistics to stream.
Definition: action.cc:938
int4 count
Number of changes made by this action so far.
Definition: action.hh:79
void setDisable(void)
Disable this Rule (within its pool)
Definition: action.hh:222