[make gcc attributes get output properly
John Meacham <john@repetae.net>**20060127012906] hunk ./C/FromGrin.hs 140
-jhc_malloc = name "jhc_malloc"
+jhc_malloc sz = functionCall (name "jhc_malloc") [sz]
hunk ./C/FromGrin.hs 145
-    return $  (mempty,functionCall jhc_malloc [sizeof node_t])
+    return $  (mempty,jhc_malloc (sizeof node_t))
hunk ./C/FromGrin.hs 151
-        malloc =  tmp `assign` functionCall jhc_malloc [sizeof  (if tagIsWHNF t then st else node_t)]
+        malloc =  tmp `assign` jhc_malloc (sizeof  (if tagIsWHNF t then st else node_t))
hunk ./C/FromGrin.hs 273
+perhapsM :: Monad m => Bool -> a -> m a
+perhapsM True a = return a
+perhapsM False _ = fail "perhapsM"
+
hunk ./C/FromGrin.hs 280
-        fr <- convertType (getType body)
+        let bt = getType body
+            mmalloc (TyPtr _) = [Attribute "A_MALLOC"]
+            mmalloc TyNode = [Attribute "A_MALLOC"]
+            mmalloc _ = []
+            ats = Attribute "A_REGPARM":mmalloc bt
+        fr <- convertType bt
hunk ./C/FromGrin.hs 289
-        return $ function (nodeFuncName n) fr as' [] s
+        return $ function (nodeFuncName n) fr as' ats s
hunk ./C/Generate.hs 7
+    FunctionOpts(..),
hunk ./C/Generate.hs 10
-    tif,
hunk ./C/Generate.hs 297
-data FunctionOpts = Public
+data FunctionOpts = Public | Attribute String
+    deriving(Eq)
hunk ./C/Generate.hs 316
-    let proto = text "static" <+> frt <+> name <> tupled fas' <> semi
-        proto' = text "static" <+> frt $$ name <> tupled fas'
+        proto = static <+> frt <+> name <> tupled fas' <> parms <> semi
+        proto' = static <+> frt <> parms $$ name <> tupled fas'
+        static = if Public `elem` functionOptions f then empty else text "static"
+        parms = char ' ' <> hsep [ text s | Attribute s <- functionOptions f]