45 lines · c
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-exception6//7//===----------------------------------------------------------------------===//8//9// This file declares an interface for converting CIR modules to LLVM IR.10//11//===----------------------------------------------------------------------===//12#ifndef CLANG_CIR_LOWERTOLLVM_H13#define CLANG_CIR_LOWERTOLLVM_H14 15#include "mlir/Dialect/LLVMIR/LLVMAttrs.h"16#include "mlir/Dialect/LLVMIR/LLVMDialect.h"17#include "mlir/Transforms/DialectConversion.h"18#include "clang/CIR/Dialect/IR/CIRDialect.h"19 20namespace cir {21 22namespace direct {23 24/// Convert a CIR attribute to an LLVM attribute. May use the datalayout for25/// lowering attributes to-be-stored in memory.26mlir::Value lowerCirAttrAsValue(mlir::Operation *parentOp, mlir::Attribute attr,27 mlir::ConversionPatternRewriter &rewriter,28 const mlir::TypeConverter *converter);29 30mlir::LLVM::Linkage convertLinkage(cir::GlobalLinkageKind linkage);31 32void convertSideEffectForCall(mlir::Operation *callOp, bool isNothrow,33 cir::SideEffect sideEffect,34 mlir::LLVM::MemoryEffectsAttr &memoryEffect,35 bool &noUnwind, bool &willReturn);36 37#define GET_LLVM_LOWERING_PATTERNS38#include "clang/CIR/Dialect/IR/CIRLowering.inc"39#undef GET_LLVM_LOWERING_PATTERNS40 41} // namespace direct42} // namespace cir43 44#endif // CLANG_CIR_LOWERTOLLVM_H45