Skip to content

Commit 410665a

Browse files
committed
Move CIRToLLVMGlobalOpLowering to the DirectToLLVM directory
1 parent ce2c8b0 commit 410665a

File tree

3 files changed

+43
-23
lines changed

3 files changed

+43
-23
lines changed

clang/include/clang/CIR/LowerToLLVM.h

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@
1212
#ifndef CLANG_CIR_LOWERTOLLVM_H
1313
#define CLANG_CIR_LOWERTOLLVM_H
1414

15-
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
16-
#include "mlir/Transforms/DialectConversion.h"
17-
#include "clang/CIR/Dialect/IR/CIRDialect.h"
18-
1915
#include <memory>
2016

2117
namespace llvm {
@@ -33,24 +29,6 @@ namespace direct {
3329
std::unique_ptr<llvm::Module>
3430
lowerDirectlyFromCIRToLLVMIR(mlir::ModuleOp mlirModule,
3531
llvm::LLVMContext &llvmCtx);
36-
37-
class CIRToLLVMGlobalOpLowering
38-
: public mlir::OpConversionPattern<cir::GlobalOp> {
39-
mlir::DataLayout const &dataLayout;
40-
41-
public:
42-
CIRToLLVMGlobalOpLowering(const mlir::TypeConverter &typeConverter,
43-
mlir::MLIRContext *context,
44-
mlir::DataLayout const &dataLayout)
45-
: OpConversionPattern(typeConverter, context), dataLayout(dataLayout) {
46-
setHasBoundedRewriteRecursion();
47-
}
48-
49-
mlir::LogicalResult
50-
matchAndRewrite(cir::GlobalOp op, OpAdaptor adaptor,
51-
mlir::ConversionPatternRewriter &rewriter) const override;
52-
};
53-
5432
} // namespace direct
5533
} // namespace cir
5634

clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
#include "clang/CIR/LowerToLLVM.h"
13+
#include "LowerToLLVM.h"
1414

1515
#include "mlir/Conversion/LLVMCommon/TypeConverter.h"
1616
#include "mlir/Dialect/DLTI/DLTI.h"
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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 "mlir/Transforms/DialectConversion.h"
16+
#include "clang/CIR/Dialect/IR/CIRDialect.h"
17+
18+
namespace cir {
19+
20+
namespace direct {
21+
22+
class CIRToLLVMGlobalOpLowering
23+
: public mlir::OpConversionPattern<cir::GlobalOp> {
24+
mlir::DataLayout const &dataLayout;
25+
26+
public:
27+
CIRToLLVMGlobalOpLowering(const mlir::TypeConverter &typeConverter,
28+
mlir::MLIRContext *context,
29+
mlir::DataLayout const &dataLayout)
30+
: OpConversionPattern(typeConverter, context), dataLayout(dataLayout) {
31+
setHasBoundedRewriteRecursion();
32+
}
33+
34+
mlir::LogicalResult
35+
matchAndRewrite(cir::GlobalOp op, OpAdaptor adaptor,
36+
mlir::ConversionPatternRewriter &rewriter) const override;
37+
};
38+
39+
} // namespace direct
40+
} // namespace cir
41+
42+
#endif // CLANG_CIR_LOWERTOLLVM_H

0 commit comments

Comments
 (0)