diff options
Diffstat (limited to 'backendC')
-rw-r--r-- | backendC/CleanCompilerSources/backend.c | 52 | ||||
-rw-r--r-- | backendC/CleanCompilerSources/backend.h | 26 | ||||
-rw-r--r-- | backendC/CleanCompilerSources/compiledefines.h | 2 |
3 files changed, 72 insertions, 8 deletions
diff --git a/backendC/CleanCompilerSources/backend.c b/backendC/CleanCompilerSources/backend.c index aef2907..c375a1d 100644 --- a/backendC/CleanCompilerSources/backend.c +++ b/backendC/CleanCompilerSources/backend.c @@ -170,6 +170,9 @@ static SymbolP gTupleSelectSymbols [MaxNodeArity]; static int number_of_node_ids=0; +typedef IdentP *IdentH; +static IdentH gSpecialIdents[BESpecialIdentCount]; + static IdentP Identifier (char *name) { @@ -536,6 +539,37 @@ GetArrayFunctionType (SymbDefP sdef, TypeNode *elementTypeP, TypeNode *arrayType } } /* GetArrayFunctionType */ +void +BEBindSpecialModule (BESpecialIdentIndex index, int moduleIndex) +{ + BEModuleP module; + + Assert (index >= 0 && index < BESpecialIdentCount); + + Assert ((unsigned int) moduleIndex < gBEState.be_nModules); + module = &gBEState.be_modules [moduleIndex]; + + (*gSpecialIdents [index])->ident_name = module->bem_name; +} /* BEBindSpecialModule */ + +void +BEBindSpecialFunction (BESpecialIdentIndex index, int functionIndex, int moduleIndex) +{ + SymbolP functionSymbol; + BEModuleP module; + + Assert (index >= 0 && index < BESpecialIdentCount); + + Assert ((unsigned int) moduleIndex < gBEState.be_nModules); + module = &gBEState.be_modules [moduleIndex]; + + Assert ((unsigned int) functionIndex < module->bem_nFunctions); + functionSymbol = &module->bem_functions [functionIndex]; + + if (functionSymbol->symb_kind == definition) + *gSpecialIdents [index] = functionSymbol->symb_def->sdef_ident; +} /* BEBindSpecialFunction */ + BESymbolP BESpecialArrayFunctionSymbol (BEArrayFunKind arrayFunKind, int functionIndex, int moduleIndex) { @@ -3522,7 +3556,6 @@ BEInit (int argc) /* +++ remove symbol table from backend */ ScanInitIdentStringTable (); InitScanner (); /* for inlining */ - DeltaBId = Identifier ("StdBool"); ApplyId = Identifier ("AP"); ListId = Identifier ("List"); TupleId = Identifier ("Tuple"); @@ -3535,6 +3568,23 @@ BEInit (int argc) DynamicId = Identifier ("Dynamic"); #endif +#if SA_RECOGNIZES_ABORT_AND_UNDEF + StdMiscId = Identifier ("StdMisc"); + + abort_id = NULL; + undef_id = NULL; + gSpecialIdents [BESpecialIdentStdMisc] = &StdMiscId; + gSpecialIdents [BESpecialIdentAbort] = &abort_id; + gSpecialIdents [BESpecialIdentUndef] = &undef_id; +#endif + + DeltaBId = Identifier ("StdBool"); + AndId = NULL; + OrId = NULL; + gSpecialIdents [BESpecialIdentStdBool] = &DeltaBId; + gSpecialIdents [BESpecialIdentAnd] = &AndId; + gSpecialIdents [BESpecialIdentOr] = &OrId; + UserDefinedArrayFunctions = NULL; #if STRICT_LISTS unboxed_record_cons_list=NULL; diff --git a/backendC/CleanCompilerSources/backend.h b/backendC/CleanCompilerSources/backend.h index 004eb88..8f80be5 100644 --- a/backendC/CleanCompilerSources/backend.h +++ b/backendC/CleanCompilerSources/backend.h @@ -1,15 +1,15 @@ /* version info */ // increment this for every release -# define kBEVersionCurrent 0x02000214 +# define kBEVersionCurrent 0x02000215 -// change this to the same value as kBEVersionCurrent if the new release is not -// upward compatible (for example when a function is added) +// change this to the same value as kBEVersionCurrent if the new release is +// not upward compatible (for example when a function is added) # define kBEVersionOldestDefinition 0x02000213 -// change this to the same value as kBEVersionCurrent if the new release is not -// downward compatible (for example when a function is removed) -# define kBEVersionOldestImplementation 0x02000214 +// change this to the same value as kBEVersionCurrent if the new release is +// not downward compatible (for example when a function is removed) +# define kBEVersionOldestImplementation 0x02000215 # define kBEDebug 1 @@ -161,7 +161,15 @@ enum { BEUpdateDummy, BEUpdate, BEUpdate_U }; +typedef int BESpecialIdentIndex; +Clean (::BESpecialIdentIndex :== Int) +enum { + /* StdMisc */ + BESpecialIdentStdMisc, BESpecialIdentAbort, BESpecialIdentUndef, + BESpecialIdentStdBool, BESpecialIdentAnd, BESpecialIdentOr, + BESpecialIdentCount +}; /* functions */ void BEGetVersion (int *current, int *oldestDefinition, int *oldestImplementation); @@ -179,6 +187,12 @@ Clean (BEArg :: String BackEnd -> BackEnd) void BEDeclareModules (int nModules); Clean (BEDeclareModules :: Int BackEnd -> BackEnd) +void BEBindSpecialModule (BESpecialIdentIndex index, int moduleIndex); +Clean (BEBindSpecialModule :: BESpecialIdentIndex Int BackEnd -> BackEnd) + +void BEBindSpecialFunction (BESpecialIdentIndex index, int functionIndex, int moduleIndex); +Clean (BEBindSpecialFunction :: BESpecialIdentIndex Int Int BackEnd -> BackEnd) + BESymbolP BESpecialArrayFunctionSymbol (BEArrayFunKind arrayFunKind, int functionIndex, int moduleIndex); Clean (BESpecialArrayFunctionSymbol :: BEArrayFunKind Int Int BackEnd -> (BESymbolP, BackEnd)) diff --git a/backendC/CleanCompilerSources/compiledefines.h b/backendC/CleanCompilerSources/compiledefines.h index df91918..3c714ca 100644 --- a/backendC/CleanCompilerSources/compiledefines.h +++ b/backendC/CleanCompilerSources/compiledefines.h @@ -18,7 +18,7 @@ #define WRITE_DCL_MODIFICATION_TIME 1 -#define SA_RECOGNIZES_ABORT_AND_UNDEF 0 +#define SA_RECOGNIZES_ABORT_AND_UNDEF 1 #define STRICT_LISTS 1 |