Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
caesr-pub
systemc-clang
Commits
9bd7b4c0
Commit
9bd7b4c0
authored
Dec 27, 2018
by
Twiga
Browse files
More cleaning up.
parent
bd43b33f
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/FindPorts.cpp
View file @
9bd7b4c0
...
...
@@ -29,7 +29,7 @@ bool FindPorts::VisitFieldDecl( FieldDecl *fd ) {
// os_ << "\n+ Name: " << info->getNameStart();
// os_ << "\n+ Type: " << q.getAsString();
}
//
//
/// FIXME: We have to delete these somewhere. Who is responsible of doing this?
/// We are going to store these. So use pointers.
...
...
@@ -41,7 +41,8 @@ bool FindPorts::VisitFieldDecl( FieldDecl *fd ) {
/// Check if we have sc_in/sc_out/sc_inout ports.
/// The vector is organized such that the first element is the port type.
FindTemplateTypes
::
argVectorType
args
{
te
->
getTemplateArgumentsType
()
};
// FindTemplateTypes::argVectorType
auto
args
{
te
->
getTemplateArgumentsType
()
};
FindTemplateTypes
::
argVectorType
::
iterator
ait
{
args
.
begin
()
};
if
(
args
.
size
()
==
0
)
{
return
true
;
...
...
src/FindSignals.cpp
View file @
9bd7b4c0
...
...
@@ -33,19 +33,19 @@ bool FindSignals::VisitFieldDecl( FieldDecl * fd ) {
const
Type
*
tp
=
q
.
getTypePtr
();
FindTemplateTypes
*
te
=
new
FindTemplateTypes
();
te
->
Enumerate
(
tp
);
te
->
Enumerate
(
tp
);
// te->printTemplateArguments(_os);
string
tt
=
te
->
getTemplateType
();
string
tt
=
te
->
getTemplateType
();
// _os << "OUTPUT ============ " << tt << "\n";
if
((
signed
)
tt
.
find
(
"sc_signal"
)
==
-
1
)
{
delete
te
;
return
true
;
}
SignalContainer
*
sc
=
new
SignalContainer
(
fd
->
getNameAsString
(),
te
,
fd
);
SignalContainer
*
sc
=
new
SignalContainer
(
fd
->
getNameAsString
(),
te
,
fd
);
_signals
->
insert
(
FindSignals
::
signalPairType
(
fd
->
getNameAsString
(),
sc
));
_signals
->
insert
(
FindSignals
::
signalPairType
(
fd
->
getNameAsString
(),
sc
));
}
return
true
;
}
...
...
src/FindTemplateTypes.h
View file @
9bd7b4c0
...
...
@@ -20,34 +20,34 @@ namespace scpar {
class
FindTemplateTypes
:
public
RecursiveASTVisitor
<
FindTemplateTypes
>
{
public:
/// Typedefs
typedef
vector
<
pair
<
string
,
const
Type
*>
>
type_vector_t
;
typedef
vector
<
pair
<
string
,
const
Type
*>
>
argVectorType
;
typedef
vector
<
pair
<
string
,
const
Type
*>
>
type_vector_t
;
typedef
vector
<
pair
<
string
,
const
Type
*>
>
argVectorType
;
// Constructor
FindTemplateTypes
()
{
}
/// Copy constructor
FindTemplateTypes
(
const
FindTemplateTypes
&
rhs
)
{
copy
(
rhs
.
_
template
T
ypes
.
begin
(),
rhs
.
_
template
T
ypes
.
end
(),
back_inserter
(
_
template
T
ypes
)
);
copy
(
rhs
.
template
_t
ypes
_
.
begin
(),
rhs
.
template
_t
ypes
_
.
end
(),
back_inserter
(
template
_t
ypes
_
)
);
}
FindTemplateTypes
(
const
FindTemplateTypes
*
rhs
)
{
copy
(
rhs
->
_
template
T
ypes
.
begin
(),
rhs
->
_
template
T
ypes
.
end
(),
back_inserter
(
_
template
T
ypes
)
);
copy
(
rhs
->
template
_t
ypes
_
.
begin
(),
rhs
->
template
_t
ypes
_
.
end
(),
back_inserter
(
template
_t
ypes
_
)
);
}
string
getTemplateType
()
{
string
s
{};
// type_vector_t::iterator
for
(
auto
mit
=
_
template
T
ypes
.
begin
();
mit
!=
_
template
T
ypes
.
end
();
++
mit
)
{
//for ( auto const &mit:
_
template
T
ypes ) {
if
(
mit
!=
_
template
T
ypes
.
begin
()
)
{
for
(
auto
mit
=
template
_t
ypes
_
.
begin
();
mit
!=
template
_t
ypes
_
.
end
();
++
mit
)
{
//for ( auto const &mit: template
_t
ypes
_
) {
if
(
mit
!=
template
_t
ypes
_
.
begin
()
)
{
s
+=
"<"
;
}
s
+=
mit
->
first
;
if
(
mit
!=
_
template
T
ypes
.
begin
()
)
{
if
(
mit
!=
template
_t
ypes
_
.
begin
()
)
{
s
+=
">"
;
}
}
...
...
@@ -55,20 +55,20 @@ namespace scpar {
}
type_vector_t
Enumerate
(
const
Type
*
type
)
{
_
template
T
ypes
.
clear
();
template
_t
ypes
_
.
clear
();
if
(
!
type
)
{
return
_
template
T
ypes
;
return
template
_t
ypes
_
;
}
TraverseType
(
QualType
(
type
,
0
)
);
return
_
template
T
ypes
;
TraverseType
(
QualType
(
type
,
0
)
);
return
template
_t
ypes
_
;
}
bool
VisitType
(
Type
*
type
)
{
QualType
q
{
type
->
getCanonicalTypeInternal
()};
// cout << "\n###### Type: " << q.getAsString() << " \n" ;
if
(
type
->
isBuiltinType
()
)
{
_
template
T
ypes
.
push_back
(
pair
<
string
,
const
Type
*
>
(
q
.
getAsString
(),
type
)
);
if
(
type
->
isBuiltinType
()
)
{
template
_t
ypes
_
.
push_back
(
pair
<
string
,
const
Type
*
>
(
q
.
getAsString
(),
type
)
);
return
true
;
}
...
...
@@ -76,7 +76,7 @@ namespace scpar {
if
(
p_cxx_record
!=
nullptr
)
{
IdentifierInfo
*
info
{
p_cxx_record
->
getIdentifier
()};
if
(
info
!=
nullptr
)
{
_
template
T
ypes
.
push_back
(
pair
<
string
,
const
Type
*
>
(
info
->
getNameStart
(),
type
)
);
template
_t
ypes
_
.
push_back
(
pair
<
string
,
const
Type
*
>
(
info
->
getNameStart
(),
type
)
);
}
}
return
true
;
...
...
@@ -86,21 +86,21 @@ namespace scpar {
//_os << "\n####### IntegerLiteral: " << l->getValue().toString(10,true) << "\n";
//_os << "== type ptr: " << l->getType().getTypePtr() << "\n";
//_os << "== type name: " << l->getType().getAsString() << "\n";
_
template
T
ypes
.
push_back
(
pair
<
string
,
const
Type
*
>
(
l
->
getValue
().
toString
(
10
,
true
),
template
_t
ypes
_
.
push_back
(
pair
<
string
,
const
Type
*>
(
l
->
getValue
().
toString
(
10
,
true
),
l
->
getType
().
getTypePtr
()));
return
true
;
}
type_vector_t
getTemplateArgumentsType
()
{
return
_
template
T
ypes
;
return
template
_t
ypes
_
;
}
void
printTemplateArguments
(
llvm
::
raw_ostream
&
os
,
int
tabn
=
0
)
{
vector
<
string
>
template_arguments
;
//{ getTemplateArguments() };
// type_vector_t::iterator
// for (auto mit =
_
template
T
ypes.begin(); mit !=
_
template
T
ypes.end(); mit++) {
for
(
auto
const
&
mit
:
_
template
T
ypes
)
{
// for (auto mit = template
_t
ypes
_
.begin(); mit != template
_t
ypes
_
.end(); mit++) {
for
(
auto
const
&
mit
:
template
_t
ypes
_
)
{
for
(
auto
i
{
0
};
i
<
tabn
;
++
i
)
{
os
<<
" "
;
}
...
...
@@ -119,8 +119,8 @@ namespace scpar {
vector
<
string
>
getTemplateArguments
()
{
vector
<
string
>
template_arguments
;
// type_vector_t::iterator
// for ( auto mit =
_
template
T
ypes.begin(); mit !=
_
template
T
ypes.end(); ++mit ) {
for
(
auto
const
&
mit
:
_
template
T
ypes
)
{
// for ( auto mit = template
_t
ypes
_
.begin(); mit != template
_t
ypes
_
.end(); ++mit ) {
for
(
auto
const
&
mit
:
template
_t
ypes
_
)
{
if
(
mit
.
first
==
"sc_in"
||
mit
.
first
==
"sc_out"
||
mit
.
first
==
"sc_inout"
)
{
break
;
}
...
...
@@ -130,11 +130,11 @@ namespace scpar {
}
size_t
size
()
{
return
_
template
T
ypes
.
size
();
return
template
_t
ypes
_
.
size
();
}
private:
type_vector_t
_
template
T
ypes
;
type_vector_t
template
_t
ypes
_
;
};
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment