root/trunk/rphp/include/rphp/analysis/pPassManager.h @ 1034

Revision 1034, 1.6 KB (checked in by corni, 7 months ago)

Replace the friend-relationship between stmt and CheckMemoryManagement?.
Auto-add CheckMemoryManagement? in debug builds after each pass.
Add a pass for return; => return NULL; transformations
Add a cli argument to rphp-analyzer (--lower) which runs all existing passes in a well-defined order.
pPassManager shouldn't have a copy constructor (per comment) so remove the existing empty.
Document which phc pass has been implemented in which corresponding rphp pass.

Line 
1/* ***** BEGIN LICENSE BLOCK *****
2;; Roadsend PHP Compiler
3;;
4;; Copyright (c) 2009 Shannon Weyrick <weyrick@roadsend.com>
5;;
6;; This program is free software; you can redistribute it and/or
7;; modify it under the terms of the GNU General Public License
8;; as published by the Free Software Foundation; either version 2
9;; of the License, or (at your option) any later version.
10;;
11;; This program is distributed in the hope that it will be useful,
12;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14;; GNU General Public License for more details.
15;;
16;; You should have received a copy of the GNU General Public License
17;; along with this program; if not, write to the Free Software
18;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
19   ***** END LICENSE BLOCK *****
20*/
21
22#ifndef RPHP_PPASSMANAGER_H_
23#define RPHP_PPASSMANAGER_H_
24
25#include <vector>
26
27namespace rphp {
28
29class pSourceModule;
30
31namespace AST {
32class pPass;
33}
34
35class pPassManager {
36public:
37    typedef std::vector<AST::pPass*> queueType;
38
39private:
40
41    queueType passQueue_;
42    pSourceModule* module_;
43
44    // no copy constructor
45    pPassManager(const pPassManager&);
46
47public:
48
49    pPassManager(pSourceModule* m): passQueue_(), module_(m) { }
50    ~pPassManager(void);
51
52    /// add a pass. takes ownership.
53    void addPass(AST::pPass* p);
54
55    template <typename PassType>
56    void addPass(void) {
57        PassType* P = new PassType(module_);
58        addPass(P);
59    }
60
61    void run(void);
62
63};
64
65} // namespace
66
67#endif /* RPHP_PPASSMANAGER_H_ */
Note: See TracBrowser for help on using the browser.