clang 22.0.0git
LowerToLLVM.h
Go to the documentation of this file.
1//====- LowerToLLVM.h- Lowering from CIR to LLVM --------------------------===//
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 an interface for converting CIR modules to LLVM IR.
10//
11//===----------------------------------------------------------------------===//
12#ifndef CLANG_CIR_LOWERTOLLVM_H
13#define CLANG_CIR_LOWERTOLLVM_H
14
15#include "LowerModule.h"
16
17#include "mlir/Dialect/LLVMIR/LLVMAttrs.h"
18#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
19#include "mlir/Transforms/DialectConversion.h"
21
22namespace cir {
23
24namespace direct {
25
26/// Convert a CIR attribute to an LLVM attribute. May use the datalayout for
27/// lowering attributes to-be-stored in memory.
28mlir::Value lowerCirAttrAsValue(mlir::Operation *parentOp, mlir::Attribute attr,
29 mlir::ConversionPatternRewriter &rewriter,
30 const mlir::TypeConverter *converter);
31
32mlir::LLVM::Linkage convertLinkage(cir::GlobalLinkageKind linkage);
33
34void convertSideEffectForCall(mlir::Operation *callOp, bool isNothrow,
35 cir::SideEffect sideEffect,
36 mlir::LLVM::MemoryEffectsAttr &memoryEffect,
37 bool &noUnwind, bool &willReturn);
38
39#define GET_LLVM_LOWERING_PATTERNS
40#include "clang/CIR/Dialect/IR/CIRLowering.inc"
41#undef GET_LLVM_LOWERING_PATTERNS
42
43} // namespace direct
44} // namespace cir
45
46#endif // CLANG_CIR_LOWERTOLLVM_H
mlir::Value lowerCirAttrAsValue(mlir::Operation *parentOp, const mlir::Attribute attr, mlir::ConversionPatternRewriter &rewriter, const mlir::TypeConverter *converter, cir::LowerModule *lowerMod)
Switches on the type of attribute and calls the appropriate conversion.
void convertSideEffectForCall(mlir::Operation *callOp, bool isNothrow, cir::SideEffect sideEffect, mlir::LLVM::MemoryEffectsAttr &memoryEffect, bool &noUnwind, bool &willReturn)
mlir::LLVM::Linkage convertLinkage(cir::GlobalLinkageKind linkage)