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

Comptime updates, start of metaprogramming support

This commit is contained in:
Brian Fiete 2021-01-08 16:21:03 -08:00
parent be1c099f19
commit 3bbf2d8313
43 changed files with 1562 additions and 885 deletions

View file

@ -941,6 +941,21 @@ void BfIRCodeGen::Read(llvm::Value*& llvmValue, BfIRCodeGenEntry** codeGenEntry)
llvmValue = llvm::UndefValue::get(type);
return;
}
else if (constType == BfConstType_TypeOf)
{
CMD_PARAM(llvm::Type*, type);
llvmValue = mReflectDataMap[type];
BF_ASSERT(llvmValue != NULL);
return;
}
else if (constType == BfConstType_TypeOf_WithData)
{
CMD_PARAM(llvm::Type*, type);
CMD_PARAM(llvm::Value*, value);
mReflectDataMap[type] = value;
llvmValue = value;
return;
}
bool isSigned;
llvm::Type* llvmConstType = GetLLVMType(typeCode, isSigned);
@ -2266,6 +2281,13 @@ void BfIRCodeGen::HandleNextCmd()
SetResult(curId, mIRBuilder->CreateGlobalStringPtr(llvm::StringRef(str.c_str(), str.length())));
}
break;
case BfIRCmd_SetReflectTypeData:
{
CMD_PARAM(llvm::Type*, type);
CMD_PARAM(llvm::Value*, value);
mReflectDataMap[type] = value;
}
break;
case BfIRCmd_CreateBlock:
{
CMD_PARAM(String, name);