Otawa  0.10
BlockAST.h
Go to the documentation of this file.
1 /*
2  * ASTLoader 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_BLOCK_AST_H
22 #define OTAWA_AST_BLOCK_AST_H
23 
24 #include <otawa/ast/AST.h>
25 #include <otawa/instruction.h>
26 
27 namespace otawa { namespace ast {
28 
29 // BlockAST class
30 class BlockAST: public AST {
33 protected:
34  virtual ~BlockAST(void);
35 public:
38  inline Inst *block(void) const { return _block; };
39  inline t::uint32 size(void) const { return _size; };
40 
41  // AST overload
42  virtual Inst *first(void) { return _block; };
43  virtual ast_kind_t kind(void) const { return AST_Block; };
44  virtual BlockAST *toBlock(void) { return this; };
45  virtual int countInstructions(void) const;
46 };
47 
48 } } // otawa::ast
49 
50 #endif // OTAWA_AST_BLOCK_AST_H
Definition: AST.h:43
Inst * _block
Definition: BlockAST.h:31
virtual ast_kind_t kind(void) const
Get the kind of the AST.
Definition: BlockAST.h:43
t::uint32 _size
Definition: BlockAST.h:32
virtual BlockAST * toBlock(void)
Get the block AST if this AST is a block, null else.
Definition: BlockAST.h:44
uint32 size
Inst * block(void) const
Get the entry basic block of the AST block.
Definition: BlockAST.h:38
t::uint32 size(void) const
Definition: BlockAST.h:39
static Identifier< AST * > ID
The property matching the given identifier is put on the first instruction of the AST...
Definition: BlockAST.h:36
virtual int countInstructions(void) const
Count the number of instructions in the ast block.
Definition: BlockAST.cpp:88
virtual Inst * first(void)
Get the first instruction of the block.
Definition: BlockAST.h:42
BlockAST(Inst *block, t::uint32 size)
Build a new block AST.
Definition: BlockAST.cpp:46
This class represents the leafs of the AST.
Definition: BlockAST.h:30
This class represents identifier with a typed associated value.
Definition: Identifier.h:51
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
virtual ~BlockAST(void)
Destroy the block AST, cleaning properties put on basic block and basic block head.
Definition: BlockAST.cpp:56
ast_kind_t
Definition: AST.h:40
uint32_t uint32