diff --git a/IDEHelper/Compiler/BfIRBuilder.cpp b/IDEHelper/Compiler/BfIRBuilder.cpp index 6413c020..412d44b9 100644 --- a/IDEHelper/Compiler/BfIRBuilder.cpp +++ b/IDEHelper/Compiler/BfIRBuilder.cpp @@ -2367,6 +2367,14 @@ void BfIRBuilder::Write(const BfIRValue& irValue) Write(bitcast->mToType); } break; + case (int)BfConstType_GEP32_1: + { + auto gepConst = (BfConstantGEP32_1*)constant; + BfIRValue targetConst(BfIRValueFlags_Const, gepConst->mTarget); + Write(targetConst); + Write(gepConst->mIdx0); + } + break; case (int)BfConstType_GEP32_2: { auto gepConst = (BfConstantGEP32_2*)constant; diff --git a/IDEHelper/Compiler/BfIRCodeGen.cpp b/IDEHelper/Compiler/BfIRCodeGen.cpp index f31f3119..bf72393b 100644 --- a/IDEHelper/Compiler/BfIRCodeGen.cpp +++ b/IDEHelper/Compiler/BfIRCodeGen.cpp @@ -923,6 +923,16 @@ void BfIRCodeGen::Read(llvm::Value*& llvmValue, BfIRCodeGenEntry** codeGenEntry, llvmValue = llvm::ConstantExpr::getBitCast(target, toType); return; } + else if (constType == BfConstType_GEP32_1) + { + CMD_PARAM(llvm::Constant*, target); + CMD_PARAM(int, idx0); + llvm::Value* gepArgs[] = { + llvm::ConstantInt::get(llvm::Type::getInt32Ty(*mLLVMContext), idx0)}; + + llvmValue = FixGEP(target, llvm::ConstantExpr::getInBoundsGetElementPtr(target->getType()->getPointerElementType(), target, gepArgs)); + return; + } else if (constType == BfConstType_GEP32_2) { CMD_PARAM(llvm::Constant*, target);