Program Listing for File AstSimpleProcessing.h#
↰ Return to documentation for file (src/midend/astProcessing/AstSimpleProcessing.h)
// Original Author (AstProcessing classes): Markus Schordan
// Rewritten by: Gergo Barany
// $Id: AstSimpleProcessing.h,v 1.3 2008/01/08 02:56:39 dquinlan Exp $
// See comments in AstProcessing.h for list of changes during the rewrite
#ifndef ASTPROCESSINGSIMPLE_H
#define ASTPROCESSINGSIMPLE_H
#include "AstProcessing.h"
// GB (7/6/2007): Added AstPrePostProcessing as a pre- and postorder
// traversal without attributes -- I feel this will be useful for many
// applications. (At least, I constantly find myself wanting to write
// traversals that simply push nodes onto a stack in the preorder visit and
// pop the stack in the postorder visit. With the existing traversal classes I
// had to use a TopDownBottomUpProcessing and ignore the attributes.)
class AstCombinedPrePostProcessing;
class ROSE_DLL_API AstPrePostProcessing
: public SgTreeTraversal<DummyAttribute, DummyAttribute>
{
public:
void traverse(SgNode *node);
void traverseWithinFile(SgNode *node);
void traverseInputFiles(SgProject *projectNode);
friend class AstCombinedPrePostProcessing;
protected:
virtual void preOrderVisit(SgNode *astNode) = 0;
virtual void postOrderVisit(SgNode *astNode) = 0;
virtual void atTraversalStart();
virtual void atTraversalEnd();
private:
DummyAttribute evaluateInheritedAttribute(SgNode *astNode, DummyAttribute inheritedValue);
DummyAttribute evaluateSynthesizedAttribute(SgNode* astNode, DummyAttribute inheritedValue,
SynthesizedAttributesList l);
DummyAttribute defaultSynthesizedAttribute(DummyAttribute inheritedValue);
};
// Logically, AstSimpleProcessing could be derived from
// AstPrePostProcessing, but that results in a (barely) measurable
// performance hit.
class AstCombinedSimpleProcessing;
class ROSE_DLL_API AstSimpleProcessing
: public SgTreeTraversal<DummyAttribute, DummyAttribute>
{
public:
typedef t_traverseOrder Order;
void traverse(SgNode* node, Order treeTraversalOrder);
void traverseWithinFile(SgNode* node, Order treeTraversalOrder);
void traverseInputFiles(SgProject* projectNode, Order treeTraversalOrder);
friend class AstCombinedSimpleProcessing;
protected:
virtual void visit(SgNode* astNode) = 0;
virtual void atTraversalStart();
virtual void atTraversalEnd();
private:
DummyAttribute evaluateInheritedAttribute(SgNode *astNode, DummyAttribute inheritedValue);
DummyAttribute evaluateSynthesizedAttribute(SgNode* astNode, DummyAttribute inheritedValue,
SynthesizedAttributesList l);
DummyAttribute defaultSynthesizedAttribute(DummyAttribute inheritedValue);
};
class SgSimpleProcessing : public AstSimpleProcessing {};
#endif