Commit 307c2a08 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Switch to smallvectors here

parent 413d0226
...@@ -2223,7 +2223,7 @@ public: ...@@ -2223,7 +2223,7 @@ public:
} }
}; };
void flatten(const std::vector<AST_stmt*>& roots, std::vector<AST*>& output, bool expand_scopes) { void flatten(const llvm::SmallVector<AST_stmt*, 4>& roots, std::vector<AST*>& output, bool expand_scopes) {
FlattenVisitor visitor(&output, expand_scopes); FlattenVisitor visitor(&output, expand_scopes);
for (int i = 0; i < roots.size(); i++) { for (int i = 0; i < roots.size(); i++) {
......
...@@ -1432,7 +1432,7 @@ public: ...@@ -1432,7 +1432,7 @@ public:
// Given an AST node, return a vector of the node plus all its descendents. // Given an AST node, return a vector of the node plus all its descendents.
// This is useful for analyses that care more about the constituent nodes than the // This is useful for analyses that care more about the constituent nodes than the
// exact tree structure; ex, finding all "global" directives. // exact tree structure; ex, finding all "global" directives.
void flatten(const std::vector<AST_stmt*>& roots, std::vector<AST*>& output, bool expand_scopes); void flatten(const llvm::SmallVector<AST_stmt*, 4>& roots, std::vector<AST*>& output, bool expand_scopes);
void flatten(AST_expr* root, std::vector<AST*>& output, bool expand_scopes); void flatten(AST_expr* root, std::vector<AST*>& output, bool expand_scopes);
// Similar to the flatten() function, but filters for a specific type of ast nodes: // Similar to the flatten() function, but filters for a specific type of ast nodes:
template <class T, class R> void findNodes(const R& roots, std::vector<T*>& output, bool expand_scopes) { template <class T, class R> void findNodes(const R& roots, std::vector<T*>& output, bool expand_scopes) {
......
...@@ -53,12 +53,12 @@ public: ...@@ -53,12 +53,12 @@ public:
// contains the address of the entry function // contains the address of the entry function
std::pair<CFGBlock*, Box*>(*entry_code)(void* interpeter, CFGBlock* block, Box** vregs); std::pair<CFGBlock*, Box*>(*entry_code)(void* interpeter, CFGBlock* block, Box** vregs);
std::vector<AST_stmt*> body; llvm::SmallVector<AST_stmt*, 4> body;
std::vector<CFGBlock*> predecessors, successors; llvm::SmallVector<CFGBlock*, 2> predecessors, successors;
int idx; // index in the CFG int idx; // index in the CFG
const char* info; const char* info;
typedef std::vector<AST_stmt*>::iterator iterator; typedef llvm::SmallVector<AST_stmt*, 4>::iterator iterator;
CFGBlock(CFG* cfg, int idx) : cfg(cfg), code(NULL), entry_code(NULL), idx(idx), info(NULL) {} CFGBlock(CFG* cfg, int idx) : cfg(cfg), code(NULL), entry_code(NULL), idx(idx), info(NULL) {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment