systemc-clang 2.0.0
Parsing SystemC constructs
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
sc_ast_matchers::PortMatcher Class Reference

Class PortMatcher. More...

#include <PortMatcher.h>

Inheritance diagram for sc_ast_matchers::PortMatcher:
Inheritance graph
[legend]
Collaboration diagram for sc_ast_matchers::PortMatcher:
Collaboration graph
[legend]

Public Types

typedef std::vector< std::tuple< std::string, PortDecl * > > MemberDeclType
 

Public Member Functions

const MemberDeclTypegetClockPorts () const
 
const MemberDeclTypegetInputPorts () const
 
const MemberDeclTypegetOutputPorts () const
 
const MemberDeclTypegetInOutPorts () const
 
const MemberDeclTypegetOtherVars () const
 
const MemberDeclTypegetSignals () const
 
const MemberDeclTypegetSubmodules () const
 
const MemberDeclTypegetInputStreamPorts () const
 
const MemberDeclTypegetOutputStreamPorts () const
 
const MemberDeclTypegetPorts () const
 Returns the identified ports.
 
 PortMatcher ()
 Default constructor.
 
auto makeFieldMatcher (llvm::StringRef name)
 AST matcher to detect field declarations.
 
auto makeSignalArrayType (const std::string &name)
 
auto signalMatcher (const std::string &name)
 
auto makeSignalMatcher (llvm::StringRef name)
 
auto makeArrayTypeMatcher (const std::string &name)
 
auto portNameMatcher (const std::string &name)
 
auto makePortHasNameMatcher (llvm::StringRef name)
 
auto makePortHasNamedDeclNameMatcher (llvm::StringRef name)
 
auto makeArraySubModule (llvm::StringRef name)
 
auto makeMemberIsSubModule ()
 
template<typename NodeType >
auto checkMatch (const std::string &name, const MatchFinder::MatchResult &result)
 
void printTemplateArguments (MemberDeclType &found_ports)
 
template<typename T >
auto parseTemplateType (const T *fd)
 
template<typename T >
void insert_port (MemberDeclType &port, T *decl, bool isFieldDecl=true)
 
void registerMatchers (MatchFinder &finder)
 
virtual void run (const MatchFinder::MatchResult &result)
 
void dump ()
 

Public Attributes

MemberDeclType clock_ports_
 Separate out the member declarations found within a SystemC module.
 
MemberDeclType in_ports_
 
MemberDeclType out_ports_
 
MemberDeclType inout_ports_
 
MemberDeclType other_fields_
 
MemberDeclType signal_fields_
 
MemberDeclType instream_ports_
 
MemberDeclType outstream_ports_
 
MemberDeclType sc_ports_
 
MemberDeclType submodules_
 Store the declaration of submodules.
 

Detailed Description

Class PortMatcher.

This class identifies a SystemC module's port declaration, and nested submodules as well.

Definition at line 43 of file PortMatcher.h.

Member Typedef Documentation

◆ MemberDeclType

typedef std::vector<std::tuple<std::string, PortDecl *> > sc_ast_matchers::PortMatcher::MemberDeclType

A vector of tuples that holds the name of the port, and a pointer to PortDecl.

Definition at line 47 of file PortMatcher.h.

Constructor & Destructor Documentation

◆ PortMatcher()

sc_ast_matchers::PortMatcher::PortMatcher ( )
inline

Default constructor.

Definition at line 111 of file PortMatcher.h.

Member Function Documentation

◆ checkMatch()

template<typename NodeType >
auto sc_ast_matchers::PortMatcher::checkMatch ( const std::string & name,
const MatchFinder::MatchResult & result )
inline

Definition at line 362 of file PortMatcher.h.

◆ dump()

void sc_ast_matchers::PortMatcher::dump ( )
inline

Definition at line 692 of file PortMatcher.h.

◆ getClockPorts()

const MemberDeclType & sc_ast_matchers::PortMatcher::getClockPorts ( ) const
inline

Returns the identified clock ports.

Definition at line 71 of file PortMatcher.h.

◆ getInOutPorts()

const MemberDeclType & sc_ast_matchers::PortMatcher::getInOutPorts ( ) const
inline

Returns the identified inout ports.

Definition at line 83 of file PortMatcher.h.

◆ getInputPorts()

const MemberDeclType & sc_ast_matchers::PortMatcher::getInputPorts ( ) const
inline

Returns the identified input ports.

Definition at line 75 of file PortMatcher.h.

◆ getInputStreamPorts()

const MemberDeclType & sc_ast_matchers::PortMatcher::getInputStreamPorts ( ) const
inline

Returns the identified sc_stream input ports.

Definition at line 99 of file PortMatcher.h.

◆ getOtherVars()

const MemberDeclType & sc_ast_matchers::PortMatcher::getOtherVars ( ) const
inline

Returns the identified variables that are not ports or signals.

Definition at line 87 of file PortMatcher.h.

◆ getOutputPorts()

const MemberDeclType & sc_ast_matchers::PortMatcher::getOutputPorts ( ) const
inline

Returns the identified output ports.

Definition at line 79 of file PortMatcher.h.

◆ getOutputStreamPorts()

const MemberDeclType & sc_ast_matchers::PortMatcher::getOutputStreamPorts ( ) const
inline

Returns the identified sc_stream output ports.

Definition at line 103 of file PortMatcher.h.

◆ getPorts()

const MemberDeclType & sc_ast_matchers::PortMatcher::getPorts ( ) const
inline

Returns the identified ports.

Definition at line 108 of file PortMatcher.h.

◆ getSignals()

const MemberDeclType & sc_ast_matchers::PortMatcher::getSignals ( ) const
inline

Returns the identified signals.

Definition at line 91 of file PortMatcher.h.

◆ getSubmodules()

const MemberDeclType & sc_ast_matchers::PortMatcher::getSubmodules ( ) const
inline

Returns the identified submodules.

Definition at line 95 of file PortMatcher.h.

◆ insert_port()

template<typename T >
void sc_ast_matchers::PortMatcher::insert_port ( MemberDeclType & port,
T * decl,
bool isFieldDecl = true )
inline

Cast it to see if it's array type.

Definition at line 389 of file PortMatcher.h.

◆ makeArraySubModule()

auto sc_ast_matchers::PortMatcher::makeArraySubModule ( llvm::StringRef name)
inline

Definition at line 298 of file PortMatcher.h.

◆ makeArrayTypeMatcher()

auto sc_ast_matchers::PortMatcher::makeArrayTypeMatcher ( const std::string & name)
inline

Definition at line 195 of file PortMatcher.h.

◆ makeFieldMatcher()

auto sc_ast_matchers::PortMatcher::makeFieldMatcher ( llvm::StringRef name)
inline

AST matcher to detect field declarations.

The generic field matcher has the following conditions.

  • It is in the main provided file (not in the library files).
  • It is derived from sc_module
  • For each child that is a FieldDecl,
    • The type of it is a C++ class whose class name is "name"

Definition at line 114 of file PortMatcher.h.

◆ makeMemberIsSubModule()

auto sc_ast_matchers::PortMatcher::makeMemberIsSubModule ( )
inline

Definition at line 310 of file PortMatcher.h.

◆ makePortHasNamedDeclNameMatcher()

auto sc_ast_matchers::PortMatcher::makePortHasNamedDeclNameMatcher ( llvm::StringRef name)
inline

This is a matcher for sc_in_clk since it uses a NamedDecl. It has the following conditions:

  • It must be a FieldDecl,
    • It has a type that is an array whose type has a name "name".
    • Or, it has a type that is a NamedDecl whose name is "name".

Definition at line 288 of file PortMatcher.h.

◆ makePortHasNameMatcher()

auto sc_ast_matchers::PortMatcher::makePortHasNameMatcher ( llvm::StringRef name)
inline

Definition at line 276 of file PortMatcher.h.

◆ makeSignalArrayType()

auto sc_ast_matchers::PortMatcher::makeSignalArrayType ( const std::string & name)
inline

This is a matcher to identify sc_signal. The reason for this matcher is for it to match arrays of sc_signals as well. The conditions are as follows:

  • It must be a FieldDecl
    • It must have a type that is either an array whose type is a c++ class derived from a class name called "name"
    • Or, it is has a type that is a c++ class that is derived from class name "name".

Definition at line 141 of file PortMatcher.h.

◆ makeSignalMatcher()

auto sc_ast_matchers::PortMatcher::makeSignalMatcher ( llvm::StringRef name)
inline

Definition at line 189 of file PortMatcher.h.

◆ parseTemplateType()

template<typename T >
auto sc_ast_matchers::PortMatcher::parseTemplateType ( const T * fd)
inline

Definition at line 379 of file PortMatcher.h.

◆ portNameMatcher()

auto sc_ast_matchers::PortMatcher::portNameMatcher ( const std::string & name)
inline

This is a matcher for sc_port. It has the following conditions:

  • It must be a FieldDecl
    • It has a type that is an array whose type has a name "name"
    • Or, it has a type that is a C++ class whose class name is "name".

I'm not sure how to do 1d,2d,3d array matching other than the way it is done. The key idea is to see that there is an arrayType() within an arrayType(), and so on.

Definition at line 208 of file PortMatcher.h.

◆ printTemplateArguments()

void sc_ast_matchers::PortMatcher::printTemplateArguments ( MemberDeclType & found_ports)
inline

Definition at line 367 of file PortMatcher.h.

◆ registerMatchers()

void sc_ast_matchers::PortMatcher::registerMatchers ( MatchFinder & finder)
inline

Matchers for compositions. These matchers are used to form other matchers.

Matches all the SystemC Ports.

Definition at line 439 of file PortMatcher.h.

◆ run()

virtual void sc_ast_matchers::PortMatcher::run ( const MatchFinder::MatchResult & result)
inlinevirtual

Array types

Submodules

Not a submodule and not a port

Definition at line 546 of file PortMatcher.h.

◆ signalMatcher()

auto sc_ast_matchers::PortMatcher::signalMatcher ( const std::string & name)
inline

Definition at line 151 of file PortMatcher.h.

Member Data Documentation

◆ clock_ports_

MemberDeclType sc_ast_matchers::PortMatcher::clock_ports_

Separate out the member declarations found within a SystemC module.

Definition at line 54 of file PortMatcher.h.

◆ in_ports_

MemberDeclType sc_ast_matchers::PortMatcher::in_ports_

Definition at line 55 of file PortMatcher.h.

◆ inout_ports_

MemberDeclType sc_ast_matchers::PortMatcher::inout_ports_

Definition at line 57 of file PortMatcher.h.

◆ instream_ports_

MemberDeclType sc_ast_matchers::PortMatcher::instream_ports_

Definition at line 60 of file PortMatcher.h.

◆ other_fields_

MemberDeclType sc_ast_matchers::PortMatcher::other_fields_

Definition at line 58 of file PortMatcher.h.

◆ out_ports_

MemberDeclType sc_ast_matchers::PortMatcher::out_ports_

Definition at line 56 of file PortMatcher.h.

◆ outstream_ports_

MemberDeclType sc_ast_matchers::PortMatcher::outstream_ports_

Definition at line 61 of file PortMatcher.h.

◆ sc_ports_

MemberDeclType sc_ast_matchers::PortMatcher::sc_ports_

Definition at line 62 of file PortMatcher.h.

◆ signal_fields_

MemberDeclType sc_ast_matchers::PortMatcher::signal_fields_

Definition at line 59 of file PortMatcher.h.

◆ submodules_

MemberDeclType sc_ast_matchers::PortMatcher::submodules_

Store the declaration of submodules.

Definition at line 65 of file PortMatcher.h.


The documentation for this class was generated from the following file: