CIRCT  20.0.0git
Functions
ModuleImplementation.cpp File Reference
#include "circt/Dialect/HW/ModuleImplementation.h"
#include "circt/Dialect/HW/HWOps.h"
#include "circt/Support/LLVM.h"
#include "circt/Support/ParsingUtils.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/DialectImplementation.h"
#include "mlir/Interfaces/FunctionImplementation.h"
Include dependency graph for ModuleImplementation.cpp:

Go to the source code of this file.

Functions

static ParseResult parseFunctionResultList (OpAsmParser &parser, SmallVectorImpl< Attribute > &resultNames, SmallVectorImpl< Type > &resultTypes, SmallVectorImpl< DictionaryAttr > &resultAttrs, SmallVectorImpl< Attribute > &resultLocs)
 Parse a function result list. More...
 
static StringRef getModuleArgumentName (Operation *module, size_t argNo)
 Return the port name for the specified argument or result. More...
 
static StringRef getModuleResultName (Operation *module, size_t resultNo)
 
ParseResult parseOptionalKeywordOrOptionalString (OpAsmParser &p, std::string &result, bool &found)
 Parse an optional keyword or string and set instance into 'result'. More...
 
static ParseResult parseDirection (OpAsmParser &p, ModulePort::Direction &dir)
 
static ParseResult parseInputPort (OpAsmParser &parser, module_like_impl::PortParse &result)
 
static ParseResult parseOutputPort (OpAsmParser &parser, module_like_impl::PortParse &result)
 
static ParseResult parsePort (OpAsmParser &p, module_like_impl::PortParse &result)
 Parse a single argument with the following syntax: More...
 
static ParseResult parsePortList (OpAsmParser &p, SmallVectorImpl< module_like_impl::PortParse > &result)
 
static const char * directionAsString (ModulePort::Direction dir)
 

Function Documentation

◆ directionAsString()

static const char* directionAsString ( ModulePort::Direction  dir)
static

Definition at line 383 of file ModuleImplementation.cpp.

References assert(), InOut, Input, and Output.

Referenced by circt::hw::module_like_impl::printModuleSignatureNew().

◆ getModuleArgumentName()

static StringRef getModuleArgumentName ( Operation *  module,
size_t  argNo 
)
static

Return the port name for the specified argument or result.

Definition at line 72 of file ModuleImplementation.cpp.

Referenced by circt::hw::module_like_impl::printModuleSignature().

◆ getModuleResultName()

static StringRef getModuleResultName ( Operation *  module,
size_t  resultNo 
)
static

◆ parseDirection()

static ParseResult parseDirection ( OpAsmParser &  p,
ModulePort::Direction dir 
)
static

Definition at line 262 of file ModuleImplementation.cpp.

References InOut, Input, and Output.

Referenced by parsePort().

◆ parseFunctionResultList()

static ParseResult parseFunctionResultList ( OpAsmParser &  parser,
SmallVectorImpl< Attribute > &  resultNames,
SmallVectorImpl< Type > &  resultTypes,
SmallVectorImpl< DictionaryAttr > &  resultAttrs,
SmallVectorImpl< Attribute > &  resultLocs 
)
static

Parse a function result list.

function-result-list ::= function-result-list-parens function-result-list-parens ::= ( ) | ( function-result-list-no-parens ) function-result-list-no-parens ::= function-result (, function-result)* function-result ::= (percent-identifier :) type attribute-dict?

Definition at line 30 of file ModuleImplementation.cpp.

References circt::calyx::direction::get().

Referenced by circt::hw::module_like_impl::parseModuleFunctionSignature().

◆ parseInputPort()

static ParseResult parseInputPort ( OpAsmParser &  parser,
module_like_impl::PortParse result 
)
static

◆ parseOptionalKeywordOrOptionalString()

ParseResult parseOptionalKeywordOrOptionalString ( OpAsmParser &  p,
std::string &  result,
bool &  found 
)

Parse an optional keyword or string and set instance into 'result'.

‘ Returns failure on a parse issue, but not on not finding the string. 'found’ indicates whether the optional value exists.

Definition at line 247 of file ModuleImplementation.cpp.

Referenced by parseInputPort().

◆ parseOutputPort()

static ParseResult parseOutputPort ( OpAsmParser &  parser,
module_like_impl::PortParse result 
)
static

Definition at line 305 of file ModuleImplementation.cpp.

References circt::hw::module_like_impl::PortParse::rawName.

Referenced by parsePort().

◆ parsePort()

static ParseResult parsePort ( OpAsmParser &  p,
module_like_impl::PortParse result 
)
static

Parse a single argument with the following syntax:

output (id|string) : !type { optionalAttrDict} loc(optionalSourceLoc) (input|inout) ssaname : !type { optionalAttrDict} loc(optionalSourceLoc)

Definition at line 338 of file ModuleImplementation.cpp.

References circt::hw::module_like_impl::PortParse::direction, Output, parseDirection(), parseInputPort(), and parseOutputPort().

Referenced by parsePortDefList(), and parsePortList().

◆ parsePortList()

static ParseResult parsePortList ( OpAsmParser &  p,
SmallVectorImpl< module_like_impl::PortParse > &  result 
)
static

Definition at line 349 of file ModuleImplementation.cpp.

References parsePort().

Referenced by circt::hw::module_like_impl::parseModuleSignature().