diff options
Diffstat (limited to 'Sil/Compile.icl')
-rw-r--r-- | Sil/Compile.icl | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/Sil/Compile.icl b/Sil/Compile.icl index 6475da7..e16cdd9 100644 --- a/Sil/Compile.icl +++ b/Sil/Compile.icl @@ -488,19 +488,17 @@ where gen (Literal _ (ILit i)) = tell ['ABC'.PushI i] *> growStack {zero & bsize=1,btypes=['ABC'.BT_Int]} - gen (App p n args) = gets addresses >>= \addrs -> case 'M'.get n addrs of - Just i -> error C_FunctionOnStack - _ -> gets symbols >>= \syms -> case 'M'.get n syms of - Just fs -> - comment "Retrieve arguments" *> - mapM gen args *> - comment "Apply function" *> - tell [ 'ABC'.Annotation $ toDAnnot` $ map typeSize fs.fs_argtypes - , 'ABC'.Jsr $ toLabel n - , 'ABC'.Annotation $ toOAnnot $ typeSize fs.fs_rettype - ] *> - growStack (foldl (-~) (typeSize fs.fs_rettype) $ map typeSize fs.fs_argtypes) - _ -> error $ C_UndefinedName (errpos p) n + gen (App p n args) = gets symbols >>= \syms -> case 'M'.get n syms of + Just fs -> + comment "Retrieve arguments" *> + mapM gen args *> + comment "Apply function" *> + tell [ 'ABC'.Annotation $ toDAnnot` $ map typeSize fs.fs_argtypes + , 'ABC'.Jsr $ toLabel n + , 'ABC'.Annotation $ toOAnnot $ typeSize fs.fs_rettype + ] *> + growStack (foldl (-~) (typeSize fs.fs_rettype) $ map typeSize fs.fs_argtypes) + _ -> error $ C_UndefinedName (errpos p) n gen (BuiltinApp _ op arg) = gen arg *> gen op |