Applied patch #2762516
[fw/sdcc] / src / pic / pcodeflow.c
index 2a4207194863ee8a5ee45542e2f5abaf366bccb0..decf0881f1bfe08cf8b1b7c8455dc97733248c49 100644 (file)
 
 */
 
-#include <stdio.h>
-
-#include "common.h"   // Include everything in the SDCC src directory
-#include "newalloc.h"
-#include "ralloc.h"
-#include "device.h"
-#include "pcode.h"
-#include "pcoderegs.h"
 #include "pcodeflow.h"
 
 #if 0
-
-/* 
-In the section that follows, an exhaustive flow "tree" is built.
-It's not a tree that's really built, but instead every possible
-flow path is constructed. 
-
-  This is really overkill...
-*/
-
-static set *FlowTree=NULL;
-
-void dbg_dumpFlowTree(set *FlowTree)
-{
-       set *segment;
-       pCodeFlow *pcflow;
-       
-       fprintf(stderr,"Flow Tree: \n");
-       
-       for(segment = setFirstItem(FlowTree); segment; segment=setNextItem(FlowTree)) {
-               
-               fprintf(stderr,"Segment:\n");
-               
-               for(pcflow=PCFL(setFirstItem(segment)); pcflow; pcflow=PCFL(setNextItem(segment))) {
-                       fprintf(stderr, "  0x%03x",pcflow->pc.seq);
-               }
-               fprintf(stderr,"\n");
-       }
-       
-}
-
-
-
-
-/*-----------------------------------------------------------------*
-* void BuildFlowSegment(set *segment, pCodeFlow *pcflow)
-*-----------------------------------------------------------------*/
-void BuildFlowSegment(set *segment, pCodeFlow *pcflow)
-{
-       
-       int nNextFlow=0;
-       pCodeFlowLink *pcflowLink=NULL;
-       
-       /* Add this flow to the set if it's not in there already */
-       if(isinSet(segment, pcflow)) {
-               addSetHead(&FlowTree, segment);
-               return;
-       }
-       
-       addSetHead(&segment, pcflow);
-       
-       /* Continue to add contiguous flows */
-       
-       while( pcflow->to && ((nNextFlow = elementsInSet(pcflow->to)) == 1)) {
-               pcflowLink = (pCodeFlowLink *)(setFirstItem(pcflow->to));
-               pcflow = pcflowLink->pcflow;
-               
-               if(isinSet(segment, pcflow)) {
-                       addSetIfnotP(&FlowTree, segment);
-                       return;
-               }
-               
-               addSetIfnotP(&segment, pcflow);
-               
-       }
-       
-       /* Branch: for each branch, duplicate the set and recursively call */
-       if(pcflow->to && nNextFlow>=2) {
-               pCodeFlow *pcflow_to;
-               
-               set *branch_segment=NULL;
-               
-               pcflowLink = (pCodeFlowLink *)(setFirstItem(pcflow->to));
-               pcflow_to = pcflowLink->pcflow;
-               
-               addSetIfnotP(&segment, pcflow);
-               
-               pcflowLink = (pCodeFlowLink *)(setNextItem(pcflow->to));
-               
-               while(pcflowLink) {
-                       
-                       branch_segment = setFromSet(segment);
-                       BuildFlowSegment(setFromSet(segment),pcflowLink->pcflow);
-                       pcflowLink = (pCodeFlowLink *)(setNextItem(pcflow->to));
-               }
-               
-               /* add the first branch to this segment */
-               BuildFlowSegment(segment,pcflow_to);
-               
-       }
-       
-       addSetIfnotP(&FlowTree, segment);
-       
-       /* done */
-}
-
-/*-----------------------------------------------------------------*
-* void BuildFlowTree(pBlock *pb)
-*-----------------------------------------------------------------*/
-void BuildFlowTree(pBlock *pb)
-{
-       pCodeFlow *pcflow;
-       set *segment;
-       
-       FlowTree = newSet();
-       
-       /* Start with the first flow object of this pBlock */
-       
-       pcflow = PCFL(findNextpCode(pb->pcHead, PC_FLOW));
-       
-       segment = newSet();
-       BuildFlowSegment(segment, pcflow);
-       
-       pb->FlowTree = FlowTree;
-       
-       dbg_dumpFlowTree(FlowTree);
-}
-#endif
-
-void dbg_dumpFlow(pBlock *pb)
+static void dbg_dumpFlow(pBlock *pb)
 {
        pCode *pcflow;
        
@@ -183,11 +57,13 @@ void dbg_dumpFlow(pBlock *pb)
        }
        
 }
+#endif
+
+#if 0
 /*-----------------------------------------------------------------*
 * void BuildFlowSegment(set *segment, pCodeFlow *pcflow)
 *-----------------------------------------------------------------*/
-
-void BuildFlowSegment(pCodeFlow *pcflow)
+static void BuildFlowSegment(pCodeFlow *pcflow)
 {
        static int recursion=0;
        pCodeFlow *pcflow_other;
@@ -279,6 +155,7 @@ void BuildFlowSegment(pCodeFlow *pcflow)
        }
        
 }
+#endif
 
 void BuildFlowTree(pBlock *pb)
 {