systemc-clang 2.0.0
Parsing SystemC constructs
Loading...
Searching...
No Matches
HDLType.h
Go to the documentation of this file.
1#ifndef _HDLTYPE_H_
2#define _HDLTYPE_H_
3
4#include "SystemCClang.h"
5#include "Tree.h"
6#include <tuple>
7#include <unordered_map>
8
9#include "hNode.h"
10
11using namespace clang;
12using namespace systemc_clang;
13
14using namespace hnode;
15
16class HDLType {
17public:
20 typedef std::unordered_map<string, QualType> usertype_map_t;
21 typedef std::unordered_map<const clang::Type *, string> userrectype_map_t;
22
23 typedef struct {
24 // map from generated name to qual type
26 // map from type * to generated name; used for user-defined method calls
27 // as first parameter to the method; only populated for record types
30
31 void SCtype2hcode(string prefix, Tree<TemplateType> *template_argtp,
32 std::vector<llvm::APInt> *arr_sizes, hNode::hdlopsEnum h_op,
33 hNodep &h_info);
34 void generatetype(
37 hNodep &h_info, bool generate_initial_htype = true);
39 systemc_clang::Tree<systemc_clang::TemplateType> *const &treehead, string &tmps);
40 hNodep addtype(string typname, QualType qtyp, ASTContext &astcontext);
41 void addfieldtype(const FieldDecl *fld, hNodep &h_typdef);
42
43 //usertype_map_t usertypes;
45 void print(llvm::raw_ostream & modelout=llvm::outs(), unsigned int indnt=2) {
46 modelout << "Userrectypes follows\n";
47 for( auto entry:usertype_info.userrectypes) {
48 modelout << entry.first << " " <<entry.second << "\n";
49 }
50 modelout << "Userrectypes end\n";
51 }
52
53 // used in debugging due to lldb limitations
54 void print(){
55 llvm::dbgs() << "Userrectypes follows\n";
56 for( auto entry:usertype_info.userrectypes) {
57 llvm::dbgs() << entry.first << " " <<entry.second << "\n";
58 }
59 llvm::dbgs() << "Userrectypes end\n";
60 }
61private:
63};
64#endif
void print()
Definition HDLType.h:54
std::unordered_map< const clang::Type *, string > userrectype_map_t
Definition HDLType.h:21
hNodep addtype(string typname, QualType qtyp, ASTContext &astcontext)
Definition HDLType.cpp:178
void print(llvm::raw_ostream &modelout=llvm::outs(), unsigned int indnt=2)
Definition HDLType.h:45
usertype_info_t usertype_info
Definition HDLType.h:44
void SCtype2hcode(string prefix, Tree< TemplateType > *template_argtp, std::vector< llvm::APInt > *arr_sizes, hNode::hdlopsEnum h_op, hNodep &h_info)
Definition HDLType.cpp:29
void addfieldtype(const FieldDecl *fld, hNodep &h_typdef)
Definition HDLType.cpp:247
~HDLType()
Definition HDLType.h:19
std::unordered_map< string, QualType > usertype_map_t
Definition HDLType.h:20
util tutil
Definition HDLType.h:62
HDLType()
Definition HDLType.h:18
void generatetype(systemc_clang::TreeNode< systemc_clang::TemplateType > *const &node, systemc_clang::Tree< systemc_clang::TemplateType > *const &treehead, hNodep &h_info, bool generate_initial_htype=true)
Definition HDLType.cpp:94
bool checkusertype(systemc_clang::TreeNode< systemc_clang::TemplateType > *const &node, systemc_clang::Tree< systemc_clang::TemplateType > *const &treehead, string &tmps)
Definition HDLType.cpp:131
class TreeNode<T>
Definition Tree.h:18
Clang forward declarations.
Definition FindArgument.h:6
Definition hNode.h:24
userrectype_map_t userrectypes
Definition HDLType.h:28
usertype_map_t usertypes
Definition HDLType.h:25