| 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 | |
|---|
| 27 | namespace rphp { |
|---|
| 28 | |
|---|
| 29 | class pSourceModule; |
|---|
| 30 | |
|---|
| 31 | namespace AST { |
|---|
| 32 | class pPass; |
|---|
| 33 | } |
|---|
| 34 | |
|---|
| 35 | class pPassManager { |
|---|
| 36 | public: |
|---|
| 37 | typedef std::vector<AST::pPass*> queueType; |
|---|
| 38 | |
|---|
| 39 | private: |
|---|
| 40 | |
|---|
| 41 | queueType passQueue_; |
|---|
| 42 | pSourceModule* module_; |
|---|
| 43 | |
|---|
| 44 | // no copy constructor |
|---|
| 45 | pPassManager(const pPassManager&); |
|---|
| 46 | |
|---|
| 47 | public: |
|---|
| 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_ */ |
|---|