[clang] [CIR] Initial implementation of CIR-to-LLVM IR lowering pass (PR #125260)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 31 14:27:59 PST 2025


================
@@ -22,16 +34,156 @@ using namespace llvm;
 namespace cir {
 namespace direct {
 
+struct ConvertCIRToLLVMPass
+    : public mlir::PassWrapper<ConvertCIRToLLVMPass,
+                               mlir::OperationPass<mlir::ModuleOp>> {
+  void getDependentDialects(mlir::DialectRegistry &registry) const override {
+    registry.insert<mlir::BuiltinDialect, mlir::DLTIDialect,
+                    mlir::LLVM::LLVMDialect, mlir::func::FuncDialect>();
+  }
+  void runOnOperation() final;
+
+  StringRef getDescription() const override {
+    return "Convert the prepared CIR dialect module to LLVM dialect";
+  }
+
+  StringRef getArgument() const override { return "cir-flat-to-llvm"; }
+};
+
+// This pass requires the CIR to be in a "flat" state. All blocks in each
----------------
erichkeane wrote:

It doesn't necessarily have to reference only things in this upstream, enough that the future concept is more clear (your example helped, but I'm still only sorta-familiar with it), but enough so that I don't have to ask again next time I see it always saves us time.

https://github.com/llvm/llvm-project/pull/125260


More information about the cfe-commits mailing list