Otawa  0.10
SeqAST.h
Go to the documentation of this file.
1 /*
2  * SeqAST 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_SEQ_AST_H
22 #define OTAWA_AST_SEQ_AST_H
23 
24 #include <otawa/ast/AST.h>
25 
26 namespace otawa { namespace ast {
27 
28 // SeqAST class
29 class SeqAST: public AST {
30  AST *c1, *c2;
31 protected:
32  virtual ~SeqAST(void);
33 public:
35  inline AST *child1(void) const { return c1; };
36  inline AST *child2(void) const { return c2; };
37 
38  // AST overload
39  virtual Inst *first(void);
40  virtual ast_kind_t kind(void) const { return AST_Seq; };
41  virtual SeqAST *toSeq(void) { return this; };
42  virtual int countInstructions(void) const;
43 };
44 
45 } } // otawa::ast
46 
47 #endif // OTAWA_AST_SEQ_AST_H
virtual SeqAST * toSeq(void)
Get the sequence AST if this AST is a sequence, null else.
Definition: SeqAST.h:41
virtual int countInstructions(void) const
Count the number of instructions in the ast block.
Definition: SeqAST.cpp:78
virtual Inst * first(void)
Definition: SeqAST.cpp:68
AST * c1
Definition: SeqAST.h:30
virtual ~SeqAST(void)
Definition: SeqAST.cpp:46
SeqAST(AST *child1, AST *child2)
Build a new sequence with the given children.
Definition: SeqAST.cpp:39
Definition: AST.h:45
AST * c2
Definition: SeqAST.h:30
virtual ast_kind_t kind(void) const
Get the kind of the AST.
Definition: SeqAST.h:40
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 * child1(void) const
Get the first child AST of the sequence.
Definition: SeqAST.h:35
This AST represents sequences.
Definition: SeqAST.h:29
ast_kind_t
Definition: AST.h:40
AST * child2(void) const
Get the second child AST of the sequence.
Definition: SeqAST.h:36