From ed55edabc84641921afb7d4a279731b8f6e78cc1 Mon Sep 17 00:00:00 2001 From: Anirudh Sundar Date: Thu, 23 Feb 2023 15:37:54 +0530 Subject: [PATCH] [LLVM] Add support for DeclBufferNode `DeclBufferNode` was added recently in #12300, but support to traverse it in codegen_llvm was not added. Since this just stmt just declares a new buffer for a body of TIR, we just need to traverse the body to properly generate code for LLVM. --- src/target/llvm/codegen_llvm.cc | 5 +++++ src/target/llvm/codegen_llvm.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/target/llvm/codegen_llvm.cc b/src/target/llvm/codegen_llvm.cc index dcca33732060..87b85290b0af 100644 --- a/src/target/llvm/codegen_llvm.cc +++ b/src/target/llvm/codegen_llvm.cc @@ -1962,6 +1962,11 @@ void CodeGenLLVM::VisitStmt_(const SeqStmtNode* op) { } } +void CodeGenLLVM::VisitStmt_(const DeclBufferNode* op) { + EmitDebugLocation(op); + VisitStmt(op->body); +} + void CodeGenLLVM::VisitStmt_(const EvaluateNode* op) { EmitDebugLocation(op); MakeValue(op->value); diff --git a/src/target/llvm/codegen_llvm.h b/src/target/llvm/codegen_llvm.h index 632cfaafc51a..62b0b0cc4bd8 100644 --- a/src/target/llvm/codegen_llvm.h +++ b/src/target/llvm/codegen_llvm.h @@ -223,6 +223,7 @@ class CodeGenLLVM : public ExprFunctor, void VisitStmt_(const LetStmtNode* op) override; void VisitStmt_(const SeqStmtNode* op) override; void VisitStmt_(const EvaluateNode* op) override; + void VisitStmt_(const DeclBufferNode* op) override; // Get constant string llvm::Constant* GetConstString(const std::string& str);