Add WalkAST() function for generic AST walking.
For starters, use it for the check to see if code is safe to run with the mask all off. This also fixes a bug where we would sometimes incorrectly say that a whole block of code was unsafe to run with an all off mask because we came to a NULL AST node during traversal.
This commit is contained in:
11
ast.h
11
ast.h
@@ -91,4 +91,15 @@ private:
|
||||
std::vector<Function *> functions;
|
||||
};
|
||||
|
||||
|
||||
typedef void (* ASTCallBackFunc)(ASTNode *node, void *data);
|
||||
|
||||
/** Walk (some portion of) an AST, starting from the given root node. At
|
||||
each node, if preFunc is non-NULL, call it preFunc, passing the given
|
||||
void *data pointer. Makes recursive calls to WalkAST() to process the
|
||||
node's children; after doing so, postFunc, if non-NULL is called at the
|
||||
node. */
|
||||
extern void WalkAST(ASTNode *root, ASTCallBackFunc preFunc,
|
||||
ASTCallBackFunc postFunc, void *data);
|
||||
|
||||
#endif // ISPC_AST_H
|
||||
|
||||
Reference in New Issue
Block a user