Commit 45775cd8 authored by rmrf's avatar rmrf

Formatting should be consistent

parent 97dfc63f
This diff is collapsed.
#ifndef _AUTOMATA_H_
#define _AUTOMATA_H_
#include <vector>
#include <deque>
#include <map>
#include "clang/AST/DeclCXX.h"
#include "llvm/Support/raw_ostream.h"
#include "clang/Analysis/CFG.h"
#include "clang/Analysis/CFGStmtMap.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ParentMap.h"
#include "clang/AST/PrettyPrinter.h"
#include "clang/AST/Expr.h"
#include "clang/Analysis/CFG.h"
#include "clang/Analysis/CFGStmtMap.h"
#include "llvm/Support/raw_ostream.h"
#include <deque>
#include <map>
#include <stdio.h>
#include <vector>
namespace scpar {
using namespace clang;
using namespace std;
class Node {
public:
typedef pair < int, Node * >connectPairType;
typedef map < int, Node * >connectMapType;
using namespace clang;
using namespace std;
Node ( );
Node (int );
class Node {
public:
typedef pair<int, Node *> connectPairType;
typedef map<int, Node *> connectMapType;
void addSuccessor (Node * );
void addPredecessor (Node * );
Node();
Node(int);
vector < int >getSuccessors (int );
vector < int >getPredecessors (int );
int getId( );
void dump (raw_ostream &, int );
protected:
int _id;
connectMapType _preds;
connectMapType _succs;
};
class Edge {
public:
typedef pair < unsigned int, unsigned int >timePairType;
typedef vector < timePairType > timeAdvanceVectorType;
Edge (Node *, Node * );
Edge (Node *, Node *, int );
void updateSuspensionTime(timePairType );
int getId();
int getToId();
int getFromId();
timeAdvanceVectorType getTimeAdvanceVector();
void dump (raw_ostream &, int);
protected:
int _id;
timeAdvanceVectorType _timeAdvanceVector;
Node *_from;
Node *_to;
};
class Graph {
public:
typedef vector < int >nodeIDVector;
typedef vector < int >edgeIDVector;
typedef vector < Node * >nodeVector;
typedef vector < Edge * >edgeVector;
typedef map < int, Node * >nodeMapType;
typedef pair < int, Node * >nodePairType;
typedef map < int, Edge * >edgeMapType;
typedef pair < int, Edge * >edgePairType;
typedef pair < int, int >twoNodePairType;
typedef pair < twoNodePairType, Edge * >adjPairType;
typedef map < twoNodePairType, Edge * >adjMapType;
typedef pair < int, vector < Edge * > >adjEdgesPairType;
typedef map < int, vector < Edge * > >adjEdgesMapType;
Graph();
~Graph();
Node *addNode();
Node *addNode(int );
Edge *addEdge(Node *, Node * );
Edge *addEdge(int, int );
int getEdgeID(Edge * );
int getEdgeID (Node *, Node * );
int getEdgeID (int, int );
int getNodeID (Node * );
Edge *getEdge (Node *, Node * );
Edge *getEdge (int, int );
Node *getNode (int );
vector < Edge * >getEdgesFromSource (int );
vector < Edge * >getEdgesFromSource (Node * );
vector < Edge * >getEdgesFromDest (int );
vector < Edge * >getEdgesFromDest (Node * );
adjMapType returnAdjList();
nodeIDVector returnNodeIDs();
edgeIDVector returnEdgeIDs();
nodeVector returnNodes();
edgeVector returnEdges();
edgeVector returnEdgeVector();
nodeVector returnNodeVector();
void dump (raw_ostream &, int tabn = 0);
void dumpSauto (raw_ostream &, int tabn = 0);
protected:
adjMapType _adjList;
nodeMapType _nodeMap;
edgeMapType _edgeMap;
adjEdgesMapType _adjEdges;
int _nNodes;
int _nEdges;
nodeIDVector _nodeIDVector;
edgeIDVector _edgeIDVector;
nodeVector _nodeVector;
edgeVector _edgeVector;
};
}
void addSuccessor(Node *);
void addPredecessor(Node *);
vector<int> getSuccessors(int);
vector<int> getPredecessors(int);
int getId();
void dump(raw_ostream &, int);
protected:
int _id;
connectMapType _preds;
connectMapType _succs;
};
class Edge {
public:
typedef pair<unsigned int, unsigned int> timePairType;
typedef vector<timePairType> timeAdvanceVectorType;
Edge(Node *, Node *);
Edge(Node *, Node *, int);
void updateSuspensionTime(timePairType);
int getId();
int getToId();
int getFromId();
timeAdvanceVectorType getTimeAdvanceVector();
void dump(raw_ostream &, int);
protected:
int _id;
timeAdvanceVectorType _timeAdvanceVector;
Node *_from;
Node *_to;
};
class Graph {
public:
typedef vector<int> nodeIDVector;
typedef vector<int> edgeIDVector;
typedef vector<Node *> nodeVector;
typedef vector<Edge *> edgeVector;
typedef map<int, Node *> nodeMapType;
typedef pair<int, Node *> nodePairType;
typedef map<int, Edge *> edgeMapType;
typedef pair<int, Edge *> edgePairType;
typedef pair<int, int> twoNodePairType;
typedef pair<twoNodePairType, Edge *> adjPairType;
typedef map<twoNodePairType, Edge *> adjMapType;
typedef pair<int, vector<Edge *>> adjEdgesPairType;
typedef map<int, vector<Edge *>> adjEdgesMapType;
Graph();
~Graph();
Node *addNode();
Node *addNode(int);
Edge *addEdge(Node *, Node *);
Edge *addEdge(int, int);
int getEdgeID(Edge *);
int getEdgeID(Node *, Node *);
int getEdgeID(int, int);
int getNodeID(Node *);
Edge *getEdge(Node *, Node *);
Edge *getEdge(int, int);
Node *getNode(int);
vector<Edge *> getEdgesFromSource(int);
vector<Edge *> getEdgesFromSource(Node *);
vector<Edge *> getEdgesFromDest(int);
vector<Edge *> getEdgesFromDest(Node *);
adjMapType returnAdjList();
nodeIDVector returnNodeIDs();
edgeIDVector returnEdgeIDs();
nodeVector returnNodes();
edgeVector returnEdges();
edgeVector returnEdgeVector();
nodeVector returnNodeVector();
void dump(raw_ostream &, int tabn = 0);
void dumpSauto(raw_ostream &, int tabn = 0);
protected:
adjMapType _adjList;
nodeMapType _nodeMap;
edgeMapType _edgeMap;
adjEdgesMapType _adjEdges;
int _nNodes;
int _nEdges;
nodeIDVector _nodeIDVector;
edgeIDVector _edgeIDVector;
nodeVector _nodeVector;
edgeVector _edgeVector;
};
} // namespace scpar
#endif
This diff is collapsed.
//===-- src/EntryFunctionContainer.h - systec-clang class definition -------*- C++ -*-===//
//===-- src/EntryFunctionContainer.h - systec-clang class definition -------*-
//C++ -*-===//
//
// systemc-clang: SystemC Parser
//
......@@ -14,78 +15,80 @@
#ifndef _ENTRY_FUNCTION_CONTAINER_H_
#define _ENTRY_FUNCTION_CONTAINER_H_
#include <string>
#include <map>
#include "clang/AST/DeclCXX.h"
#include "WaitContainer.h"
#include "NotifyContainer.h"
#include "enums.h"
#include "FindWait.h"
#include "Utility.h"
#include "FindNotify.h"
#include "FindSensitivity.h"
#include "FindWait.h"
#include "NotifyContainer.h"
#include "SuspensionAutomata.h"
#include "Utility.h"
#include "WaitContainer.h"
#include "enums.h"
#include "clang/AST/DeclCXX.h"
#include <map>
#include <string>
namespace scpar {
using namespace clang;
using namespace std;
class EntryFunctionContainer {
public:
// typedefs
typedef vector < WaitContainer * >waitContainerListType;
typedef vector < NotifyContainer *> notifyContainerListType;
using namespace clang;
using namespace std;
typedef pair<int, SuspensionAutomata::transitionVectorType> instanceSautoPairType;
typedef map<int, SuspensionAutomata::transitionVectorType> instanceSautoMapType;
class EntryFunctionContainer {
public:
// typedefs
typedef vector<WaitContainer *> waitContainerListType;
typedef vector<NotifyContainer *> notifyContainerListType;
typedef pair <int, SuspensionAutomata::susCFGVectorType> instanceSusCFGPairType;
typedef map <int, SuspensionAutomata::susCFGVectorType> instanceSusCFGMapType;
typedef pair<int, SuspensionAutomata::transitionVectorType>
instanceSautoPairType;
typedef map<int, SuspensionAutomata::transitionVectorType>
instanceSautoMapType;
EntryFunctionContainer();
EntryFunctionContainer(string, PROCESS_TYPE, CXXMethodDecl *, Stmt *);
EntryFunctionContainer(const EntryFunctionContainer &);
~EntryFunctionContainer();
typedef pair<int, SuspensionAutomata::susCFGVectorType>
instanceSusCFGPairType;
typedef map<int, SuspensionAutomata::susCFGVectorType> instanceSusCFGMapType;
// Accessors.
string getName();
CXXMethodDecl *getEntryMethod();
//Stmt *getConstructorStmt ();
PROCESS_TYPE getProcessType();
EntryFunctionContainer();
EntryFunctionContainer(string, PROCESS_TYPE, CXXMethodDecl *, Stmt *);
EntryFunctionContainer(const EntryFunctionContainer &);
~EntryFunctionContainer();
waitContainerListType getWaitCalls();
notifyContainerListType getNotifyCalls();
FindSensitivity::senseMapType getSenseMap();
SuspensionAutomata::susCFGVectorType getSusCFG();
SuspensionAutomata::transitionVectorType getSusAuto();
instanceSautoMapType getInstanceSautoMap();
instanceSusCFGMapType getInstanceSusCFGMap();
// Accessors.
string getName();
CXXMethodDecl *getEntryMethod();
// Stmt *getConstructorStmt ();
PROCESS_TYPE getProcessType();
// Add waits.
void addSensitivityInfo(FindSensitivity &);
void addWaits (FindWait &);
void addNotifys(FindNotify &);
void addSusCFGAuto(SuspensionAutomata &);
//void setConstructorStmt (Stmt *);
void setName (string);
void setProcessType (PROCESS_TYPE);
void setEntryMethod (CXXMethodDecl *);
void dumpSusCFG(raw_ostream &);
void dumpSauto(raw_ostream &);
void dump (raw_ostream &, int);
waitContainerListType getWaitCalls();
notifyContainerListType getNotifyCalls();
FindSensitivity::senseMapType getSenseMap();
SuspensionAutomata::susCFGVectorType getSusCFG();
SuspensionAutomata::transitionVectorType getSusAuto();
instanceSautoMapType getInstanceSautoMap();
instanceSusCFGMapType getInstanceSusCFGMap();
// Add waits.
void addSensitivityInfo(FindSensitivity &);
void addWaits(FindWait &);
void addNotifys(FindNotify &);
void addSusCFGAuto(SuspensionAutomata &);
// void setConstructorStmt (Stmt *);
void setName(string);
void setProcessType(PROCESS_TYPE);
void setEntryMethod(CXXMethodDecl *);
void dumpSusCFG(raw_ostream &);
void dumpSauto(raw_ostream &);
void dump(raw_ostream &, int);
//private:
string _entryName;
PROCESS_TYPE _procType;
CXXMethodDecl *_entryMethodDecl;
// private:
string _entryName;
PROCESS_TYPE _procType;
CXXMethodDecl *_entryMethodDecl;
// Hold all the waits.
waitContainerListType _waitCalls;
notifyContainerListType _notifyCalls;
FindSensitivity::senseMapType _senseMap;
vector<Transition*> _susAuto;
vector<SusCFG*> _susCFG;
};
}
// Hold all the waits.
waitContainerListType _waitCalls;
notifyContainerListType _notifyCalls;
FindSensitivity::senseMapType _senseMap;
vector<Transition *> _susAuto;
vector<SusCFG *> _susCFG;
};
} // namespace scpar
#endif
#ifndef _ENTRY_FUNCTION_TYPE_H_
#define _ENTRY_FUNCTION_TYPE_H_
#include <iostream>
#include "clang/AST/DeclCXX.h"
#include "enums.h"
#include "clang/AST/DeclCXX.h"
#include <iostream>
namespace scpar {
using namespace clang;
using namespace std;
using namespace clang;
using namespace std;
class EntryFunctionType {
public:
EntryFunctionType (
);
EntryFunctionType (const EntryFunctionType &
);
class EntryFunctionType {
public:
EntryFunctionType();
EntryFunctionType(const EntryFunctionType &);
Stmt *getConstructorStmt (
) {
return _constructorStmt;
} CXXMethodDecl *getEntryMethod (
) {
return _entryMethodDecl;
} PROCESS_TYPE _procType;
string _entryName;
CXXMethodDecl *_entryMethodDecl;
Stmt *_constructorStmt;
};
}
Stmt *getConstructorStmt() { return _constructorStmt; }
CXXMethodDecl *getEntryMethod() { return _entryMethodDecl; }
PROCESS_TYPE _procType;
string _entryName;
CXXMethodDecl *_entryMethodDecl;
Stmt *_constructorStmt;
};
} // namespace scpar
#endif
......@@ -4,39 +4,28 @@ using namespace scpar;
using namespace std;
EventContainer::~EventContainer() {
// Do not delete the ast_node_.
// Clang should take care of that.
// Do not delete the ast_node_.
// Clang should take care of that.
}
EventContainer::EventContainer():
event_name_{"NONE"},
ast_node_{nullptr} {
EventContainer::EventContainer() : event_name_{"NONE"}, ast_node_{nullptr} {}
}
EventContainer::EventContainer( string pname, VarDecl * e ) :
event_name_{pname},
ast_node_{e} {
}
EventContainer::EventContainer(string pname, VarDecl *e)
: event_name_{pname}, ast_node_{e} {}
EventContainer::EventContainer( const EventContainer & from ) {
event_name_ = from.event_name_;
ast_node_ = from.ast_node_;
EventContainer::EventContainer(const EventContainer &from) {
event_name_ = from.event_name_;
ast_node_ = from.ast_node_;
}
string EventContainer::getEventName() const {
return event_name_;
}
string EventContainer::getEventName() const { return event_name_; }
VarDecl * EventContainer::getASTNode() const {
return ast_node_;
}
VarDecl *EventContainer::getASTNode() const { return ast_node_; }
void EventContainer::dump( llvm::raw_ostream & os, int tabn ) {
for (int i = 0; i < tabn; i++) {
os << " ";
void EventContainer::dump(llvm::raw_ostream &os, int tabn) {
for (int i = 0; i < tabn; i++) {
os << " ";
}
os << " EventContainer '" << event_name_ << "'\n";
os << " EventContainer '" << event_name_ << "'\n";
}
//===-- src/EventContainer.h - systec-clang class definition -------*- C++ -*-===//
//===-- src/EventContainer.h - systec-clang class definition -------*- C++
//-*-===//
//
// systemc-clang: SystemC Parser
//
......@@ -14,34 +15,34 @@
#ifndef _EVENT_CONTAINER_H_
#define _EVENT_CONTAINER_H_
#include <map>
#include <string>
#include "clang/AST/DeclCXX.h"
#include "llvm/Support/raw_ostream.h"
#include <map>
#include <string>
namespace scpar {
using namespace clang;
using namespace std;
using namespace clang;
using namespace std;
class EventContainer {
public:
EventContainer();
EventContainer( string, VarDecl * );
class EventContainer {
public:
EventContainer();
EventContainer(string, VarDecl *);
~EventContainer();
~EventContainer();
// Copy constructor.
EventContainer( const EventContainer & );
// Copy constructor.
EventContainer(const EventContainer &);
string getEventName() const;
VarDecl *getASTNode() const;
string getEventName() const;
VarDecl *getASTNode() const;
void dump ( llvm::raw_ostream & os, int tabn = 0 );
void dump(llvm::raw_ostream &os, int tabn = 0);
private:
// Name of port on which the binding happens.
string event_name_;
VarDecl *ast_node_;
};
}
private:
// Name of port on which the binding happens.
string event_name_;
VarDecl *ast_node_;
};
} // namespace scpar
#endif
#include <string>
#include "EventDecl.h"
#include "FindTemplateTypes.h"
#include <string>
using namespace scpar;
using namespace std;
EventDecl::~EventDecl() {
// _astNode does *NOT* need to be deleted because clang should
// be responsible for freeing the memory.
// _astNode does *NOT* need to be deleted because clang should
// be responsible for freeing the memory.
}
EventDecl::EventDecl() :
_name{"NONE"},
_astNode{nullptr} {
}
EventDecl::EventDecl() : _name{"NONE"}, _astNode{nullptr} {}
EventDecl::EventDecl( const string & name, FieldDecl * fd ) :
_name{name},
_astNode{fd} {
}
EventDecl::EventDecl(const string &name, FieldDecl *fd)
: _name{name}, _astNode{fd} {}
EventDecl::EventDecl( const EventDecl & from ) {
_name = from._name;
_astNode = from._astNode;
EventDecl::EventDecl(const EventDecl &from) {
_name = from._name;
_astNode = from._astNode;
}
void EventDecl::ptrCheck() {
assert( _astNode != nullptr );
}
void EventDecl::ptrCheck() { assert(_astNode != nullptr); }
string EventDecl::getName() {
return _name;
}
string EventDecl::getName() { return _name; }
FieldDecl *EventDecl::getASTNode() {
ptrCheck();
return _astNode;
ptrCheck();
return _astNode;
}
void EventDecl::dump( llvm::raw_ostream & os, int tabn ) {
ptrCheck();
Utility u;
void EventDecl::dump(llvm::raw_ostream &os, int tabn) {
ptrCheck();
Utility u;
u.tabit (os, tabn);
//for (int i=0; i < tabn; i++) {
// os << " ";
// }
os << "EventDecl " << this << " '" << _name << "' FieldDecl "
<< getASTNode();
u.tabit(os, tabn);
// for (int i=0; i < tabn; i++) {
// os << " ";
// }
os << "EventDecl " << this << " '" << _name << "' FieldDecl " << getASTNode();
}
#ifndef _EVENT_DECL_H_
#define _EVENT_DECL_H_
#include "Utility.h"
#include "clang/AST/DeclCXX.h"
#include <string>
#include <map>
#include "Utility.h"
#include <string>
namespace scpar {
using namespace clang;
using namespace std;
class EventDecl {
public:
// Typedefs.
// typedef pair < string, FieldDecl * >eventPairType;
// typedef map < string, FieldDecl * >eventMapType;
// Constructors.
EventDecl();
EventDecl( const string &, FieldDecl * );
// Copy constructor.
EventDecl( const EventDecl & );
// Destructor.
~EventDecl();
/// Get parameters
string getName();
FieldDecl *getASTNode();
// Print
void dump (raw_ostream &, int tabn = 0);
private:
void ptrCheck();
private:
string _name;
FieldDecl *_astNode;
};
}
using namespace clang;
using namespace std;
class EventDecl {
public:
// Typedefs.
// typedef pair < string, FieldDecl * >eventPairType;
// typedef map < string, FieldDecl * >eventMapType;