mirror of
https://github.com/cc65/cc65.git
synced 2024-10-19 01:24:38 +00:00
Memory model additions
git-svn-id: svn://svn.cc65.org/cc65/trunk@2693 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
add702a2f0
commit
b520b182d0
@ -38,6 +38,8 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
/* common */
|
/* common */
|
||||||
|
#include "addrsize.h"
|
||||||
|
#include "mmodel.h"
|
||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
|
|
||||||
/* cc65 */
|
/* cc65 */
|
||||||
@ -843,6 +845,13 @@ static FuncDesc* ParseFuncDecl (const DeclSpec* Spec)
|
|||||||
Sym = Sym->PrevSym;
|
Sym = Sym->PrevSym;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Add the default address size for the function */
|
||||||
|
if (CodeAddrSize == ADDR_SIZE_FAR) {
|
||||||
|
F->Flags |= FD_FAR;
|
||||||
|
} else {
|
||||||
|
F->Flags |= FD_NEAR;
|
||||||
|
}
|
||||||
|
|
||||||
/* Leave the lexical level remembering the symbol tables */
|
/* Leave the lexical level remembering the symbol tables */
|
||||||
RememberFunctionLevel (F);
|
RememberFunctionLevel (F);
|
||||||
|
|
||||||
@ -903,7 +912,10 @@ static void ApplyFunctionModifiers (type* T, unsigned Flags)
|
|||||||
Flags &= ~FD_FASTCALL;
|
Flags &= ~FD_FASTCALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add the flags */
|
/* Remove the default function address size modifiers */
|
||||||
|
F->Flags &= ~(FD_NEAR | FD_FAR);
|
||||||
|
|
||||||
|
/* Add the new modifers */
|
||||||
F->Flags |= Flags;
|
F->Flags |= Flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -556,15 +556,23 @@ static void OptListOptSteps (const char* Opt attribute ((unused)),
|
|||||||
static void OptMemoryModel (const char* Opt, const char* Arg)
|
static void OptMemoryModel (const char* Opt, const char* Arg)
|
||||||
/* Set the memory model */
|
/* Set the memory model */
|
||||||
{
|
{
|
||||||
|
mmodel_t M;
|
||||||
|
|
||||||
|
/* Check the current memory model */
|
||||||
if (MemoryModel != MMODEL_UNKNOWN) {
|
if (MemoryModel != MMODEL_UNKNOWN) {
|
||||||
AbEnd ("Cannot use option `%s' twice", Opt);
|
AbEnd ("Cannot use option `%s' twice", Opt);
|
||||||
}
|
}
|
||||||
MemoryModel = FindMemoryModel (Arg);
|
|
||||||
if (MemoryModel == MMODEL_UNKNOWN) {
|
/* Translate the memory model name and check it */
|
||||||
|
M = FindMemoryModel (Arg);
|
||||||
|
if (M == MMODEL_UNKNOWN) {
|
||||||
AbEnd ("Unknown memory model: %s", Arg);
|
AbEnd ("Unknown memory model: %s", Arg);
|
||||||
} else if (MemoryModel == MMODEL_HUGE) {
|
} else if (M == MMODEL_HUGE) {
|
||||||
AbEnd ("Unsupported memory model: %s", Arg);
|
AbEnd ("Unsupported memory model: %s", Arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Set the memory model */
|
||||||
|
SetMemoryModel (M);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user