1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 19:48:20 +02:00

Fixed some undefs

This commit is contained in:
Brian Fiete 2021-01-04 13:31:09 -08:00
parent 156e3dd2fa
commit 8d3d4e71ea
3 changed files with 18 additions and 0 deletions

View file

@ -874,6 +874,12 @@ void BeIRCodeGen::Read(BeValue*& beValue)
beValue = beConst; beValue = beConst;
return; return;
} }
else if (constType == BfConstType_Undef)
{
CMD_PARAM(BeType*, type);
beValue = mBeModule->CreateUndefValue(type);
return;
}
bool isSigned = false; bool isSigned = false;
BeType* llvmConstType = GetBeType(typeCode, isSigned); BeType* llvmConstType = GetBeType(typeCode, isSigned);

View file

@ -1950,6 +1950,12 @@ void BfIRBuilder::Write(const BfIRValue& irValue)
Write(constant->mInt64); Write(constant->mInt64);
} }
break; break;
case (int)BfConstType_Undef:
{
auto undefConst = (BfConstantUndef*)constant;
Write(undefConst->mType);
}
break;
default: default:
{ {
BF_FATAL("Unhandled"); BF_FATAL("Unhandled");

View file

@ -935,6 +935,12 @@ void BfIRCodeGen::Read(llvm::Value*& llvmValue, BfIRCodeGenEntry** codeGenEntry)
return; return;
} }
else if (constType == BfConstType_Undef)
{
CMD_PARAM(llvm::Type*, type);
llvmValue = llvm::UndefValue::get(type);
return;
}
bool isSigned; bool isSigned;
llvm::Type* llvmConstType = GetLLVMType(typeCode, isSigned); llvm::Type* llvmConstType = GetLLVMType(typeCode, isSigned);