CIRCT 20.0.0git
Loading...
Searching...
No Matches
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/InferTypeOpInterface.h"
24#include "mlir/Interfaces/SideEffectInterfaces.h"
25
26namespace llvm {
27struct KnownBits;
28}
29
30namespace mlir {
31class PatternRewriter;
32}
33
34#define GET_OP_CLASSES
35#include "circt/Dialect/Comb/Comb.h.inc"
36
37namespace circt {
38namespace comb {
39
40using llvm::KnownBits;
41
42/// Compute "known bits" information about the specified value - the set of bits
43/// that are guaranteed to always be zero, and the set of bits that are
44/// guaranteed to always be one (these must be exclusive!). A bit that exists
45/// in neither set is unknown.
46KnownBits computeKnownBits(Value value);
47
48/// Create a sign extension operation from a value of integer type to an equal
49/// or larger integer type.
50Value createOrFoldSExt(Location loc, Value value, Type destTy,
51 OpBuilder &builder);
52Value createOrFoldSExt(Value value, Type destTy, ImplicitLocOpBuilder &builder);
53
54/// Create a ``Not'' gate on a value.
55Value createOrFoldNot(Location loc, Value value, OpBuilder &builder,
56 bool twoState = false);
57Value createOrFoldNot(Value value, ImplicitLocOpBuilder &builder,
58 bool twoState = false);
59
60/// Extract bits from a value.
61void extractBits(OpBuilder &builder, Value val, SmallVectorImpl<Value> &bits);
62
63/// Construct a mux tree for given leaf nodes. `selectors` is the selector for
64/// each level of the tree. Currently the selector is tested from MSB to LSB.
65Value constructMuxTree(OpBuilder &builder, Location loc,
66 ArrayRef<Value> selectors, ArrayRef<Value> leafNodes,
67 Value outOfBoundsValue);
68
69} // namespace comb
70} // namespace circt
71
72#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