From 18dc8dbfee211e89246f5ae324e09917436878ac Mon Sep 17 00:00:00 2001 From: rain2133 <1370973498@qq.com> Date: Thu, 24 Jul 2025 17:05:56 +0800 Subject: [PATCH] =?UTF-8?q?[midend]=E4=BF=AE=E6=94=B9=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SysYIRGenerator.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/SysYIRGenerator.cpp b/src/SysYIRGenerator.cpp index eaa7ad0..32a07aa 100644 --- a/src/SysYIRGenerator.cpp +++ b/src/SysYIRGenerator.cpp @@ -44,10 +44,10 @@ Value* SysYIRGenerator::getGEPAddressInst(Value* basePointer, const std::vector< // 检查 basePointer 是否为指针类型 assert(basePointer->getType()->isPointer()); - // GEP 的第一个索引通常是0,用于“穿过”指针本身,访问其指向的对象。 - // 例如,对于全局数组 @arr,其类型为 [6 x i32]*,第一个0索引是必需的。 + // GEP 的第一个索引通常是0,用于“步过”指针本身,访问其指向的对象。 + // 例如,对于全局数组 @arr,其类型为 [6 x i32]*,第一个0索引是必需的步过偏移。 std::vector actualGEPIndices; - actualGEPIndices.push_back(ConstantInteger::get(0)); // 模拟 ConstantInteger::get(0) + actualGEPIndices.push_back(ConstantInteger::get(0)); actualGEPIndices.insert(actualGEPIndices.end(), indices.begin(), indices.end()); // 直接调用 builder 的方法,无需再关心类型推断的细节