From 95e48819ff4db0081a80e71d3f6847441a66db84 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Wed, 2 May 2012 10:03:07 +0200 Subject: [PATCH] detect temps used by only one function --- misc/tools/progs-analyzer.pl | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/misc/tools/progs-analyzer.pl b/misc/tools/progs-analyzer.pl index 6b8c0063..a6528d2b 100644 --- a/misc/tools/progs-analyzer.pl +++ b/misc/tools/progs-analyzer.pl @@ -535,8 +535,18 @@ sub find_uninitialized_locals($$) for(keys %{$progs->{temps}}) { - $watchme{$_} = WATCHME_T | WATCHME_X - if not exists $watchme{$_}; + next + if exists $watchme{$_}; + if($progs->{temps}{$_}) + { + # shared temp + $watchme{$_} = WATCHME_T | WATCHME_X + } + else + { + # unique temp + $watchme{$_} = WATCHME_X + } } $watchme{$_} |= WATCHME_R @@ -876,13 +886,13 @@ sub detect_constants($) { for(keys %{$_->{globals_used}}) { - if($globalflags[$_] & GLOBALFLAG_Q) + if($globalflags[$_] & GLOBALFLAG_U) { - $globalflags[$_] &= ~GLOBALFLAG_Q; + $globalflags[$_] &= ~GLOBALFLAG_U; } - else + elsif($globalflags[$_] & GLOBALFLAG_Q) { - $globalflags[$_] &= ~GLOBALFLAG_U; + $globalflags[$_] &= ~GLOBALFLAG_Q; } } $globalflags[$_] |= GLOBALFLAG_R @@ -961,11 +971,12 @@ sub detect_constants($) elsif(($globalflags[$_] & (GLOBALFLAG_S | GLOBALFLAG_I | GLOBALFLAG_Q)) == GLOBALFLAG_Q) { $globaltypes[$_] = "uniquetemp"; + $istemp{$_} = 0; } elsif(($globalflags[$_] & (GLOBALFLAG_S | GLOBALFLAG_I | GLOBALFLAG_Q)) == 0) { $globaltypes[$_] = "temp"; - ++$istemp{$_}; + $istemp{$_} = 1; } elsif(($globalflags[$_] & (GLOBALFLAG_S | GLOBALFLAG_I)) == GLOBALFLAG_I) { -- 2.39.2