* src/SDCCast.c (createFunction): also generate non-inlined version of
authorepetrich <epetrich@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Thu, 10 May 2007 05:29:03 +0000 (05:29 +0000)
committerepetrich <epetrich@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Thu, 10 May 2007 05:29:03 +0000 (05:29 +0000)
  function for functions declared as "static inline"
* src/SDCCast.c (fixupInline, inlineAddDecl): reset symbol state so
  function can be inlined after non-inlined version generated.

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4801 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
src/SDCCast.c

index c487f8a253e33e5bc839c818d46ac50707f4fd24..2d3ba146ab95b0276c3290e324ef5ce1bd5cfdfa 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-05-10 Erik Petrich <epetrich AT ivorytower.norman.ok.us>
+
+       * src/SDCCast.c (createFunction): also generate non-inlined version of
+         function for functions declared as "static inline"
+       * src/SDCCast.c (fixupInline, inlineAddDecl): reset symbol state so
+         function can be inlined after non-inlined version generated.
+
 2007-05-10 Borut Razem <borut.razem AT siol.net>
 
        * support/scripts/gen_known_bugs.pl: added script
index 9c929bd9dc0f663d4a59fa4d765e8e9e235a35c7..d48f3c00126d2af0f60a0e136402998bbd26587e 100644 (file)
@@ -5954,6 +5954,10 @@ fixupInline (ast * tree, int level)
       sym->level = level;
       sym->block = currBlockno;
 
+      sym->reqv = NULL;
+      SYM_SPIL_LOC (sym) = NULL;
+      sym->key = 0;
+
       /* If the symbol is a label, we need to renumber it */
       if (sym->islbl)
         fixupInlineLabel (sym);
@@ -6023,6 +6027,9 @@ fixupInline (ast * tree, int level)
 static void
 inlineAddDecl (symbol * sym, ast * block, int addSymTab)
 {
+  sym->reqv = NULL;
+  SYM_SPIL_LOC (sym) = NULL;
+  sym->key = 0;
   if (block != NULL)
     {
       symbol **decl = &(block->values.sym);
@@ -6383,9 +6390,16 @@ createFunction (symbol * name, ast * body)
   if (fatalError)
     goto skipall;
 
-  /* Do not generate code for inline functions unless extern also */
+  /* Do not generate code for inline functions unless extern also. */
+#if 0
   if (FUNC_ISINLINE (name->type) && !IS_EXTERN (fetype))
     goto skipall;
+#else
+  /* Temporary hack: always generate code for static inline functions. */
+  /* Ideally static inline functions should only be generated if needed. */
+  if (FUNC_ISINLINE (name->type) && !IS_EXTERN (fetype) && !IS_STATIC (fetype))
+    goto skipall;
+#endif
 
   /* create the node & generate intermediate code */
   GcurMemmap = code;