From f99ef4322a7a2c09380fff61f88ab9440f05a92c Mon Sep 17 00:00:00 2001 From: Richard-Qin-X Date: Fri, 7 Aug 2026 22:06:28 +0800 Subject: [CodeGen] Complete machine pass and ABI lowering infrastructure --- backend/lib/CodeGen/MachineIRBuilder.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'backend/lib/CodeGen/MachineIRBuilder.cpp') diff --git a/backend/lib/CodeGen/MachineIRBuilder.cpp b/backend/lib/CodeGen/MachineIRBuilder.cpp index e1e8006..6887804 100644 --- a/backend/lib/CodeGen/MachineIRBuilder.cpp +++ b/backend/lib/CodeGen/MachineIRBuilder.cpp @@ -650,6 +650,19 @@ Expected MachineIRBuilder::validateInstruction(const MachineInstr &Instruc return {}; } +Expected MachineIRBuilder::verifyInsertPoint() const { + if (InsertBlock == nullptr) + return makeUnexpected(ErrorCode::InvalidArgument, "machine IR builder has no insertion point"); + auto BlockValidation = validateBlock(*InsertBlock); + if (!BlockValidation) + return std::unexpected(BlockValidation.error()); + if (InsertBefore != nullptr && InsertBefore->parent() != InsertBlock) { + return makeUnexpected(ErrorCode::InvalidArgument, + "machine IR builder insertion cursor is no longer in its block"); + } + return {}; +} + Expected MachineIRBuilder::setInsertPoint(MachineBasicBlock &Block) { auto Validation = validateBlock(Block); if (!Validation) -- cgit v1.2.3