Add global inline assembler optimization for static const to immediate propagation

This commit is contained in:
drmortalwombat 2024-05-19 20:48:14 +02:00
parent 80b1683fa2
commit ab06d85a91

View File

@ -10944,6 +10944,20 @@ Expression* Parser::ParseAssembler(void)
{
if (HasAsmInstructionMode(ilast->mAsmInsType, ASMIM_RELATIVE))
ilast->mAsmInsMode = ASMIM_RELATIVE;
else if (
HasAsmInstructionMode(ilast->mAsmInsType, ASMIM_IMMEDIATE) &&
ilast->mLeft &&
ilast->mLeft->mType == EX_CONSTANT &&
ilast->mLeft->mDecValue->mType == DT_VARIABLE &&
(ilast->mLeft->mDecValue->mFlags & DTF_CONST) &&
(ilast->mLeft->mDecValue->mFlags & DTF_STATIC) &&
ilast->mLeft->mDecType->IsIntegerType() &&
ilast->mLeft->mDecValue->mValue &&
ilast->mLeft->mDecValue->mValue->mType == EX_CONSTANT)
{
ilast->mAsmInsMode = ASMIM_IMMEDIATE;
ilast->mLeft = ilast->mLeft->mDecValue->mValue;
}
else
ilast->mAsmInsMode = ASMIM_ABSOLUTE;
}