| 1 | //===- LLVMGeneralIntrinsicOps.cpp - LLVM general intrinsics --------------===// |
| 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 defines the ops of op partition `GeneralIntrinsic` of the LLVM |
| 10 | // dialect. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #include "mlir/Dialect/LLVMIR/LLVMGeneralIntrinsicOps.h" |
| 15 | |
| 16 | #include "IR/LLVMOps.h" |
| 17 | #include "mlir/IR/Builders.h" |
| 18 | #include "mlir/IR/DialectImplementation.h" |
| 19 | |
| 20 | using namespace mlir; |
| 21 | using namespace mlir::LLVM; |
| 22 | |
| 23 | //===----------------------------------------------------------------------===// |
| 24 | // AssumeOp (intrinsic) |
| 25 | //===----------------------------------------------------------------------===// |
| 26 | |
| 27 | void LLVM::AssumeOp::build(OpBuilder &builder, OperationState &state, |
| 28 | mlir::Value cond) { |
| 29 | return build(odsBuilder&: builder, odsState&: state, cond, /*op_bundle_operands=*/{}, |
| 30 | /*op_bundle_tags=*/ArrayAttr{}); |
| 31 | } |
| 32 | |
| 33 | void LLVM::AssumeOp::build(OpBuilder &builder, OperationState &state, |
| 34 | Value cond, llvm::StringRef tag, ValueRange args) { |
| 35 | return build(odsBuilder&: builder, odsState&: state, cond, op_bundle_operands: ArrayRef<ValueRange>(args), |
| 36 | op_bundle_tags: builder.getStrArrayAttr(values: tag)); |
| 37 | } |
| 38 | |
| 39 | void LLVM::AssumeOp::build(OpBuilder &builder, OperationState &state, |
| 40 | Value cond, AssumeAlignTag, Value ptr, Value align) { |
| 41 | return build(builder, state, cond, tag: "align" , args: ValueRange{ptr, align}); |
| 42 | } |
| 43 | |
| 44 | void LLVM::AssumeOp::build(OpBuilder &builder, OperationState &state, |
| 45 | Value cond, AssumeSeparateStorageTag, Value ptr1, |
| 46 | Value ptr2) { |
| 47 | return build(builder, state, cond, tag: "separate_storage" , |
| 48 | args: ValueRange{ptr1, ptr2}); |
| 49 | } |
| 50 | |
| 51 | LogicalResult LLVM::AssumeOp::verify() { return verifyOperandBundles(op&: *this); } |
| 52 | |
| 53 | #define GET_OP_CLASSES |
| 54 | #include "mlir/Dialect/LLVMIR/LLVMGeneralIntrinsicOps.cpp.inc" |
| 55 | |