CIRCT 24.0.0git
Loading...
Searching...
No Matches
HWArithToHW.cpp File Reference
#include "circt/Conversion/HWArithToHW.h"
#include "circt/Dialect/Comb/CombOps.h"
#include "circt/Dialect/HW/ConversionPatterns.h"
#include "circt/Dialect/HW/HWOps.h"
#include "circt/Dialect/HWArith/HWArithOps.h"
#include "circt/Dialect/MSFT/MSFTOps.h"
#include "circt/Dialect/SV/SVOps.h"
#include "circt/Dialect/Seq/SeqOps.h"
#include "mlir/IR/AttrTypeSubElements.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/ADT/TypeSwitch.h"
#include "circt/Conversion/Passes.h.inc"
Include dependency graph for HWArithToHW.cpp:

Go to the source code of this file.

Namespaces

namespace  circt
 The InstanceGraph op interface, see InstanceGraphInterface.td for more details.

Macros

#define GEN_PASS_DEF_HWARITHTOHW

Functions

static void improveNamehint (Value oldValue, Operation *newOp, llvm::function_ref< std::string(StringRef)> namehintCallback)
static Value extractBits (OpBuilder &builder, Location loc, Value value, unsigned startBit, unsigned bitWidth)
static Value extendTypeWidth (OpBuilder &builder, Location loc, Value value, unsigned targetWidth, bool signExtension)
static bool isSignednessType (Type type)
static bool isSignednessAttr (Attribute attr)
static bool isLegalOp (Operation *op)
 Returns true if the given op is considered as legal for HWArith conversion.

Macro Definition Documentation

◆ GEN_PASS_DEF_HWARITHTOHW

#define GEN_PASS_DEF_HWARITHTOHW

Definition at line 28 of file HWArithToHW.cpp.

Function Documentation

◆ extendTypeWidth()

Value extendTypeWidth ( OpBuilder & builder,
Location loc,
Value value,
unsigned targetWidth,
bool signExtension )
static

Definition at line 76 of file HWArithToHW.cpp.

References hw.ConstantOp::create(), extractBits(), and improveNamehint().

◆ extractBits()

Value extractBits ( OpBuilder & builder,
Location loc,
Value value,
unsigned startBit,
unsigned bitWidth )
static

Definition at line 58 of file HWArithToHW.cpp.

References improveNamehint().

Referenced by extendTypeWidth().

◆ improveNamehint()

void improveNamehint ( Value oldValue,
Operation * newOp,
llvm::function_ref< std::string(StringRef)> namehintCallback )
static

Definition at line 45 of file HWArithToHW.cpp.

Referenced by extendTypeWidth(), and extractBits().

◆ isLegalOp()

bool isLegalOp ( Operation * op)
static

Returns true if the given op is considered as legal for HWArith conversion.

Definition at line 149 of file HWArithToHW.cpp.

References attrs, isSignednessAttr(), and isSignednessType().

◆ isSignednessAttr()

bool isSignednessAttr ( Attribute attr)
static

Definition at line 141 of file HWArithToHW.cpp.

References isSignednessType().

Referenced by isLegalOp().

◆ isSignednessType()

bool isSignednessType ( Type type)
static

Definition at line 110 of file HWArithToHW.cpp.

References isSignednessType().

Referenced by isLegalOp(), isSignednessAttr(), and isSignednessType().