Otawa  0.10
ForAST.h
Go to the documentation of this file.
1 /*
2  * ForAST class interface
3  *
4  * This file is part of OTAWA
5  * Copyright (c) 2003, IRIT UPS.
6  *
7  * OTAWA is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * OTAWA is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with OTAWA; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 #ifndef OTAWA_AST_FOR_AST_H
22 #define OTAWA_AST_FOR_AST_H
23 
24 #include <otawa/ast/AST.h>
25 
26 namespace otawa { namespace ast {
27 
28 // ForAST class
29 class ForAST: public AST {
30  AST *bod, *cnd, *init, *inc;
31 protected:
32  virtual ~ForAST(void);
33 public:
35  inline AST *initialization(void) const { return init; };
36  inline AST *condition(void) const { return cnd; };
37  inline AST *incrementation(void) const { return inc; };
38  inline AST *body(void) const { return bod; };
39 
40  // AST overload
41  virtual Inst *first(void);
42  virtual ast_kind_t kind(void) const { return AST_For; };
43  virtual ForAST *toFor(void) { return this; };
44  virtual int countInstructions(void) const;
45 };
46 
47 } } // otawa::ast
48 
49 #endif // OTAWA_AST_FOR_H
virtual Inst * first(void)
Definition: ForAST.cpp:84
AST * inc
Definition: ForAST.h:30
Representation of C language FOR loop.
Definition: ForAST.h:29
AST * bod
Definition: ForAST.h:30
virtual ForAST * toFor(void)
Get the repetition AST if this AST is a repetition, null else.
Definition: ForAST.h:43
AST * init
Definition: ForAST.h:30
AST * incrementation(void) const
Get the incrementation AST.
Definition: ForAST.h:37
AST * condition(void) const
Get the condition AST.
Definition: ForAST.h:36
virtual int countInstructions(void) const
Count the number of instructions in the ast block.
Definition: ForAST.cpp:95
Definition: AST.h:49
ForAST(AST *initialization, AST *condition, AST *incrementation, AST *body)
Build a new FOR AST.
Definition: ForAST.cpp:37
AST * body(void) const
Get the body AST.
Definition: ForAST.h:38
virtual ~ForAST(void)
Definition: ForAST.cpp:46
This is the base class for the representation of programs as Abstract Syntax Trees.
Definition: AST.h:53
This class represents assembly instruction of a piece of code.
Definition: Inst.h:62
AST * cnd
Definition: ForAST.h:30
virtual ast_kind_t kind(void) const
Get the kind of the AST.
Definition: ForAST.h:42
ast_kind_t
Definition: AST.h:40
AST * initialization(void) const
Get the initialization AST.
Definition: ForAST.h:35