Loading [MathJax]/extensions/tex2jax.js
CIRCT 21.0.0git
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CombOps.h
Go to the documentation of this file.
1//===- CombOps.h - Declare Comb dialect operations --------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file declares the operation classes for the Comb dialect.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef CIRCT_DIALECT_COMB_COMBOPS_H
14#define CIRCT_DIALECT_COMB_COMBOPS_H
15
18#include "circt/Support/LLVM.h"
19#include "mlir/Bytecode/BytecodeOpInterface.h"
20#include "mlir/IR/BuiltinOps.h"
21#include "mlir/IR/OpImplementation.h"
22#include "mlir/Interfaces/FunctionInterfaces.h"
23#include "mlir/Interfaces/InferIntRangeInterface.h"
24#include "mlir/Interfaces/InferTypeOpInterface.h"
25#include "mlir/Interfaces/SideEffectInterfaces.h"
26
27namespace llvm {
28struct KnownBits;
29}
30
31namespace mlir {
32class PatternRewriter;
33}
34
35#define GET_OP_CLASSES
36#include "circt/Dialect/Comb/Comb.h.inc"
37
38namespace circt {
39namespace comb {
40
41using llvm::KnownBits;
42
43/// Compute "known bits" information about the specified value - the set of bits
44/// that are guaranteed to always be zero, and the set of bits that are
45/// guaranteed to always be one (these must be exclusive!). A bit that exists
46/// in neither set is unknown.
47KnownBits computeKnownBits(Value value);
48
49/// Create a sign extension operation from a value of integer type to an equal
50/// or larger integer type.
51Value createOrFoldSExt(Location loc, Value value, Type destTy,
52 OpBuilder &builder);
53Value createOrFoldSExt(Value value, Type destTy, ImplicitLocOpBuilder &builder);
54
55/// Create a ``Not'' gate on a value.
56Value createOrFoldNot(Location loc, Value value, OpBuilder &builder,
57 bool twoState = false);
58Value createOrFoldNot(Value value, ImplicitLocOpBuilder &builder,
59 bool twoState = false);
60
61/// Extract bits from a value.
62void extractBits(OpBuilder &builder, Value val, SmallVectorImpl<Value> &bits);
63
64/// Construct a mux tree for given leaf nodes. `selectors` is the selector for
65/// each level of the tree. Currently the selector is tested from MSB to LSB.
66Value constructMuxTree(OpBuilder &builder, Location loc,
67 ArrayRef<Value> selectors, ArrayRef<Value> leafNodes,
68 Value outOfBoundsValue);
69
70} // namespace comb
71} // namespace circt
72
73#endif // CIRCT_DIALECT_COMB_COMBOPS_H
void extractBits(OpBuilder &builder, Value val, SmallVectorImpl< Value > &bits)
Extract bits from a value.
Definition CombOps.cpp:60
Value createOrFoldNot(Location loc, Value value, OpBuilder &builder, bool twoState=false)
Create a `‘Not’' gate on a value.
Definition CombOps.cpp:48
KnownBits computeKnownBits(Value value)
Compute "known bits" information about the specified value - the set of bits that are guaranteed to a...
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.
Definition CombOps.cpp:25
Value constructMuxTree(OpBuilder &builder, Location loc, ArrayRef< Value > selectors, ArrayRef< Value > leafNodes, Value outOfBoundsValue)
Construct a mux tree for given leaf nodes.
Definition CombOps.cpp:87
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Definition comb.py:1