Commit d571755e authored by rmrf's avatar rmrf
Browse files

Remove additional warnings.

Cleaning up additional warnings.
parent 27d33dbd
......@@ -25,8 +25,8 @@ namespace scpar {
void dump();
private:
CXXRecordDecl * _d;
llvm::raw_ostream & _os;
CXXRecordDecl * _d;
Stmt *_constructorStmt;
int pass;
......
......@@ -15,11 +15,11 @@ namespace scpar {
class FindGlobalEvents:public RecursiveASTVisitor < FindGlobalEvents > {
public:
typedef map < string, VarDecl * >globalEventMapType;
typedef pair < string, VarDecl * >kvType;
typedef map < string, VarDecl * > globalEventMapType;
typedef pair < string, VarDecl * > kvType;
FindGlobalEvents(TranslationUnitDecl *, llvm::raw_ostream &);
~FindGlobalEvents();
virtual ~FindGlobalEvents();
virtual bool VisitVarDecl(VarDecl *);
......
......@@ -9,17 +9,18 @@ namespace scpar {
using namespace clang;
using namespace std;
class FindNetlist:public RecursiveASTVisitor < FindNetlist > {
class FindNetlist : public RecursiveASTVisitor < FindNetlist > {
public:
// Removed Model::moduleMapType from constructor
// Have to think of a way to include building
// netlist from module constructors. Right now I am not
// doing it.
FindNetlist (FunctionDecl *);
FindNetlist (const FindNetlist &);
~FindNetlist ();
FindNetlist(FunctionDecl *);
FindNetlist(const FindNetlist &);
virtual ~FindNetlist();
public:
typedef pair <string, string> instanceModulePairType;
typedef map <string, string> instanceModuleMapType;
......@@ -39,13 +40,12 @@ namespace scpar {
instanceModuleMapType getInstanceModuleMap();
instancePortSignalMapType getInstancePortSignalMap();
instanceListModuleMapType getInstanceListModuleMap();
portSignalMapType getPortSignalMap();
portSignalMapType getPortSignalMap();
int getNumInstances(string);
void dump ();
private:
int _pass;
int _pass;
instanceModuleMapType _instanceModuleMap;
portSignalMapType _portSignalMap;
instancePortSignalMapType _instancePortSignalMap;
......
......@@ -4,7 +4,7 @@ using namespace scpar;
FindSCMain::FindSCMain (TranslationUnitDecl * tuDecl, llvm::raw_ostream & os):
_os (os),
_scmainFunctionDecl(nullptr) {
assert (!(tuDecl == NULL));
assert (!(tuDecl == nullptr));
TraverseDecl (tuDecl);
}
......@@ -12,7 +12,7 @@ FindSCMain::~FindSCMain() {
_scmainFunctionDecl = nullptr;
}
bool FindSCMain::VisitFunctionDecl (FunctionDecl * fdecl) {
bool FindSCMain::VisitFunctionDecl(FunctionDecl *fdecl) {
//_os << "Print the name: " << fdecl->getNameInfo().getAsString() << "has body: " << fdecl->hasBody() << "\n";
// _os << "Is first declaration: " << fdecl->isFirstDeclaration() << "\n";
......@@ -23,8 +23,7 @@ bool FindSCMain::VisitFunctionDecl (FunctionDecl * fdecl) {
/// 2. Must have a body
/// 3. Must *not* be a first declaration. (This is becuase systemc.h includes a null definition of sc_main.
if ((fdecl->getNameInfo ().getAsString () != "sc_main")
|| (!fdecl->hasBody ()) || (fdecl->isMain ()))
{
|| (!fdecl->hasBody ()) || (fdecl->isMain ())) {
return true;
}
......@@ -36,11 +35,11 @@ bool FindSCMain::VisitFunctionDecl (FunctionDecl * fdecl) {
}
FunctionDecl *FindSCMain::getSCMainFunctionDecl() {
assert (!(_scmainFunctionDecl == NULL));
assert (!(_scmainFunctionDecl == nullptr));
return _scmainFunctionDecl;
}
bool FindSCMain::isSCMainFound () {
return (_scmainFunctionDecl != NULL);
bool FindSCMain::isSCMainFound() {
return (_scmainFunctionDecl != nullptr);
}
......@@ -16,8 +16,8 @@ namespace scpar {
class FindSensitivity : public RecursiveASTVisitor < FindSensitivity > {
public:
typedef map < string, MemberExpr * >senseMapType;
typedef pair < string, MemberExpr * >kvType;
typedef map < string, MemberExpr * > senseMapType;
typedef pair < string, MemberExpr * > kvType;
FindSensitivity(Stmt *d, llvm::raw_ostream &os);
virtual ~FindSensitivity();
......
......@@ -59,8 +59,8 @@ namespace scpar {
class FindSignals : public RecursiveASTVisitor < FindSignals > {
public:
/// typedefs
typedef pair < string, SignalContainer * >signalPairType;
typedef map < string, SignalContainer * >signalMapType;
typedef pair < string, SignalContainer* > signalPairType;
typedef map < string, SignalContainer * > signalMapType;
FindSignals(CXXRecordDecl *, llvm::raw_ostream & );
virtual ~FindSignals();
......@@ -68,8 +68,8 @@ namespace scpar {
virtual bool VisitFieldDecl (FieldDecl *);
// virtual bool VisitMemberExpr(MemberExpr* ) ;
signalMapType *getSignals ( );
void dump ();
signalMapType *getSignals();
void dump();
private:
llvm::raw_ostream & _os;
......
......@@ -22,7 +22,7 @@ FindWait::~FindWait() {
bool FindWait::VisitCallExpr (CallExpr *e) {
bool duplicateWait = false;
// bool duplicateWait = false;
clang::LangOptions LangOpts;
LangOpts.CPlusPlus = true;
......
......@@ -32,8 +32,8 @@ namespace scpar {
CXXMethodDecl *_entryMethodDecl;
llvm::raw_ostream & _os;
CallExpr *_waitCall;
Expr *_firstArg;
CallExpr *_waitCall;
Expr *_firstArg;
bool _foundWait;
waitListType _waitCalls;
......
......@@ -15,8 +15,7 @@ bool SystemCConsumer::postFire() {
return true;
}
bool SystemCConsumer::fire()
{
bool SystemCConsumer::fire() {
TranslationUnitDecl *tu = _context.getTranslationUnitDecl();
......@@ -31,23 +30,23 @@ bool SystemCConsumer::fire()
SCModules::moduleMapType scmodules = scmod.getSystemCModulesMap();
for (SCModules::moduleMapType::iterator mit = scmodules.begin(),
mitend = scmodules.end(); mit != mitend; mit++)
{
ModuleDecl *md = new ModuleDecl(mit->first, mit->second);
_systemcModel->addModuleDecl(md);
}
for (SCModules::moduleMapType::iterator mit = scmodules.begin(),
mitend = scmodules.end(); mit != mitend; mit++)
{
ModuleDecl *md = new ModuleDecl(mit->first, mit->second);
_systemcModel->addModuleDecl(md);
}
////////////////////////////////////////////////////////////////
FindSCMain scmain(tu, _os);
if (scmain.isSCMainFound())
{
FunctionDecl *fnDecl = scmain.getSCMainFunctionDecl();
{
FunctionDecl *fnDecl = scmain.getSCMainFunctionDecl();
FindSimTime scstart(fnDecl, _os);
_systemcModel->addSimulationTime(scstart.returnSimTime());
FindSimTime scstart(fnDecl, _os);
_systemcModel->addSimulationTime(scstart.returnSimTime());
}
}
else {
_os <<"\n Could not find SCMain";
}
......@@ -59,8 +58,8 @@ bool SystemCConsumer::fire()
Model::moduleMapType moduleMap = _systemcModel->getModuleDecl();
for (Model::moduleMapType::iterator mit = moduleMap.begin(), mitend = moduleMap.end();
mit != mitend;
mit++) {
mit != mitend;
mit++) {
ModuleDecl *mainmd = mit->second;
int numInstances = mainmd->getNumInstances();
......@@ -94,60 +93,60 @@ bool SystemCConsumer::fire()
md->addProcess(entryFunctions);
for (size_t i = 0; i < entryFunctions->size(); i++)
{
EntryFunctionContainer *ef = (*entryFunctions)[i];
{
EntryFunctionContainer *ef = (*entryFunctions)[i];
FindSensitivity
findSensitivity(constructor.returnConstructorStmt(), _os);
ef->addSensitivityInfo(findSensitivity);
FindSensitivity
findSensitivity(constructor.returnConstructorStmt(), _os);
ef->addSensitivityInfo(findSensitivity);
if (ef->getEntryMethod() == NULL)
{
_os << "ERROR";
continue;
}
if (ef->getEntryMethod() == nullptr)
{
_os << "ERROR";
continue;
}
FindWait findWaits(ef->getEntryMethod(), _os);
ef->addWaits(findWaits);
FindWait findWaits(ef->getEntryMethod(), _os);
ef->addWaits(findWaits);
FindNotify findNotify(ef->_entryMethodDecl, _os);
ef->addNotifys(findNotify);
FindNotify findNotify(ef->_entryMethodDecl, _os);
ef->addNotifys(findNotify);
/*
SuspensionAutomata suspensionAutomata(findWaits.getWaitCalls(), ef->getEntryMethod(), &_context, llvm::errs());
if (suspensionAutomata.initialize()) {
suspensionAutomata.genSusCFG();
//suspensionAutomata.dumpSusCFG();
suspensionAutomata.genSauto();
//suspensionAutomata.dumpSauto();
ef->addSusCFGAuto(suspensionAutomata);
}
*/
_entryFunctionContainerVector.push_back(ef);
/*
SuspensionAutomata suspensionAutomata(findWaits.getWaitCalls(), ef->getEntryMethod(), &_context, llvm::errs());
if (suspensionAutomata.initialize()) {
suspensionAutomata.genSusCFG();
//suspensionAutomata.dumpSusCFG();
suspensionAutomata.genSauto();
//suspensionAutomata.dumpSauto();
ef->addSusCFGAuto(suspensionAutomata);
}
*/
_entryFunctionContainerVector.push_back(ef);
}
}
moduleDeclVec.push_back(md);
}
_systemcModel->addModuleDeclInstances(mainmd, moduleDeclVec);
_systemcModel->addModuleDeclInstances(mainmd, moduleDeclVec);
}
/*
FindSCMain scmain(tu, _os);
FindSCMain scmain(tu, _os);
if (scmain.isSCMainFound())
{
if (scmain.isSCMainFound())
{
FunctionDecl *fnDecl = scmain.getSCMainFunctionDecl();
FindSimTime scstart(fnDecl, _os);
_systemcModel->addSimulationTime(scstart.returnSimTime());
}
else {
}
else {
_os <<"\n Could not find SCMain";
}
FindNetlist findNetlist(scmain.getSCMainFunctionDecl());
findNetlist.dump();
_systemcModel->addNetlist(findNetlist);
}
FindNetlist findNetlist(scmain.getSCMainFunctionDecl());
findNetlist.dump();
_systemcModel->addNetlist(findNetlist);
*/
......@@ -157,8 +156,8 @@ bool SystemCConsumer::fire()
Model::moduleInstanceMapType moduleInstanceMap = _systemcModel->getModuleInstanceMap();
for (Model::moduleInstanceMapType::iterator it = moduleInstanceMap.begin(), eit = moduleInstanceMap.end();
it != eit;
it++) {
it != eit;
it++) {
vector<ModuleDecl*> moduleDeclVec = it->second;
for (size_t i = 0; i < moduleDeclVec.size(); i++) {
ModuleDecl *moduleDecl = moduleDeclVec.at(i);
......@@ -177,13 +176,12 @@ bool SystemCConsumer::fire()
}
}
_os <<"\n SystemC model dump\n";
_systemcModel->dump(_os);
return true;
_os <<"\n SystemC model dump\n";
_systemcModel->dump(_os);
return true;
}
void SystemCConsumer::HandleTranslationUnit(ASTContext & context)
{
void SystemCConsumer::HandleTranslationUnit(ASTContext & context) {
// ///////////////////////////////////////////////////////////////
// / Pass 1: Find the necessary information.
// ///////////////////////////////////////////////////////////////
......@@ -192,8 +190,7 @@ void SystemCConsumer::HandleTranslationUnit(ASTContext & context)
pre = preFire();
if (!pre)
{
if (!pre) {
return;
}
......@@ -201,24 +198,25 @@ void SystemCConsumer::HandleTranslationUnit(ASTContext & context)
f = fire();
if (!f)
{
if (!f) {
return;
}
postFire();
}
SystemCConsumer::SystemCConsumer(CompilerInstance & ci):_os(llvm::errs()), _sm(ci.getSourceManager()), _ci(ci),
_context(ci.getASTContext()),
_systemcModel(NULL)
{
SystemCConsumer::SystemCConsumer(CompilerInstance & ci):
_os(llvm::errs()),
_sm(ci.getSourceManager()),
_ci(ci),
_context(ci.getASTContext()),
_systemcModel(nullptr) {
}
SystemCConsumer::~SystemCConsumer()
{
if (_systemcModel != NULL)
{
if (_systemcModel != nullptr) {
delete _systemcModel;
_systemcModel = nullptr;
}
}
......@@ -76,11 +76,11 @@ namespace scpar
Model *getSystemCModel();
virtual void HandleTranslationUnit(ASTContext & context);
ASTContext & _context;
ASTContext & _context;
private:
CompilerInstance & _ci;
// ASTContext& _context;
//ASTContext& _context;
Model *_systemcModel;
// Rewriter _rewrite;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment