ADT
ast-experimental
enum
forall-pointer-decay
pthread-emulation
qualifiedEnum
|
Last change
on this file since 21fe17f was b8ab91a, checked in by Andrew Beach <ajbeach@…>, 4 years ago |
|
Fix Labels pass translated. This is fix label, mult-level exit and label generator.
|
-
Property mode
set to
100644
|
|
File size:
1.4 KB
|
| Line | |
|---|
| 1 | //
|
|---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
|
|---|
| 3 | //
|
|---|
| 4 | // The contents of this file are covered under the licence agreement in the
|
|---|
| 5 | // file "LICENCE" distributed with Cforall.
|
|---|
| 6 | //
|
|---|
| 7 | // LabelGenerator.h --
|
|---|
| 8 | //
|
|---|
| 9 | // Author : Rodolfo G. Esteves
|
|---|
| 10 | // Created On : Mon May 18 07:44:20 2015
|
|---|
| 11 | // Last Modified By : Andrew Beach
|
|---|
| 12 | // Last Modified On : Mon Nov 1 12:19:00 2021
|
|---|
| 13 | // Update Count : 7
|
|---|
| 14 | //
|
|---|
| 15 |
|
|---|
| 16 | #pragma once
|
|---|
| 17 |
|
|---|
| 18 | #include <string> // for string
|
|---|
| 19 |
|
|---|
| 20 | #include "SynTree/Label.h" // for Label
|
|---|
| 21 |
|
|---|
| 22 | class Statement;
|
|---|
| 23 | namespace ast {
|
|---|
| 24 | class Stmt;
|
|---|
| 25 | class Label;
|
|---|
| 26 | }
|
|---|
| 27 |
|
|---|
| 28 | namespace ControlStruct {
|
|---|
| 29 | class LabelGenerator {
|
|---|
| 30 | public:
|
|---|
| 31 | static LabelGenerator *getGenerator();
|
|---|
| 32 | Label newLabel(std::string suffix, Statement * stmt = nullptr);
|
|---|
| 33 | void reset() { current = 0; }
|
|---|
| 34 | void rewind() { current--; }
|
|---|
| 35 | protected:
|
|---|
| 36 | LabelGenerator(): current(0) {}
|
|---|
| 37 | private:
|
|---|
| 38 | int current;
|
|---|
| 39 | static LabelGenerator *labelGenerator;
|
|---|
| 40 | };
|
|---|
| 41 |
|
|---|
| 42 | class LabelGenerator_new {
|
|---|
| 43 | int current;
|
|---|
| 44 | static LabelGenerator_new *labelGenerator;
|
|---|
| 45 |
|
|---|
| 46 | LabelGenerator_new() : current(0) {}
|
|---|
| 47 | public:
|
|---|
| 48 | static LabelGenerator_new *getGenerator();
|
|---|
| 49 |
|
|---|
| 50 | ast::Label newLabel( const std::string& suffix, const ast::Stmt * stmt );
|
|---|
| 51 | void reset() { current = 0; }
|
|---|
| 52 | void rewind() { --current; }
|
|---|
| 53 | };
|
|---|
| 54 |
|
|---|
| 55 | } // namespace ControlStruct
|
|---|
| 56 |
|
|---|
| 57 | // Local Variables: //
|
|---|
| 58 | // tab-width: 4 //
|
|---|
| 59 | // mode: c++ //
|
|---|
| 60 | // compile-command: "make install" //
|
|---|
| 61 | // End: //
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.