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

Fixed 'let' of a string literal

This commit is contained in:
Brian Fiete 2020-02-13 08:43:45 -08:00
parent 7b9c994066
commit 2b0f7fb485

View file

@ -8015,6 +8015,8 @@ void BeMCContext::DoActualization()
auto inst = mcBlock->mInstructions[instIdx]; auto inst = mcBlock->mInstructions[instIdx];
SetCurrentInst(inst); SetCurrentInst(inst);
bool forceMove = false;
if (inst->mKind == BeMCInstKind_DbgDecl) if (inst->mKind == BeMCInstKind_DbgDecl)
{ {
auto vregInfo = GetVRegInfo(inst->mArg0); auto vregInfo = GetVRegInfo(inst->mArg0);
@ -8022,7 +8024,11 @@ void BeMCContext::DoActualization()
{ {
if (inst->mArg0.mKind == BeMCOperandKind_VReg) if (inst->mArg0.mKind == BeMCOperandKind_VReg)
{ {
if (vregInfo->mDbgVariable->mIsValue) if (vregInfo->mRelTo.IsSymbol())
{
forceMove = true;
}
else if (vregInfo->mDbgVariable->mIsValue)
{ {
vregInfo->mDbgVariable->mIsValue = false; vregInfo->mDbgVariable->mIsValue = false;
inst->mArg0.mKind = BeMCOperandKind_VRegAddr; inst->mArg0.mKind = BeMCOperandKind_VRegAddr;
@ -8032,22 +8038,16 @@ void BeMCContext::DoActualization()
inst->mArg0.mKind = BeMCOperandKind_VRegAddr; inst->mArg0.mKind = BeMCOperandKind_VRegAddr;
vregInfo->mDbgVariable->mType = mModule->mDbgModule->CreateReferenceType(vregInfo->mDbgVariable->mType); vregInfo->mDbgVariable->mType = mModule->mDbgModule->CreateReferenceType(vregInfo->mDbgVariable->mType);
} }
// if (auto ptrType = BeValueDynCast<BeDbgPointerType>(vregInfo->mDbgVariable->mType))
// vregInfo->mDbgVariable->mType = ptrType->mElement;
// if (vregInfo->mType->IsPointer())
// vregInfo->mType = ((BePointerType*)vregInfo->mType)->mElementType;
} }
vregInfo->mWantsExprActualize = false; vregInfo->mWantsExprActualize = false;
} }
} }
if (inst->IsDef()) if ((inst->IsDef()) || (forceMove))
{ {
int vregIdx = inst->mArg0.mVRegIdx; int vregIdx = inst->mArg0.mVRegIdx;
auto vregInfo = GetVRegInfo(inst->mArg0); auto vregInfo = GetVRegInfo(inst->mArg0);
if (vregInfo->mWantsExprActualize) if ((vregInfo->mWantsExprActualize) || (forceMove))
{ {
if (vregInfo->mDbgVariable != NULL) if (vregInfo->mDbgVariable != NULL)
{ {
@ -14751,7 +14751,7 @@ void BeMCContext::Generate(BeFunction* function)
mDbgPreferredRegs[32] = X64Reg_R8;*/ mDbgPreferredRegs[32] = X64Reg_R8;*/
//mDbgPreferredRegs[8] = X64Reg_RAX; //mDbgPreferredRegs[8] = X64Reg_RAX;
//mDebugging = function->mName == "?Do@ClassA@bf@@QEAAXXZ"; //mDebugging = function->mName == "?TestTagCount@Program@bf@@SAXXZ";
//"?ColorizeCodeString@IDEUtils@IDE@bf@@SAXPEAVString@System@3@W4CodeKind@123@@Z"; //"?ColorizeCodeString@IDEUtils@IDE@bf@@SAXPEAVString@System@3@W4CodeKind@123@@Z";
//"?Main@Program@bf@@CAHPEAV?$Array1@PEAVString@System@bf@@@System@2@@Z"; //"?Main@Program@bf@@CAHPEAV?$Array1@PEAVString@System@bf@@@System@2@@Z";