systemc-clang 2.0.0
Parsing SystemC constructs
Loading...
Searching...
No Matches
FindSimTime.cpp
Go to the documentation of this file.
1#include "FindSimTime.h"
2
3using namespace systemc_clang;
4
5FindSimTime::FindSimTime(FunctionDecl *tuDecl, llvm::raw_ostream &os)
6 : os_(os) {
7 // _sigInst{nullptr},
8 // call_expr_{nullptr} {
9
10 assert(!(tuDecl == nullptr));
11 TraverseDecl(tuDecl);
12}
13
15
16bool FindSimTime::VisitCallExpr(CallExpr *c) {
17 if (c->getDirectCallee()->getNameInfo().getAsString() != "sc_start") {
18 return true;
19 }
20
21 // os_ << "Found sc_start";
22 if (c->getNumArgs() > 0) {
23 // os_ <<"\n Simulation time is :" << getArgumentName(c->getArg(0));
24 if (c->getNumArgs() > 1) {
25 // os_ << " " << getArgumentName(c->getArg(1));
27 getArgumentName(c->getArg(0)), getArgumentName(c->getArg(1))));
28 }
29 }
30 return true;
31}
32
33/*
34 string FindSimTime::getArgumentName (Expr * arg)
35 {
36 if (arg == NULL)
37 return string ("NULL");
38
39 clang::LangOptions LangOpts;
40 LangOpts.CPlusPlus = true;
41 clang::PrintingPolicy Policy (LangOpts);
42
43 string
44 TypeS;
45
46 llvm::raw_string_ostream s (TypeS);
47 arg->printPretty (s, 0, Policy);
48 // os_ << ", argument: " << s.str() << "\n";
49 return s.str ();
50 }
51*/
52
map< string, string > simulationTimeMapType
Definition FindSimTime.h:18
pair< string, string > simulationTimePairType
Definition FindSimTime.h:17
simulationTimeMapType simulation_time_
Definition FindSimTime.h:29
virtual bool VisitCallExpr(CallExpr *c)
FindSimTime(FunctionDecl *, llvm::raw_ostream &)
simulationTimeMapType returnSimTime()
string getArgumentName(expressionArg *exp)
Definition Utility.h:75