Loading [MathJax]/extensions/tex2jax.js
CIRCT 21.0.0git
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Functions
circt::comb Namespace Reference

Classes

class  CombinationalVisitor
 This helps visit Combinational nodes. More...
 

Functions

KnownBits computeKnownBits (Value value)
 Compute "known bits" information about the specified value - the set of bits that are guaranteed to always be zero, and the set of bits that are guaranteed to always be one (these must be exclusive!).
 
Value createZExt (OpBuilder &builder, Location loc, Value value, unsigned targetWidth)
 Create the ops to zero-extend a value to an integer of equal or larger type.
 
Value createOrFoldSExt (Location loc, Value value, Type destTy, OpBuilder &builder)
 Create a sign extension operation from a value of integer type to an equal or larger integer type.
 
Value createOrFoldSExt (Value value, Type destTy, ImplicitLocOpBuilder &builder)
 
Value createOrFoldNot (Location loc, Value value, OpBuilder &builder, bool twoState=false)
 Create a `‘Not’' gate on a value.
 
Value createOrFoldNot (Value value, ImplicitLocOpBuilder &builder, bool twoState=false)
 
void extractBits (OpBuilder &builder, Value val, SmallVectorImpl< Value > &bits)
 Extract bits from a value.
 
Value constructMuxTree (OpBuilder &builder, Location loc, ArrayRef< Value > selectors, ArrayRef< Value > leafNodes, Value outOfBoundsValue)
 Construct a mux tree for given leaf nodes.
 
Value createDynamicExtract (OpBuilder &builder, Location loc, Value value, Value offset, unsigned width)
 Extract a range of bits from an integer at a dynamic offset.
 
Value createDynamicInject (OpBuilder &builder, Location loc, Value value, Value offset, Value replacement, bool twoState=false)
 Replace a range of bits in an integer at a dynamic offset, and return the updated integer value.
 
Value createInject (OpBuilder &builder, Location loc, Value value, unsigned offset, Value replacement)
 Replace a range of bits in an integer and return the updated integer value.
 
void populateCombNarrowingPatterns (mlir::RewritePatternSet &patterns, mlir::DataFlowSolver &solver)
 Add patterns for int range based narrowing.
 

Function Documentation

◆ computeKnownBits()

KnownBits circt::comb::computeKnownBits ( Value  value)

Compute "known bits" information about the specified value - the set of bits that are guaranteed to always be zero, and the set of bits that are guaranteed to always be one (these must be exclusive!).

Given an integer SSA value, check to see if we know anything about the result of the computation.

A bit that exists in neither set is unknown.

For example, we know that "and with a constant" always returns zeros for the zero bits in a constant.

Definition at line 87 of file CombAnalysis.cpp.

◆ constructMuxTree()

Value circt::comb::constructMuxTree ( OpBuilder &  builder,
Location  loc,
ArrayRef< Value >  selectors,
ArrayRef< Value >  leafNodes,
Value  outOfBoundsValue 
)

Construct a mux tree for given leaf nodes.

selectors is the selector for each level of the tree. Currently the selector is tested from MSB to LSB.

Definition at line 104 of file CombOps.cpp.

◆ createDynamicExtract()

Value circt::comb::createDynamicExtract ( OpBuilder &  builder,
Location  loc,
Value  value,
Value  offset,
unsigned  width 
)

Extract a range of bits from an integer at a dynamic offset.

Definition at line 131 of file CombOps.cpp.

References assert(), and createZExt().

◆ createDynamicInject()

Value circt::comb::createDynamicInject ( OpBuilder &  builder,
Location  loc,
Value  value,
Value  offset,
Value  replacement,
bool  twoState = false 
)

Replace a range of bits in an integer at a dynamic offset, and return the updated integer value.

Calls createInject if the offset is constant.

Definition at line 151 of file CombOps.cpp.

References assert(), createInject(), createOrFoldNot(), and createZExt().

◆ createInject()

Value circt::comb::createInject ( OpBuilder &  builder,
Location  loc,
Value  value,
unsigned  offset,
Value  replacement 
)

Replace a range of bits in an integer and return the updated integer value.

Definition at line 186 of file CombOps.cpp.

References assert().

Referenced by createDynamicInject().

◆ createOrFoldNot() [1/2]

Value circt::comb::createOrFoldNot ( Location  loc,
Value  value,
OpBuilder &  builder,
bool  twoState = false 
)

◆ createOrFoldNot() [2/2]

Value circt::comb::createOrFoldNot ( Value  value,
ImplicitLocOpBuilder &  builder,
bool  twoState = false 
)

Definition at line 71 of file CombOps.cpp.

References createOrFoldNot().

◆ createOrFoldSExt() [1/2]

Value circt::comb::createOrFoldSExt ( Location  loc,
Value  value,
Type  destTy,
OpBuilder &  builder 
)

Create a sign extension operation from a value of integer type to an equal or larger integer type.

Definition at line 42 of file CombOps.cpp.

References assert().

Referenced by ConvertCellOp::convertPrimitiveOp(), and createOrFoldSExt().

◆ createOrFoldSExt() [2/2]

Value circt::comb::createOrFoldSExt ( Value  value,
Type  destTy,
ImplicitLocOpBuilder &  builder 
)

Definition at line 60 of file CombOps.cpp.

References createOrFoldSExt().

◆ createZExt()

Value circt::comb::createZExt ( OpBuilder &  builder,
Location  loc,
Value  value,
unsigned  targetWidth 
)

Create the ops to zero-extend a value to an integer of equal or larger type.

Definition at line 24 of file CombOps.cpp.

References assert().

Referenced by createDynamicExtract(), and createDynamicInject().

◆ extractBits()

void circt::comb::extractBits ( OpBuilder &  builder,
Value  val,
SmallVectorImpl< Value > &  bits 
)

Extract bits from a value.

Definition at line 77 of file CombOps.cpp.

References assert(), and concat().

◆ populateCombNarrowingPatterns()

void circt::comb::populateCombNarrowingPatterns ( mlir::RewritePatternSet &  patterns,
mlir::DataFlowSolver &  solver 
)

Add patterns for int range based narrowing.