CIRCT  19.0.0git
Macros | Functions
LowerTypes.cpp File Reference
#include "PassDetails.h"
#include "circt/Dialect/FIRRTL/AnnotationDetails.h"
#include "circt/Dialect/FIRRTL/FIRRTLAttributes.h"
#include "circt/Dialect/FIRRTL/FIRRTLOps.h"
#include "circt/Dialect/FIRRTL/FIRRTLTypes.h"
#include "circt/Dialect/FIRRTL/FIRRTLUtils.h"
#include "circt/Dialect/FIRRTL/FIRRTLVisitors.h"
#include "circt/Dialect/FIRRTL/NLATable.h"
#include "circt/Dialect/FIRRTL/Namespace.h"
#include "circt/Dialect/FIRRTL/Passes.h"
#include "circt/Dialect/HW/HWAttributes.h"
#include "circt/Dialect/HW/HWOpInterfaces.h"
#include "circt/Dialect/SV/SVOps.h"
#include "circt/Support/Debug.h"
#include "mlir/IR/ImplicitLocOpBuilder.h"
#include "mlir/IR/Threading.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/BitVector.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Parallel.h"
Include dependency graph for LowerTypes.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "firrtl-lower-types"
 

Functions

static FIRRTLType mapLoweredType (FIRRTLType type, FIRRTLBaseType fieldType)
 Return fieldType or fieldType as same ref as type. More...
 
static Type mapLoweredType (Type type, FIRRTLBaseType fieldType)
 Return fieldType or fieldType as same ref as type. More...
 
static bool isOneDimVectorType (FIRRTLType type)
 Return true if the type is a 1d vector type or ground type. More...
 
static bool containsBundleType (FIRRTLType type)
 Return true if the type has a bundle type as subtype. More...
 
static bool isPreservableAggregateType (Type type, PreserveAggregate::PreserveMode mode)
 Return true if we can preserve the type. More...
 
static bool peelType (Type type, SmallVectorImpl< FlatBundleFieldEntry > &fields, PreserveAggregate::PreserveMode mode)
 Peel one layer of an aggregate type into its components. More...
 
static bool isNotSubAccess (Operation *op)
 Return if something is not a normal subaccess. More...
 
static SmallVector< Operation * > getSAWritePath (Operation *op)
 Look through and collect subfields leading to a subaccess. More...
 
static MemOp cloneMemWithNewType (ImplicitLocOpBuilder *b, MemOp op, FlatBundleFieldEntry field)
 Clone memory for the specified field. Returns null op on error. More...
 
static Value cloneAccess (ImplicitLocOpBuilder *builder, Operation *op, Value rhs)
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "firrtl-lower-types"

Definition at line 52 of file LowerTypes.cpp.

Function Documentation

◆ cloneAccess()

static Value cloneAccess ( ImplicitLocOpBuilder *  builder,
Operation *  op,
Value  rhs 
)
static

Definition at line 832 of file LowerTypes.cpp.

References builder.

◆ cloneMemWithNewType()

static MemOp cloneMemWithNewType ( ImplicitLocOpBuilder *  b,
MemOp  op,
FlatBundleFieldEntry  field 
)
static

Clone memory for the specified field. Returns null op on error.

Definition at line 230 of file LowerTypes.cpp.

References circt::firrtl::Annotation::getDict(), circt::firrtl::Annotation::getFieldID(), circt::hw::FieldIdImpl::getMaxFieldID(), and circt::firrtl::Annotation::setMember().

◆ containsBundleType()

static bool containsBundleType ( FIRRTLType  type)
static

Return true if the type has a bundle type as subtype.

Definition at line 119 of file LowerTypes.cpp.

References circt::firrtl::FIRRTLTypeSwitch< T, ResultT >::Case().

Referenced by isPreservableAggregateType().

◆ getSAWritePath()

static SmallVector<Operation *> getSAWritePath ( Operation *  op)
static

Look through and collect subfields leading to a subaccess.

Definition at line 216 of file LowerTypes.cpp.

References isNotSubAccess().

◆ isNotSubAccess()

static bool isNotSubAccess ( Operation *  op)
static

Return if something is not a normal subaccess.

Non-normal includes zero-length vectors and constant indexes (which are really subindexes).

Definition at line 206 of file LowerTypes.cpp.

Referenced by getSAWritePath().

◆ isOneDimVectorType()

static bool isOneDimVectorType ( FIRRTLType  type)
static

Return true if the type is a 1d vector type or ground type.

Definition at line 106 of file LowerTypes.cpp.

References circt::firrtl::FIRRTLTypeSwitch< T, ResultT >::Case().

Referenced by isPreservableAggregateType().

◆ isPreservableAggregateType()

static bool isPreservableAggregateType ( Type  type,
PreserveAggregate::PreserveMode  mode 
)
static

◆ mapLoweredType() [1/2]

static FIRRTLType mapLoweredType ( FIRRTLType  type,
FIRRTLBaseType  fieldType 
)
static

Return fieldType or fieldType as same ref as type.

Definition at line 93 of file LowerTypes.cpp.

References circt::firrtl::mapBaseType().

Referenced by mapLoweredType().

◆ mapLoweredType() [2/2]

static Type mapLoweredType ( Type  type,
FIRRTLBaseType  fieldType 
)
static

Return fieldType or fieldType as same ref as type.

Definition at line 98 of file LowerTypes.cpp.

References mapLoweredType().

◆ peelType()

static bool peelType ( Type  type,
SmallVectorImpl< FlatBundleFieldEntry > &  fields,
PreserveAggregate::PreserveMode  mode 
)
static

Peel one layer of an aggregate type into its components.

Type may be complex, but empty, in which case fields is empty, but the return is true.

Definition at line 169 of file LowerTypes.cpp.

References circt::firrtl::FIRRTLTypeSwitch< T, ResultT >::Case(), and isPreservableAggregateType().