X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fcc65%2Fcodeinfo.c;h=322b471ff0e8109a9bfb0d906d870ff67a7cb614;hb=4a667ead00c10797fb57298b3dd33c2efc6c8d3f;hp=74a704a9614efac21f75677575f29fef901ffe52;hpb=2e5fa9575c7dce0b875b4053f78f0c3a5693eafe;p=cc65 diff --git a/src/cc65/codeinfo.c b/src/cc65/codeinfo.c index 74a704a96..322b471ff 100644 --- a/src/cc65/codeinfo.c +++ b/src/cc65/codeinfo.c @@ -154,15 +154,20 @@ static const FuncInfo FuncInfoTable[] = { { "push7", REG_NONE, REG_AXY }, { "pusha", REG_A, REG_Y }, { "pusha0", REG_A, REG_XY }, - { "pushax", REG_AX, REG_Y }, { "pusha0sp", REG_NONE, REG_AY }, + { "pushax", REG_AX, REG_Y }, { "pushaysp", REG_Y, REG_AY }, { "pushc0", REG_NONE, REG_A | REG_Y }, { "pushc1", REG_NONE, REG_A | REG_Y }, { "pushc2", REG_NONE, REG_A | REG_Y }, { "pusheax", REG_EAX, REG_Y }, + { "pushw", REG_AX, REG_AXY | REG_PTR1 }, { "pushw0sp", REG_NONE, REG_AXY }, + { "pushwidx", REG_AXY, REG_AXY | REG_PTR1 }, { "pushwysp", REG_Y, REG_AXY }, + { "regswap", REG_AXY, REG_AXY | REG_TMP1 }, + { "regswap1", REG_XY, REG_A }, + { "regswap2", REG_XY, REG_A | REG_Y }, { "shlax1", REG_AX, REG_AX | REG_TMP1 }, { "shlax2", REG_AX, REG_AX | REG_TMP1 }, { "shlax3", REG_AX, REG_AX | REG_TMP1 }, @@ -282,8 +287,7 @@ void GetFuncInfo (const char* Name, unsigned short* Use, unsigned short* Chg) FuncDesc* D = E->V.F.Func; if ((D->Flags & FD_FASTCALL) != 0 && D->ParamCount > 0) { /* Will use registers depending on the last param */ - SymEntry* LastParam = D->SymTab->SymTail; - unsigned LastParamSize = CheckedSizeOf (LastParam->Type); + unsigned LastParamSize = CheckedSizeOf (D->LastParam->Type); if (LastParamSize == 1) { *Use = REG_A; } else if (LastParamSize == 2) { @@ -590,6 +594,14 @@ int RegAXUsed (struct CodeSeg* S, unsigned Index) +int RegEAXUsed (struct CodeSeg* S, unsigned Index) +/* Check if any of the four bytes in EAX are used. */ +{ + return (GetRegInfo (S, Index, REG_EAX) & REG_EAX) != 0; +} + + + unsigned GetKnownReg (unsigned Use, const RegContents* RC) /* Return the register or zero page location from the set in Use, thats * contents are known. If Use does not contain any register, or if the @@ -604,6 +616,10 @@ unsigned GetKnownReg (unsigned Use, const RegContents* RC) return (RC == 0 || RC->RegY >= 0)? REG_Y : REG_NONE; } else if ((Use & REG_TMP1) != 0) { return (RC == 0 || RC->Tmp1 >= 0)? REG_TMP1 : REG_NONE; + } else if ((Use & REG_PTR1_LO) != 0) { + return (RC == 0 || RC->Ptr1Lo >= 0)? REG_PTR1_LO : REG_NONE; + } else if ((Use & REG_PTR1_HI) != 0) { + return (RC == 0 || RC->Ptr1Hi >= 0)? REG_PTR1_HI : REG_NONE; } else if ((Use & REG_SREG_LO) != 0) { return (RC == 0 || RC->SRegLo >= 0)? REG_SREG_LO : REG_NONE; } else if ((Use & REG_SREG_HI) != 0) { @@ -613,7 +629,7 @@ unsigned GetKnownReg (unsigned Use, const RegContents* RC) } } - + static cmp_t FindCmpCond (const char* Code, unsigned CodeLen) /* Search for a compare condition by the given code using the given length */