Otawa  0.10
ASTInfo.h
Go to the documentation of this file.
1 /*
2  * ASTInfo class interface
3  *
4  * This file is part of OTAWA
5  * Copyright (c) 2003-08, 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_AST_INFO_H
22 #define OTAWA_AST_AST_INFO_H
23 
24 #include <elm/genstruct/HashTable.h>
25 #include <elm/genstruct/Vector.h>
26 #include <otawa/ast/FunAST.h>
27 
28 // Extern
29 int heptane_parse(void);
30 
31 namespace otawa { namespace ast {
32 
33 // ASTInfo class
34 class ASTInfo: public PropList {
35 public:
36  ~ASTInfo(void);
37  static ASTInfo *getInfo(WorkSpace *ws);
39 
40  class Iterator: public elm::genstruct::Vector<FunAST *>::Iterator {
41  public:
42  inline Iterator(ASTInfo *info): elm::genstruct::Vector<FunAST *>::Iterator(info->funs) { }
43  };
44 
45  void add(FunAST *fun);
46  inline Option<FunAST *> get(const string& name) { return _map.get(name); }
47 
48 private:
49  friend class CallAST;
50  friend class FunAST;
51  friend class GenericProperty<ASTInfo *>;
52  friend int ::heptane_parse(void);
55  ASTInfo(WorkSpace *ws);
56 };
57 
58 } } // otawa::ast
59 
60 #endif // OTAWA_AST_AST_INFO_H
struct otawa::sem::inst inst
This class represents functions in the AST representation.
Definition: FunAST.h:32
int heptane_parse(void)
~ASTInfo(void)
Definition: ASTInfo.cpp:134
This class is a specialized block AST ended by a function call.
Definition: CallAST.h:30
This generic class allows attaching any type of data to a property.
Definition: Property.h:20
Definition: ASTInfo.h:40
FunAST * getFunction(Inst *inst)
Find the function at the given instruction.
Definition: ASTInfo.cpp:100
elm::genstruct::HashTable< String, FunAST * > _map
Definition: ASTInfo.h:54
elm::genstruct::Vector< FunAST * > funs
Definition: ASTInfo.h:53
A workspace represents a program, its run-time and all information about WCET computation or any othe...
Definition: WorkSpace.h:67
This class stores all the function known for the current framework.
Definition: ASTInfo.h:34
void add(FunAST *fun)
Add a function to the AST information.
Definition: ASTInfo.cpp:76
ASTInfo(WorkSpace *ws)
Build an new AST info linked to the given framework.
Definition: ASTInfo.cpp:54
Iterator(ASTInfo *info)
Definition: ASTInfo.h:42
cstring name
Definition: odisasm.cpp:107
static ASTInfo * getInfo(WorkSpace *ws)
Find or create the AST information attached to the given process.
Definition: ASTInfo.cpp:120
This class represents assembly instruction of a piece of code.
Definition: Inst.h:62
This a list of properties.
Definition: PropList.h:63