aboutsummaryrefslogtreecommitdiff
path: root/backendC/CleanCompilerSources/instructions.c
diff options
context:
space:
mode:
authorjohnvg2007-09-03 12:00:47 +0000
committerjohnvg2007-09-03 12:00:47 +0000
commit7c27b29ef52b7d50849777c4109601e552e4008a (patch)
tree000c5bef9447ec59a2e93ae5071063601ca84415 /backendC/CleanCompilerSources/instructions.c
parentmake elements of array generators unique (for arrays with unique elements) (diff)
add ( , and ) in type string of .record to print unboxed tuples in constructors and records
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@1681 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
Diffstat (limited to 'backendC/CleanCompilerSources/instructions.c')
-rw-r--r--backendC/CleanCompilerSources/instructions.c39
1 files changed, 32 insertions, 7 deletions
diff --git a/backendC/CleanCompilerSources/instructions.c b/backendC/CleanCompilerSources/instructions.c
index faf4409..0e94de2 100644
--- a/backendC/CleanCompilerSources/instructions.c
+++ b/backendC/CleanCompilerSources/instructions.c
@@ -1092,11 +1092,24 @@ static void GenABStackElems (StateS state)
switch (state.state_type){
case TupleState:
- argstates = state.state_tuple_arguments;
+ argstates = state.state_tuple_arguments;
+ FPutC ('(', OutFile);
+ if (state.state_arity>0){
+ GenABStackElems (argstates[0]);
+ for (arity=1; arity < state.state_arity; arity++){
+ FPutC (',', OutFile);
+ GenABStackElems (argstates[arity]);
+ }
+ }
+ FPutC (')', OutFile);
break;
case RecordState:
argstates = state.state_record_arguments;
- break;
+ FPutC ('(', OutFile);
+ for (arity=0; arity < state.state_arity; arity++)
+ GenABStackElems (argstates[arity]);
+ FPutC (')', OutFile);
+ return;
case ArrayState:
FPutC ('a', OutFile);
return;
@@ -1104,11 +1117,22 @@ static void GenABStackElems (StateS state)
error_in_function ("GenABStackElems");
return;
}
- for (arity=0; arity < state.state_arity; arity++)
- GenABStackElems (argstates[arity]);
}
}
+static void GenABStackElemsOfRecord (StateS state)
+{
+ if (state.state_type==RecordState){
+ int arity;
+ States argstates;
+
+ argstates = state.state_record_arguments;
+ for (arity=0; arity < state.state_arity; ++arity)
+ GenABStackElems (argstates[arity]);
+ } else
+ GenABStackElems (state);
+}
+
void GenDStackLayout (int asize,int bsize,Args fun_args)
{
if (DoStackLayout){
@@ -2829,8 +2853,8 @@ void GenRecordDescriptor (SymbDef sdef)
}
recstate = sdef->sdef_record_state;
-
- GenABStackElems (recstate);
+
+ GenABStackElemsOfRecord (recstate);
DetermineSizeOfState (recstate,&asize,&bsize);
@@ -2868,7 +2892,8 @@ void GenUnboxedConsRecordDescriptor (SymbDef sdef,int tail_strict)
FPutC ('l', OutFile);
FPutC ('R', OutFile);
- GenABStackElems (tuple_state);
+ GenABStackElemsOfRecord (tuple_arguments_state[0]);
+ GenABStackElems (tuple_arguments_state[1]);
DetermineSizeOfState (tuple_state,&asize,&bsize);