X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fcc65%2Fcodeent.h;h=60fc28bf85d0b7e706cf70f3e88dd65480bf3f07;hb=73dfa23c987d8a7f1154801b85c171f9e01dcd58;hp=ec7e7a354b5077cb4bdd7b1b8b33860a613a333d;hpb=a6aa5512d5f8f17340ea1a5e701099cd4d6ec5f4;p=cc65 diff --git a/src/cc65/codeent.h b/src/cc65/codeent.h index ec7e7a354..60fc28bf8 100644 --- a/src/cc65/codeent.h +++ b/src/cc65/codeent.h @@ -6,10 +6,10 @@ /* */ /* */ /* */ -/* (C) 2001 Ullrich von Bassewitz */ -/* Wacholderweg 14 */ -/* D-70597 Stuttgart */ -/* EMail: uz@musoftware.de */ +/* (C) 2001-2002 Ullrich von Bassewitz */ +/* Wacholderweg 14 */ +/* D-70597 Stuttgart */ +/* EMail: uz@musoftware.de */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ @@ -39,6 +39,7 @@ #include +#include /* common */ #include "coll.h" @@ -88,8 +89,16 @@ struct CodeEntry { +const char* MakeHexArg (unsigned Num); +/* Convert Num into a string in the form $XY, suitable for passing it as an + * argument to NewCodeEntry, and return a pointer to the string. + * BEWARE: The function returns a pointer to a static buffer, so the value is + * gone if you call it twice (and apart from that it's not thread and signal + * safe). + */ + CodeEntry* NewCodeEntry (opc_t OPC, am_t AM, const char* Arg, - CodeLabel* JumpTo, LineInfo* LI); + CodeLabel* JumpTo, LineInfo* LI); /* Create a new code entry, initialize and return it */ void FreeCodeEntry (CodeEntry* E); @@ -177,6 +186,21 @@ void CE_SetNumArg (CodeEntry* E, long Num); int CE_KnownImm (const CodeEntry* E); /* Return true if the argument of E is a known immediate value */ +#if defined(HAVE_INLINE) +INLINE int CE_IsCallTo (const CodeEntry* E, const char* Name) +/* Check if this is a call to the given function */ +{ + return (E->OPC == OP65_JSR && strcmp (E->Arg, Name) == 0); +} +#else +# define CE_IsCallTo(E, Name) ((E)->OPC == OP65_JSR && strcmp ((E)->Arg, (Name)) == 0) +#endif + +int CE_UseLoadFlags (const CodeEntry* E); +/* Return true if the instruction uses any flags that are set by a load of + * a register (N and Z). + */ + void CE_FreeRegInfo (CodeEntry* E); /* Free an existing register info struct */