Commit 1fd8cb79 authored by rmrf's avatar rmrf

Merge remote-tracking branch 'origin/new-json-dumps' into new-json-dumps

parents 6034c288 7b929db2
---
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: true
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^<ext/.*\.h>'
Priority: 2
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IncludeIsMainRegex: '([-_](test|unittest))?$'
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 2
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Never
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
RawStringFormats:
- Language: Cpp
Delimiters:
- cc
- CC
- cpp
- Cpp
- CPP
- 'c++'
- 'C++'
CanonicalDelimiter: ''
BasedOnStyle: google
- Language: TextProto
Delimiters:
- pb
- PB
- proto
- PROTO
EnclosingFunctions:
- EqualsProto
- EquivToProto
- PARSE_PARTIAL_TEXT_PROTO
- PARSE_TEST_PROTO
- PARSE_TEXT_PROTO
- ParseTextOrDie
- ParseTextProtoOrDie
CanonicalDelimiter: ''
BasedOnStyle: google
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Auto
TabWidth: 8
UseTab: Never
...
...@@ -38,8 +38,7 @@ void FindGlobalEvents::dump() { ...@@ -38,8 +38,7 @@ void FindGlobalEvents::dump() {
json FindGlobalEvents::dump_json() { json FindGlobalEvents::dump_json() {
json globals_j{}; json globals_j{};
for (auto const &event : _globalEvents) {
for ( auto const & event : _globalEvents ) {
globals_j["global_declarations"].emplace_back( event.first ) ; globals_j["global_declarations"].emplace_back( event.first ) ;
} }
std::cout << globals_j.dump(4) << endl; std::cout << globals_j.dump(4) << endl;
......
...@@ -16,36 +16,36 @@ bool SystemCConsumer::fire() { ...@@ -16,36 +16,36 @@ bool SystemCConsumer::fire() {
_systemcModel = new Model{} ; _systemcModel = new Model{} ;
// ANI : Do we need FindGlobalEvents? // ANI : Do we need FindGlobalEvents?
FindGlobalEvents globals{tu, _os}; FindGlobalEvents globals{tu, os_};
FindGlobalEvents::globalEventMapType eventMap{globals.getEventMap()}; FindGlobalEvents::globalEventMapType eventMap{globals.getEventMap()};
globals.dump_json(); globals.dump_json();
_systemcModel->addGlobalEvents(eventMap); _systemcModel->addGlobalEvents(eventMap);
// Find the sc_modules // Find the sc_modules
FindSCModules scmod{tu, _os}; FindSCModules scmod{tu, os_};
FindSCModules::moduleMapType scmodules{scmod.getSystemCModulesMap()}; FindSCModules::moduleMapType scmodules{scmod.getSystemCModulesMap()};
for (FindSCModules::moduleMapType::iterator mit = scmodules.begin(), for (FindSCModules::moduleMapType::iterator mit = scmodules.begin(),
mitend = scmodules.end(); mit != mitend; ++mit) { mitend = scmodules.end(); mit != mitend; ++mit) {
ModuleDecl *md = new ModuleDecl{mit->first, mit->second}; ModuleDecl *md = new ModuleDecl{mit->first, mit->second};
//md->setTemplateParameters( scmod.getTemplateParameters() ); // md->setTemplateParameters( scmod.getTemplateParameters() );
// _os << "SIZE: " << scmod.getTemplateParameters().size() << "\n"; // os_ << "SIZE: " << scmod.getTemplateParameters().size() << "\n";
_systemcModel->addModuleDecl(md); _systemcModel->addModuleDecl(md);
} }
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
// Find the sc_main // Find the sc_main
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
FindSCMain scmain{tu, _os}; FindSCMain scmain{tu, os_};
if (scmain.isSCMainFound()) { if (scmain.isSCMainFound()) {
FunctionDecl *fnDecl{scmain.getSCMainFunctionDecl()}; FunctionDecl *fnDecl{scmain.getSCMainFunctionDecl()};
FindSimTime scstart{fnDecl, _os}; FindSimTime scstart{fnDecl, os_};
_systemcModel->addSimulationTime(scstart.returnSimTime()); _systemcModel->addSimulationTime(scstart.returnSimTime());
} else { } else {
_os << "\n Could not find SCMain"; os_ << "\n Could not find SCMain";
} }
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
...@@ -66,57 +66,58 @@ bool SystemCConsumer::fire() { ...@@ -66,57 +66,58 @@ bool SystemCConsumer::fire() {
int numInstances{mainmd->getNumInstances()}; int numInstances{mainmd->getNumInstances()};
vector<ModuleDecl *> moduleDeclVec; vector<ModuleDecl *> moduleDeclVec;
_os << "\n"; os_ << "\n";
_os << "For module: " << mit->first << " num instance : " << numInstances; os_ << "For module: " << mit->first << " num instance : " << numInstances;
for (unsigned int num{0}; num < numInstances; ++num) { for (unsigned int num{0}; num < numInstances; ++num) {
ModuleDecl *md = new ModuleDecl{}; ModuleDecl *md = new ModuleDecl{};
// Find the template arguments for the class. // Find the template arguments for the class.
FindTemplateParameters tparms{ mainmd->getModuleClassDecl(), _os}; FindTemplateParameters tparms{mainmd->getModuleClassDecl(), os_};
md->setTemplateParameters( tparms.getTemplateParameters() ); md->setTemplateParameters( tparms.getTemplateParameters() );
_os << "@@# " << mainmd->getTemplateParameters().size() << "\n"; os_ << "@@# " << mainmd->getTemplateParameters().size() << "\n";
md->dump_json(); md->dump_json();
vector<EntryFunctionContainer *> _entryFunctionContainerVector; vector<EntryFunctionContainer *> _entryFunctionContainerVector;
FindConstructor constructor{mainmd->getModuleClassDecl(), _os}; FindConstructor constructor{mainmd->getModuleClassDecl(), os_};
md->addConstructor(constructor.returnConstructorStmt()); md->addConstructor(constructor.returnConstructorStmt());
FindPorts ports{mainmd->getModuleClassDecl(), _os}; FindPorts ports{mainmd->getModuleClassDecl(), os_};
md->addInputPorts(ports.getInputPorts()); md->addInputPorts(ports.getInputPorts());
md->addOutputPorts(ports.getOutputPorts()); md->addOutputPorts(ports.getOutputPorts());
md->addInputOutputPorts(ports.getInputOutputPorts()); md->addInputOutputPorts(ports.getInputOutputPorts());
FindTLMInterfaces findTLMInterfaces{mainmd->getModuleClassDecl(), _os}; FindTLMInterfaces findTLMInterfaces{mainmd->getModuleClassDecl(), os_};
md->addInputInterfaces(findTLMInterfaces.getInputInterfaces()); md->addInputInterfaces(findTLMInterfaces.getInputInterfaces());
md->addOutputInterfaces(findTLMInterfaces.getOutputInterfaces()); md->addOutputInterfaces(findTLMInterfaces.getOutputInterfaces());
md->addInputOutputInterfaces( md->addInputOutputInterfaces(
findTLMInterfaces.getInputOutputInterfaces()); findTLMInterfaces.getInputOutputInterfaces());
FindSignals signals{mainmd->getModuleClassDecl(), _os}; FindSignals signals{mainmd->getModuleClassDecl(), os_};
md->addSignals(signals.getSignals()); md->addSignals(signals.getSignals());
FindEntryFunctions findEntries{mainmd->getModuleClassDecl(), _os}; FindEntryFunctions findEntries{mainmd->getModuleClassDecl(), os_};
FindEntryFunctions::entryFunctionVectorType *entryFunctions{ FindEntryFunctions::entryFunctionVectorType *entryFunctions{
findEntries.getEntryFunctions()}; findEntries.getEntryFunctions()};
md->addProcess(entryFunctions); md->addProcess(entryFunctions);
for (size_t i = 0; i < entryFunctions->size(); i++) { for (size_t i = 0; i < entryFunctions->size(); i++) {
EntryFunctionContainer *ef{(*entryFunctions)[i]}; EntryFunctionContainer *ef{(*entryFunctions)[i]};
FindSensitivity findSensitivity{constructor.returnConstructorStmt(), _os}; FindSensitivity findSensitivity{constructor.returnConstructorStmt(),
os_};
ef->addSensitivityInfo(findSensitivity); ef->addSensitivityInfo(findSensitivity);
if (ef->getEntryMethod() == nullptr) { if (ef->getEntryMethod() == nullptr) {
_os << "ERROR"; os_ << "ERROR";
continue; continue;
} }
FindWait findWaits{ef->getEntryMethod(), _os}; FindWait findWaits{ef->getEntryMethod(), os_};
ef->addWaits(findWaits); ef->addWaits(findWaits);
FindNotify findNotify{ef->_entryMethodDecl, _os}; FindNotify findNotify{ef->_entryMethodDecl, os_};
ef->addNotifys(findNotify); ef->addNotifys(findNotify);
/// Does not compile /// Does not compile
...@@ -139,18 +140,18 @@ bool SystemCConsumer::fire() { ...@@ -139,18 +140,18 @@ bool SystemCConsumer::fire() {
} }
/* /*
FindSCMain scmain(tu, _os); FindSCMain scmain(tu, os_);
if (scmain.isSCMainFound()) if (scmain.isSCMainFound())
{ {
FunctionDecl *fnDecl = scmain.getSCMainFunctionDecl(); FunctionDecl *fnDecl = scmain.getSCMainFunctionDecl();
FindSimTime scstart(fnDecl, _os); FindSimTime scstart(fnDecl, os_);
_systemcModel->addSimulationTime(scstart.returnSimTime()); _systemcModel->addSimulationTime(scstart.returnSimTime());
} }
else { else {
_os <<"\n Could not find SCMain"; os_ <<"\n Could not find SCMain";
} }
FindNetlist findNetlist(scmain.getSCMainFunctionDecl()); FindNetlist findNetlist(scmain.getSCMainFunctionDecl());
...@@ -189,9 +190,9 @@ _systemcModel->addNetlist(findNetlist); ...@@ -189,9 +190,9 @@ _systemcModel->addNetlist(findNetlist);
} }
} }
_os << "\n"; os_ << "\n";
_os << "\n## SystemC model\n"; os_ << "\n## SystemC model\n";
_systemcModel->dump(_os); _systemcModel->dump(os_);
return true; return true;
} }
...@@ -219,8 +220,11 @@ void SystemCConsumer::HandleTranslationUnit(ASTContext &context) { ...@@ -219,8 +220,11 @@ void SystemCConsumer::HandleTranslationUnit(ASTContext &context) {
} }
SystemCConsumer::SystemCConsumer(CompilerInstance &ci) SystemCConsumer::SystemCConsumer(CompilerInstance &ci)
: _os{llvm::errs()}, _sm{ci.getSourceManager()}, : os_{llvm::errs()},
_context{ci.getASTContext()}, _ci{ci}, _systemcModel{nullptr} {} _sm{ci.getSourceManager()},
_context{ci.getASTContext()},
_ci{ci},
_systemcModel{nullptr} {}
SystemCConsumer::~SystemCConsumer() { SystemCConsumer::~SystemCConsumer() {
if (_systemcModel != nullptr) { if (_systemcModel != nullptr) {
......
...@@ -60,7 +60,7 @@ namespace scpar { ...@@ -60,7 +60,7 @@ namespace scpar {
class SystemCConsumer : public ASTConsumer, class SystemCConsumer : public ASTConsumer,
public RecursiveASTVisitor<SystemCConsumer> { public RecursiveASTVisitor<SystemCConsumer> {
public: public:
llvm::raw_ostream &_os; llvm::raw_ostream &os_;
SourceManager &_sm; SourceManager &_sm;
SystemCConsumer(CompilerInstance &); SystemCConsumer(CompilerInstance &);
......
Markdown is supported
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