| Polaris: WorkSpace Class Reference | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members
WorkSpace Class ReferenceAn abstract class for holding temporary pass-specific data. More...
Inheritance diagram for WorkSpace: ![]()
Detailed DescriptionAn abstract class for holding temporary pass-specific data.Polaris Base
OverviewA WorkSpace class serves a placeholder for temporary data associated with Polaris' data structures, for example Statement or ProgamUnit objects.DescriptionWhen a pass needs to annotate Statements or ProgramUnits with its own local data, it should create objects of a subclass of WorkSpace, which has fields for the temporary data, and push these objects onto the work stacks of these data structures (see WorkPlaceStack.h). When the pass is finished, it must pop its WorkSpace objects off of the work stacks.Each pass must have its own unique pass tag. Pass tags are needed by WorkSpaceStacks to differentiate between multiple WorkSpaces on their stacks (see WorkSpaceStack.h). A pass can receive its own pass tag by calling the function create_pass_tag(). WorkSpaces differ from Directive or Assertion objects in that they are temporary and local to one pass. The pass is responsible for keeping the WorkSpace objects up to date when a Statement or Expression is modified. Additionally, it is assumed that the pass discards all of its WorkSpace objects upon its exit. ExamplesAn example of a pass using WorkSpaces is:void my_pass(ProgramUnit *pgm) { Initialization unsigned int my_pass_tag = create_pass_tag(); for (stmt = each statement in the program pgm) stmt->work_stack.push(new myWorkSpace(my_pass_tag, stmt)); Perform my analysis while (not done with my analysis) { Visit statement stmt myWorkSpace &ws = * (myWorkSpace *) stmt->work_stack.top_ref( my_pass_tag); Use ws } Exiting pgm->clean_workspace(my_pass_tag); }
Definition at line 77 of file WorkSpace.h. Constructor & Destructor Documentation
Member Function Documentation
The documentation for this class was generated from the following files: |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||