| 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" |
| 20 |
#include "clang/CIR/Dialect/IR/CIRDialect.h" |
| 21 |
|
| 22 |
namespace cir { |
| 23 |
|
| 24 |
namespace direct { |
| 25 |
|
| 26 |
/// Convert a CIR attribute to an LLVM attribute. May use the datalayout for |
| 27 |
/// lowering attributes to-be-stored in memory. |
| 28 |
mlir::Value lowerCirAttrAsValue(mlir::Operation *parentOp, mlir::Attribute attr, |
| 29 |
mlir::ConversionPatternRewriter &rewriter, |
| 30 |
const mlir::TypeConverter *converter); |
| 31 |
|
| 32 |
mlir::LLVM::Linkage convertLinkage(cir::GlobalLinkageKind linkage); |
| 33 |
|
| 34 |
void 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 |