SystemCClang.h 2.8 KB
Newer Older
Anirudh Kaushik's avatar
Anirudh Kaushik committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// ===-- src/SystemCClang.h - systec-clang class definition -------*- C++
// -*-===//
// 
// systemc-clang: SystemC Parser
// 
// This file is distributed under the University of Illinois License.
// See LICENSE.mkd for details.
// 
// ===----------------------------------------------------------------------===//
// /
// / \file
// / \brief This file contains the class declaration for main SystemC parser.
// /
// ===----------------------------------------------------------------------===//
#ifndef _SYSTEMC_CLANG_H_
#define _SYSTEMC_CLANG_H_

#include "clang/Frontend/FrontendPluginRegistry.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/AST.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Parse/Parser.h"
#include "clang/Tooling/CommonOptionsParser.h"
#include "clang/Tooling/Tooling.h"

using namespace clang::driver;
using namespace clang::tooling;

// / This is the include files we add to parse SystemC
#include "FindModule.h"
#include "FindPorts.h"
#include "FindTLMInterfaces.h"
#include "FindEvents.h"
#include "FindGlobalEvents.h"
#include "FindEntryFunctions.h"
#include "FindSensitivity.h"
#include "FindSCMain.h"
#include "FindWait.h"
#include "FindNotify.h"
#include "FindConstructor.h"
#include "SCModules.h"
#include "FindSignals.h"
#include "FindSimTime.h"
#include "Model.h"
#include "FindNetlist.h"
#include "FindArgument.h"
#include "Utility.h"
#include "SuspensionAutomata.h"
Anirudh's avatar
Anirudh committed
51
52
#include "SCuitable/GlobalSuspensionAutomata.h"
#include "SCuitable/FindGPUMacro.h"
rmrf's avatar
rmrf committed
53

rmrf's avatar
rmrf committed
54
//#include "matchers/sc_module.h"
rmrf's avatar
rmrf committed
55

Anirudh Kaushik's avatar
Anirudh Kaushik committed
56
57
using namespace clang;

rmrf's avatar
rmrf committed
58
namespace scpar {
Anirudh Kaushik's avatar
Anirudh Kaushik committed
59

rmrf's avatar
rmrf committed
60
61
62
  class SystemCConsumer :
    public ASTConsumer,
    public RecursiveASTVisitor < SystemCConsumer > {
Anirudh Kaushik's avatar
Anirudh Kaushik committed
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80

	  private:
     
	  public:
		llvm::raw_ostream & _os;
		SourceManager & _sm;

		SystemCConsumer(CompilerInstance &);
		~SystemCConsumer();

		// Virtual methods that plugins may override. 
		virtual bool preFire();
		virtual bool postFire();
		virtual bool fire();

		Model *getSystemCModel();

		virtual void HandleTranslationUnit(ASTContext & context);  
rmrf's avatar
rmrf committed
81
    ASTContext & _context;
Anirudh Kaushik's avatar
Anirudh Kaushik committed
82
83
84

	  private:
		CompilerInstance & _ci;
rmrf's avatar
rmrf committed
85
		//ASTContext& _context;
Anirudh Kaushik's avatar
Anirudh Kaushik committed
86
87
88
89
90
		Model *_systemcModel;

		// Rewriter _rewrite; 
	};							// End class SystemCConsumer

rmrf's avatar
rmrf committed
91
92
93
94
95
  class SystemCClang : public SystemCConsumer {

  };


Anirudh Kaushik's avatar
Anirudh Kaushik committed
96
  template < typename A > class LightsCameraAction:
rmrf's avatar
rmrf committed
97
	public clang::ASTFrontendAction {
Anirudh Kaushik's avatar
Anirudh Kaushik committed
98
99
	  protected:

100
101
102
103
   	  virtual std::unique_ptr<clang::ASTConsumer> CreateASTConsumer(CompilerInstance & ci,	llvm::StringRef inFile) {
	//	virtual ASTConsumer * CreateASTConsumer(CompilerInstance & ci, StringRef) {
          		  return std::unique_ptr<clang::ASTConsumer>(new SystemCConsumer(ci));
			//return new A(ci);
Anirudh Kaushik's avatar
Anirudh Kaushik committed
104
105
106
107
108
109
110
		};

	};							// End class LightsCameraAction

}								// End namespace scpar

#endif