1 //===-- evm/bblock.h - a single basic block --*- C++ -*-===//
3 // A basic block contains a list of instructions.
5 //===----------------------------------------------------------------------===//
7 #ifndef _JITCS_INT_CFGANALYSIS_H_
8 #define _JITCS_INT_CFGANALYSIS_H_
10 #include "jitcs_base.h"
11 #include "jitcs_int_adt_array.h"
12 #include "jitcs_int_adt_bitmap.h"
13 #include "jitcs_adt_range.h"
14 #include "jitcs_int_bblock_impl.h"
28 CFGAnalysis(const CFGAnalysis
&) = delete;
29 CFGAnalysis
& operator=(const CFGAnalysis
&) = delete;
32 void init(FunctionImpl
& f
, AMode
);
34 void dump(IDumper
&) const;
36 bool checkIntegrity() const;
40 size_t getMaxBBlockDepth() const { return _maxDepth
; }
41 size_t getBlockCount() const { return _order
.size(); }
42 Ref
<BasicBlockImpl
> getOrderedBlock(size_t pos
) const { return _order
[pos
]; }
43 Ref
<const BasicBlockImpl
> cgetOrderedBlock(size_t pos
) const { return _order
[pos
]; }
44 size_t getDepth(Ref
<BasicBlockImpl
> bb
) const { return _bblocks
[bb
->id()].depth
; }
45 // size_t getOrder(BBlock* bb) const { return _bblocks[bb->id().id].order; }
53 size_t _calcDepth(size_t depth
, size_t headbb
,
54 BitmapRef handled
, BitmapRef candidates
,
55 ArrayRef
<size_t> worklist
, BitmapRef inworklist
);
58 ArrayRef
<BasicBlockImpl
*> _order
;
59 ArrayRef
<BBlockInfo
> _bblocks
;
63 } // end of namespace jitcs
66 // _JITCS_INT_CFGANALYSIS_H_