deploy-20250820-3 #1
@@ -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<Value*> 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 的方法,无需再关心类型推断的细节
|
||||
|
||||
Reference in New Issue
Block a user