1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-09 06:29:38 +00:00
git-svn-id: svn://svn.cc65.org/cc65/trunk@737 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2001-05-21 06:43:46 +00:00
parent 4c19a5b699
commit c1b6680a92
9 changed files with 59 additions and 45 deletions

View File

@ -52,14 +52,6 @@
void AddCodeHint (const char* Hint)
/* Add an optimizer hint */
{
/* ### AddCodeLine ("+%s", Hint); */
}
CodeMark GetCodePos (void)
/* Get a marker pointing to the current output position */
{

View File

@ -62,9 +62,6 @@ typedef unsigned CodeMark;
void AddCodeHint (const char* Hint);
/* Add an optimizer hint */
CodeMark GetCodePos (void);
/* Get a marker pointing to the current output position */

View File

@ -203,8 +203,41 @@ void g_usebss (void)
static void OutputDataLine (DataSeg* S, const char* Format, ...)
/* Add a line to the current data segment */
{
va_list ap;
va_start (ap, Format);
AddDataEntry (S, Format, ap);
va_end (ap);
}
void g_segname (segment_t Seg, const char* Name)
/* Set the name of a segment */
{
DataSeg* S;
/* Remember the new name */
NewSegName (Seg, Name);
/* Emit a segment directive for the data style segments */
switch (Seg) {
case SEG_RODATA: S = CS->ROData; break;
case SEG_DATA: S = CS->Data; break;
case SEG_BSS: S = CS->BSS; break;
default: S = 0; break;
}
if (S) {
OutputDataLine (S, ".segment\t\"%s\"", Name);
}
}
/*****************************************************************************/
/* Code */
/* Code */
/*****************************************************************************/
@ -3207,8 +3240,6 @@ void g_inc (unsigned flags, unsigned long val)
AddCodeLine ("clc");
if ((val & 0xFF) != 0) {
AddCodeLine ("adc #$%02X", (unsigned char) val);
/* Tell the optimizer that the X register may be invalid */
AddCodeHint ("x:!");
}
AddCodeLine ("pha");
AddCodeLine ("txa");
@ -3294,8 +3325,6 @@ void g_dec (unsigned flags, unsigned long val)
AddCodeLine ("sec");
if ((val & 0xFF) != 0) {
AddCodeLine ("sbc #$%02X", (unsigned char) val);
/* Tell the optimizer that the X register may be invalid */
AddCodeHint ("x:!");
}
AddCodeLine ("pha");
AddCodeLine ("txa");

View File

@ -112,10 +112,13 @@ void g_usedata (void);
void g_usebss (void);
/* Switch to the bss segment */
void g_segname (segment_t Seg, const char* Name);
/* Set the name of a segment */
/*****************************************************************************/
/* Functions handling local labels */
/* Functions handling local labels */
/*****************************************************************************/

View File

@ -148,9 +148,10 @@ void GetFuncInfo (const char* Name, unsigned char* Use, unsigned char* Chg)
if (E && E->Owner->PrevTab == 0 && IsTypeFunc (E->Type)) {
/* A function may use the A or A/X registers if it is a fastcall
* function. Otherwise it does not use any registers passed by
* the caller. However, we assume that any function will destroy
* all registers.
* function. If it is not a fastcall function but a variadic one,
* it will use the Y register (the parameter size is passed here).
* In all other cases, no registers are used. However, we assume
* that any function will destroy all registers.
*/
FuncDesc* D = E->V.F.Func;
if ((D->Flags & FD_FASTCALL) != 0 && D->ParamCount > 0) {
@ -161,7 +162,9 @@ void GetFuncInfo (const char* Name, unsigned char* Use, unsigned char* Chg)
} else {
*Use = REG_AX;
}
} else {
} else if ((D->Flags & FD_VARIADIC) != 0) {
*Use = REG_Y;
} else {
/* Will not use any registers */
*Use = REG_NONE;
}

View File

@ -502,7 +502,6 @@ void exprhs (unsigned flags, int k, struct expent *lval)
}
if (lval->e_test & E_FORCETEST) { /* we testing this value? */
/* debug... */
AddCodeHint ("forcetest");
flags |= TypeOf (lval->e_tptr);
g_test (flags); /* yes, force a test */
lval->e_test &= ~E_FORCETEST;
@ -569,9 +568,6 @@ static unsigned FunctionParamList (FuncDesc* Func)
unsigned CFlags;
unsigned Flags;
/* Add a hint for the optimizer */
AddCodeHint ("param:start");
/* Count arguments */
++ParamCount;
@ -659,9 +655,6 @@ static unsigned FunctionParamList (FuncDesc* Func)
ParamSize += ArgSize;
}
/* Add an optimizer hint */
AddCodeHint ("param:end");
/* Check for end of argument list */
if (curtok != TOK_COMMA) {
break;

View File

@ -646,9 +646,6 @@ int main (int argc, char* argv[])
OutputFile = MakeFilename (InputFile, ".s");
}
/* Go! */
Compile ();

View File

@ -37,6 +37,7 @@
#include <string.h>
/* cc65 */
#include "codegen.h"
#include "error.h"
#include "expr.h"
#include "global.h"
@ -49,7 +50,7 @@
/*****************************************************************************/
/* data */
/* data */
/*****************************************************************************/
@ -150,7 +151,7 @@ static void SegNamePragma (segment_t Seg)
if (ValidSegName (Name)) {
/* Set the new name */
NewSegName (Seg, Name);
g_segname (Seg, Name);
} else {
@ -196,19 +197,21 @@ void DoPragma (void)
return;
}
/* Do we know this pragma? */
/* Search for the name, then skip the identifier */
Pragma = FindPragma (CurTok.Ident);
NextToken ();
/* Do we know this pragma? */
if (Pragma == PR_ILLEGAL) {
/* According to the ANSI standard, we're not allowed to generate errors
* for unknown pragmas, however, we're allowed to warn - and we will
* do so. Otherwise one typo may give you hours of bug hunting...
*/
Warning ("Unknown #pragma `%s'", CurTok.Ident);
return;
/* According to the ANSI standard, we're not allowed to generate errors
* for unknown pragmas, however, we're allowed to warn - and we will
* do so. Otherwise one typo may give you hours of bug hunting...
*/
Warning ("Unknown #pragma `%s'", CurTok.Ident);
return;
}
/* Skip the identifier and check for an open paren */
NextToken ();
/* Check for an open paren */
ConsumeLParen ();
/* Switch for the different pragmas */

View File

@ -523,7 +523,6 @@ static void tableswitch (struct expent* eval)
g_defdata (CF_INT | CF_CONST, -((int)lcount)-1, 0);
/* Create the case selector table */
AddCodeHint ("casetable");
p = swtab;
while (lcount) {
g_case (Flags, p->sw_lab, p->sw_const); /* Create one label */
@ -734,9 +733,7 @@ int Statement (void)
break;
default:
AddCodeHint ("stmt:start");
expression (&lval);
AddCodeHint ("stmt:end");
ConsumeSemi ();
}
}