diff options
Diffstat (limited to 'Sil/Compile.icl')
-rw-r--r-- | Sil/Compile.icl | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Sil/Compile.icl b/Sil/Compile.icl index 56fef05..3f1059f 100644 --- a/Sil/Compile.icl +++ b/Sil/Compile.icl @@ -330,10 +330,11 @@ where comment (toString st) *> gen e *> findVar n >>= - updateLoc t // TODO should depend on size of return type + updateLoc t where updateLoc :: Type Address -> Gen () updateLoc t (AAddr i) = case (typeSize t, t) of + // TODO should depend on size of return type ({asize=0}, TInt) -> tell ['ABC'.FillI_b 0 i, 'ABC'.Pop_b 1] *> shrinkStack {zero & bsize=1} ({asize=0}, TBool) -> tell ['ABC'.FillB_b 0 i, 'ABC'.Pop_b 1] *> shrinkStack {zero & bsize=1} _ -> tell ['ABC'.Update_a 0 i, 'ABC'.Pop_a 1] *> shrinkStack {zero & asize=1} @@ -349,20 +350,17 @@ where comment "Return" *> gen e *> gets returnType >>= \rettype -> + checkType rettype e *> gets stackoffsets >>= \so -> updateReturnFrame (typeSize rettype) so *> shrinkStack (typeSize rettype) *> - //gets stackoffset >>= \so -> - //tell [ 'ABC'.Update_a 0 0 //-1 // TODO (so-1) - // , 'ABC'.Pop_a 1 - // ] *> //shrinkStack 1 *> TODO cleanup *> tell ['ABC'.Rtn] where updateReturnFrame :: TypeSize (Int, Int) -> Gen () updateReturnFrame {asize=0,bsize=0} _ = nop updateReturnFrame {bsize=0} (aso, _) = tell ['ABC'.Update_a 0 (aso-1), 'ABC'.Pop_a 1] // TODO should depend on return type - updateReturnFrame _ (_, bso) = tell ['ABC'.Update_b 0 (bso-1)] // TODO should depend on return type + updateReturnFrame _ (_, bso) = tell ['ABC'.Update_b 0 (bso-1), 'ABC'.Pop_b 1] // TODO should depend on return type gen (Return Nothing) = comment "Return" *> cleanup *> |