from work
This commit is contained in:
@@ -2,12 +2,16 @@
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <llvm/ADT/ilist.h>
|
||||
#include <llvm/ADT/ilist_node.h>
|
||||
#include "types.h"
|
||||
#include "graph.h"
|
||||
/* Basic block (BB) node definition */
|
||||
struct Function;
|
||||
class CIcodeRec;
|
||||
struct BB;
|
||||
struct interval;
|
||||
struct ICODE;
|
||||
typedef union
|
||||
{
|
||||
dword ip; /* Out edge icode address */
|
||||
@@ -15,13 +19,13 @@ typedef union
|
||||
interval *intPtr; /* Out edge ptr to next interval*/
|
||||
} TYPEADR_TYPE;
|
||||
|
||||
struct BB
|
||||
struct BB : public llvm::ilist_node<BB>
|
||||
{
|
||||
protected:
|
||||
private:
|
||||
BB(const BB&);
|
||||
BB() : nodeType(0),traversed(0),start(0),length(0),
|
||||
numHlIcodes(0),flg(0),
|
||||
numInEdges(0),inEdges(0),
|
||||
inEdges(0),
|
||||
numOutEdges(0),edges(0),beenOnH(0),inEdgeCount(0),reachingInt(0),
|
||||
inInterval(0),correspInt(0),liveUse(0),def(0),liveIn(0),liveOut(0),
|
||||
dfsFirstNum(0),dfsLastNum(0),immedDom(0),ifFollow(0),loopType(0),latchNode(0),
|
||||
@@ -29,17 +33,25 @@ protected:
|
||||
{
|
||||
|
||||
}
|
||||
//friend class SymbolTableListTraits<BB, Function>;
|
||||
//Int numInEdges; /* Number of in edges */
|
||||
|
||||
public:
|
||||
Int begin();
|
||||
Int end();
|
||||
Int rbegin();
|
||||
Int rend();
|
||||
ICODE &front();
|
||||
ICODE &back();
|
||||
size_t size();
|
||||
byte nodeType; /* Type of node */
|
||||
Int traversed; /* Boolean: traversed yet? */
|
||||
int traversed; /* Boolean: traversed yet? */
|
||||
Int start; /* First instruction offset */
|
||||
Int length; /* No. of instructions this BB */
|
||||
Int numHlIcodes; /* No. of high-level icodes */
|
||||
flags32 flg; /* BB flags */
|
||||
|
||||
|
||||
/* In edges and out edges */
|
||||
Int numInEdges; /* Number of in edges */
|
||||
std::vector<BB *> inEdges; // does not own held pointers
|
||||
|
||||
Int numOutEdges; /* Number of out edges */
|
||||
@@ -81,8 +93,17 @@ public:
|
||||
Int index; /* Index, used in several ways */
|
||||
static BB *Create(void *ctx=0,const std::string &s="",Function *parent=0,BB *insertBefore=0);
|
||||
static BB *Create(Int start, Int ip, byte nodeType, Int numOutEdges, Function * parent);
|
||||
void writeCode(Int indLevel, Function *pProc, Int *numLoc, Int latchNode, Int ifFollow);
|
||||
void mergeFallThrough(CIcodeRec &Icode);
|
||||
void dfsNumbering(std::vector<BB *> &dfsLast, Int *first, Int *last);
|
||||
void displayDfs();
|
||||
void writeCode(Int indLevel, Function *pProc, Int *numLoc, Int latchNode, Int ifFollow);
|
||||
void mergeFallThrough(CIcodeRec &Icode);
|
||||
void dfsNumbering(std::vector<BB *> &dfsLast, Int *first, Int *last);
|
||||
void displayDfs();
|
||||
void display();
|
||||
/// getParent - Return the enclosing method, or null if none
|
||||
///
|
||||
const Function *getParent() const { return Parent; }
|
||||
Function *getParent() { return Parent; }
|
||||
void writeBB(ICODE *hli, Int lev, Function *pProc, Int *numLoc);
|
||||
private:
|
||||
Function *Parent;
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user