Otawa  0.10
SymAddress.h
Go to the documentation of this file.
1 /*
2  * util::SymAddress interface
3  *
4  * This file is part of OTAWA
5  * Copyright (c) 2015, 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
20  * 02110-1301 USA
21  */
22 #ifndef OTAWA_UTIL_SYMADDRESS_H_
23 #define OTAWA_UTIL_SYMADDRESS_H_
24 
25 #include <elm/io.h>
26 #include <otawa/base.h>
27 #include <otawa/prog/WorkSpace.h>
28 
29 namespace otawa {
30 
31 using namespace elm;
32 class CFG;
33 
34 class SymAddress {
35 public:
36  static SymAddress *parse(string str) throw(otawa::Exception);
37  virtual ~SymAddress(void);
38  virtual Address toAddress(WorkSpace *ws) = 0;
39  virtual CFG *cfg(WorkSpace *ws) = 0;
40  virtual void print(io::Output& out) = 0;
41 };
42 
43 class AbsoluteAddress: public SymAddress {
44 public:
46  virtual Address toAddress(WorkSpace *ws);
47  virtual CFG *cfg(WorkSpace *ws);
48  virtual void print(io::Output& out);
49 private:
51 };
52 
53 class LabelAddress: public SymAddress {
54 public:
55  LabelAddress(string label, t::int32 offset = 0);
56  virtual Address toAddress(WorkSpace *ws);
57  virtual CFG *cfg(WorkSpace *ws);
58  virtual void print(io::Output& out);
59 private:
60  string _label;
62 };
63 
65  addr->print(out);
66  return out;
67 }
68 
69 } //otawa
70 
71 #endif /* OTAWA_UTIL_SYMADDRESS_H_ */
string _label
Definition: SymAddress.h:60
virtual void print(io::Output &out)=0
Print the symbolic address.
int32_t int32
t::int32 _offset
Definition: SymAddress.h:61
elm::io::Output & operator<<(elm::io::Output &out, Address addr)
Definition: base.cpp:188
Control Flow Graph representation.
Definition: CFG.h:42
uint32 offset
Abstraction of a program address that may be expressed using several ways: absolute address...
Definition: SymAddress.h:34
Symbolic address as an absolute address.
Definition: SymAddress.h:43
A workspace represents a program, its run-time and all information about WCET computation or any othe...
Definition: WorkSpace.h:67
The representation of an address in OTAWA.
Definition: base.h:54
sys::SystemOutStream & out
A label address formed by a label and a possible signed offset.
Definition: SymAddress.h:53
dtd::Element cfg(dtd::make("cfg", _CFG).attr(id).content((entry,*bb, exit,*edge)))
Address _addr
Definition: SymAddress.h:50