mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 03:28:20 +02:00
Const GEP32_1 support
This commit is contained in:
parent
1195d0e08f
commit
8155d7286a
2 changed files with 18 additions and 0 deletions
|
@ -2367,6 +2367,14 @@ void BfIRBuilder::Write(const BfIRValue& irValue)
|
||||||
Write(bitcast->mToType);
|
Write(bitcast->mToType);
|
||||||
}
|
}
|
||||||
break;
|
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:
|
case (int)BfConstType_GEP32_2:
|
||||||
{
|
{
|
||||||
auto gepConst = (BfConstantGEP32_2*)constant;
|
auto gepConst = (BfConstantGEP32_2*)constant;
|
||||||
|
|
|
@ -923,6 +923,16 @@ void BfIRCodeGen::Read(llvm::Value*& llvmValue, BfIRCodeGenEntry** codeGenEntry,
|
||||||
llvmValue = llvm::ConstantExpr::getBitCast(target, toType);
|
llvmValue = llvm::ConstantExpr::getBitCast(target, toType);
|
||||||
return;
|
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)
|
else if (constType == BfConstType_GEP32_2)
|
||||||
{
|
{
|
||||||
CMD_PARAM(llvm::Constant*, target);
|
CMD_PARAM(llvm::Constant*, target);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue