Otawa  0.10
DelayedBuilder.h
Go to the documentation of this file.
1 /*
2  * $Id$
3  * DelayedBuilder
4  *
5  * This file is part of OTAWA
6  * Copyright (c) 2008, IRIT UPS.
7  *
8  * OTAWA is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * OTAWA is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with OTAWA; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 #ifndef OTAWA_DELAYEDBUILDER_H_
23 #define OTAWA_DELAYEDBUILDER_H_
24 
25 #include <elm/genstruct/SLList.h>
27 #include <otawa/cfg/Edge.h>
28 #include <otawa/cfg/features.h>
29 
30 namespace otawa {
31 
32 class DelayedCleaner;
33 class Inst;
34 class Process;
35 class VirtualCFG;
36 
38 public:
40  DelayedBuilder(void);
41 
42 protected:
43  virtual void setup(WorkSpace *ws);
44  virtual void processWorkSpace(WorkSpace *ws);
45  virtual void processCFG(WorkSpace *ws, CFG *cfg);
46  virtual void cleanup(WorkSpace *ws);
47 
48 private:
50  void fix(Edge *oedge, Edge *nedge);
52  void insert(Edge *edge, BasicBlock *ibb);
53  BasicBlock *makeBB(Inst *inst, int n = 1);
54  BasicBlock *makeNOp(Inst *inst, int n = 1);
55  void buildBB(CFG *cfg);
56  void buildEdges(CFG *cfg);
58  int count(Inst *inst);
59  ot::size size(Inst *inst, int n = 1);
60  Inst *next(Inst *inst, int n = 1);
62  void mark(CFG *cfg);
63 
65  DelayedCleaner *cleaner;
70 };
71 
72 } // otawa
73 
74 
75 #endif /* OTAWA_DELAYEDBUILDER_H_ */
struct otawa::sem::inst inst
dtd::RefAttr< BasicBlock * > source("source", dtd::STRICT|dtd::REQUIRED)
CFG * cfg(void) const
Get the current CFG.
Definition: CFGProcessor.h:56
dtd::Element edge(dtd::make("edge", _EDGE).attr(source).attr(target).attr(called))
BasicBlock * makeNOp(Inst *inst, int n=1)
Build a block made of NOPs matching the given instructions.
Definition: cfg_DelayedBuilder.cpp:142
virtual void setup(WorkSpace *ws)
This method is called before an anlysis to let the processor do some initialization.
Definition: cfg_DelayedBuilder.cpp:217
kind_t
Kind of the edge.
Definition: Edge.h:36
Definition: Registration.h:138
void buildEdges(CFG *cfg)
Build the edges.
Definition: cfg_DelayedBuilder.cpp:499
void insert(Edge *edge, BasicBlock *ibb)
Insert a basic block into an edge.
Definition: cfg_DelayedBuilder.cpp:381
DelayedInfo * info
Definition: DelayedBuilder.h:69
DelayedBuilder(void)
Definition: cfg_DelayedBuilder.cpp:211
virtual void processCFG(WorkSpace *ws, CFG *cfg)
Definition: cfg_DelayedBuilder.cpp:572
virtual void processWorkSpace(WorkSpace *ws)
Process the given framework.
Definition: cfg_DelayedBuilder.cpp:278
void cloneEdge(Edge *edge, BasicBlock *source, Edge::kind_t kind)
Clone an existing edge.
Definition: cfg_DelayedBuilder.cpp:351
WorkSpace * ws
Definition: Processor.h:185
Inst * next(Inst *inst, int n=1)
Get the instruction following the n next instruction.
Definition: cfg_DelayedBuilder.cpp:635
Control Flow Graph representation.
Definition: CFG.h:42
Inst::kind_t kind
Definition: odisasm.cpp:106
delayed_t
Enumeration giving the type of delayed modes used by control instruction.
Definition: features.h:30
t::uint32 size
Definition: base.h:46
delayed_t type(Inst *inst)
Define the type of delayed branch.
Definition: cfg_DelayedBuilder.cpp:586
A workspace represents a program, its run-time and all information about WCET computation or any othe...
Definition: WorkSpace.h:67
virtual void cleanup(WorkSpace *ws)
This method is called after the end of the processor analysis to let it do some clean up...
Definition: cfg_DelayedBuilder.cpp:235
Contains a collection of CFGs (used with INVOLVED_CFGS property).
Definition: features.h:45
BasicBlock * makeBB(Inst *inst, int n=1)
Build a single BB containing the instruction following the given instruction.
Definition: cfg_DelayedBuilder.cpp:128
map_t map
Definition: DelayedBuilder.h:67
This is a specialization of the processor class dedicated to CFG processing.
Definition: CFGProcessor.h:35
genstruct::HashTable< CFG *, VirtualCFG * > cfg_map
Definition: DelayedBuilder.h:66
VirtualCFG * vcfg
Definition: DelayedBuilder.h:68
Edge * makeEdge(BasicBlock *src, BasicBlock *tgt, Edge::kind_t kind)
Build a new virtual edge.
Definition: cfg_DelayedBuilder.cpp:655
A virtual CFG is a CFG not-mapped to real code, that is, it may contains virtual nodes for inlining f...
Definition: VirtualCFG.h:29
DelayedCleaner * cleaner
Definition: DelayedBuilder.h:65
This class represents edges in the CFG representation.
Definition: Edge.h:33
This is the minimal definition of a basic block.
Definition: BasicBlock.h:43
static Registration< DelayedBuilder > reg
Definition: DelayedBuilder.h:39
This class represents assembly instruction of a piece of code.
Definition: Inst.h:62
void buildBB(CFG *cfg)
Build the BB.
Definition: cfg_DelayedBuilder.cpp:418
int count(Inst *inst)
Define the count of instructions before the given delayed branch be effective.
Definition: cfg_DelayedBuilder.cpp:599
void fix(Edge *oedge, Edge *nedge)
Definition: cfg_DelayedBuilder.cpp:308
CFGCollection * coll
Definition: DelayedBuilder.h:64
void mark(CFG *cfg)
Mark the instructions with actions.
Definition: cfg_DelayedBuilder.cpp:255
ot::size size(Inst *inst, int n=1)
Compute the size of the delayed instruction.
Definition: cfg_DelayedBuilder.cpp:613
genstruct::HashTable< BasicBlock *, BasicBlock * > map_t
Definition: DelayedBuilder.h:49
This processor handle the delayed branch information provided by otawa::DELAYED_FEATURE to transform ...
Definition: DelayedBuilder.h:37
Provide information on delayed branches.
Definition: features.h:37