Enzyme main
Loading...
Searching...
No Matches
Utils.h
Go to the documentation of this file.
1//===- Utils.h - General Utilities -------* 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#pragma once
9
10#include "Dialect/Ops.h"
11#include "mlir/Dialect/Linalg/IR/Linalg.h"
12namespace mlir {
13namespace enzyme {
14
15class Utils {
16public:
17 static mlir::linalg::GenericOp adjointToGeneric(enzyme::GenericAdjointOp &op,
18 OpBuilder &builder,
19 Location loc);
20};
21
22bool blockCmp(mlir::Block *a, mlir::Block *b);
23
24bool opCmp(mlir::Operation *a, mlir::Operation *b);
25
26bool regionCmp(mlir::Region *a, mlir::Region *b);
27
28// This function returns whether a < b
29bool valueCmp(mlir::Value a, mlir::Value b);
30
31Type getConcatType(Value val, int64_t width);
32
33Value getConcatValue(OpBuilder &builder, Location loc, ArrayRef<Value> argList);
34
35Value getExtractValue(OpBuilder &builder, Location loc, Type argTy, Value val,
36 int64_t index);
37
38void computeAffineIndices(OpBuilder &builder, Location loc, AffineMap map,
39 ValueRange operands, SmallVectorImpl<Value> &indices);
40
41} // namespace enzyme
42} // namespace mlir
static mlir::linalg::GenericOp adjointToGeneric(enzyme::GenericAdjointOp &op, OpBuilder &builder, Location loc)
Definition Utils.cpp:15
bool valueCmp(mlir::Value a, mlir::Value b)
Definition Utils.cpp:104
Type getConcatType(Value val, int64_t width)
Definition Utils.cpp:133
bool blockCmp(mlir::Block *a, mlir::Block *b)
Value getConcatValue(OpBuilder &builder, Location loc, ArrayRef< Value > argList)
Definition Utils.cpp:155
bool opCmp(mlir::Operation *a, mlir::Operation *b)
bool regionCmp(mlir::Region *a, mlir::Region *b)
void computeAffineIndices(OpBuilder &builder, Location loc, AffineMap map, ValueRange operands, SmallVectorImpl< Value > &indices)
Definition Utils.cpp:171
Value getExtractValue(OpBuilder &builder, Location loc, Type argTy, Value val, int64_t index)
Definition Utils.cpp:163