Changes in / [34737de:b38433b]


Ignore:
Location:
src
Files:
5 added
13 edited

Legend:

Unmodified
Added
Removed
  • src/Common/PassVisitor.h

    r34737de rb38433b  
    55#include <stack>
    66
     7#include "Common/Stats.h"
    78#include "Common/utility.h"
    89
     
    426427};
    427428
     429#include "Common/Stats.h"
     430
     431extern struct PassVisitorStats {
     432        size_t depth = 0;
     433        Stats::Counters::MaxCounter<double> * max = nullptr;
     434        Stats::Counters::AverageCounter<double> * avg = nullptr;
     435} pass_visitor_stats;
     436
    428437#include "SynTree/TypeSubstitution.h"
    429438#include "PassVisitor.impl.h"
  • src/Common/PassVisitor.impl.h

    r34737de rb38433b  
    6767        SemanticErrorException errors;
    6868
     69        pass_visitor_stats.depth++;
     70        pass_visitor_stats.max->push(pass_visitor_stats.depth);
     71        pass_visitor_stats.avg->push(pass_visitor_stats.depth);
    6972        for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) {
     73
     74
    7075                // splice in new declarations after previous decl
    7176                if ( !empty( afterDecls ) ) { decls.splice( i, *afterDecls ); }
     
    8388                if ( !empty( beforeDecls ) ) { decls.splice( i, *beforeDecls ); }
    8489        }
     90        pass_visitor_stats.depth--;
    8591        if ( ! errors.isEmpty() ) {
    8692                throw errors;
     
    94100        SemanticErrorException errors;
    95101
     102        pass_visitor_stats.depth++;
     103        pass_visitor_stats.max->push(pass_visitor_stats.depth);
     104        pass_visitor_stats.avg->push(pass_visitor_stats.depth);
    96105        for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) {
    97106                // splice in new declarations after previous decl
     
    109118                if ( !empty( beforeDecls ) ) { decls.splice( i, *beforeDecls ); }
    110119        }
     120        pass_visitor_stats.depth--;
    111121        if ( ! errors.isEmpty() ) {
    112122                throw errors;
     
    126136        if ( ! visitor.get_visit_children() ) return;
    127137        SemanticErrorException errors;
     138
     139        pass_visitor_stats.depth++;
     140        pass_visitor_stats.max->push(pass_visitor_stats.depth);
     141        pass_visitor_stats.avg->push(pass_visitor_stats.depth);
    128142        for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) {
    129143                try {
     
    135149                }
    136150        }
     151        pass_visitor_stats.depth--;
    137152        if ( ! errors.isEmpty() ) {
    138153                throw errors;
     
    153168        if ( ! mutator.get_visit_children() ) return;
    154169        SemanticErrorException errors;
     170
     171        pass_visitor_stats.depth++;
     172        pass_visitor_stats.max->push(pass_visitor_stats.depth);
     173        pass_visitor_stats.avg->push(pass_visitor_stats.depth);
    155174        for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) {
    156175                try {
     
    163182                } // try
    164183        } // for
     184        pass_visitor_stats.depth--;
    165185        if ( ! errors.isEmpty() ) {
    166186                throw errors;
     
    185205        DeclList_t* afterDecls  = get_afterDecls();
    186206
     207        pass_visitor_stats.depth++;
     208        pass_visitor_stats.max->push(pass_visitor_stats.depth);
     209        pass_visitor_stats.avg->push(pass_visitor_stats.depth);
    187210        for ( std::list< Statement* >::iterator i = statements.begin(); i != statements.end(); ++i ) {
    188211
     
    202225                if ( !empty( beforeStmts ) ) { statements.splice( i, *beforeStmts ); }
    203226        }
     227        pass_visitor_stats.depth--;
    204228
    205229        if ( !empty( afterDecls ) ) { splice( std::back_inserter( statements ), afterDecls); }
  • src/Common/Stats.h

    r34737de rb38433b  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // Heap.h --
     7// Stats.h --
    88//
    99// Author           : Thierry Delisle
     
    1616#pragma once
    1717
     18// Entry point for compiler analytics.
     19/*
     20The compiler currently supports 3 times of analytics:
     21         - generic counters
     22         - heap statistics
     23         - timiing statistics
     24
     25These can be enabled using the --stats option, to which a comma seperated list of options can be passed.
     26For more details see Stats.cc
     27
     28Counters:
     29        The counters are a generic tree of counters that print in a 2-column output format.
     30        They can count maximums, averages, totals, etc.
     31
     32        Currently all counters are under the same enable block, this could be changed if needed.
     33
     34Heap:
     35        Measures the total calls malloc and free as the peak number of allocations per pass
     36
     37Timing:
     38        Comming soon
     39*/
     40
     41
    1842#include "Common/Stats/Counter.h"
    1943#include "Common/Stats/Heap.h"
     44#include "Common/Stats/Time.h"
     45
     46namespace Stats {
     47        void parse_params(const char * const params);
     48        void print();
     49}
  • src/Common/Stats/Counter.cc

    r34737de rb38433b  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // Heap.h --
     7// Counter.cc --
    88//
    99// Author           : Thierry Delisle
     
    1818#include <algorithm>
    1919#include <cstring>
     20#include <functional>
    2021#include <iomanip>
    2122
    2223namespace Stats {
    2324        namespace Counters {
    24 
    25                 template<typename T>
    26                 void ForAllCounters(BaseCounter::list_t & range, size_t level, T func) {
    27                         auto it = range.head;
    28                         while(it) {
    29                                 auto next = it->next;
    30                                 func(it, level);
    31                                 ForAllCounters(it->children, level + 1, func);
    32                                 it = next;
    33                         }
    34                 }
    35 
    3625                void print() {
    37                         if(!BaseCounter::top.head) return;
     26                        if(!top.head) return;
    3827                        size_t nc = 0;
    39                         ForAllCounters(BaseCounter::top, 0, [&](BaseCounter * node, size_t level) {
     28                        Base::ForAll(top, 0, [&](Base::TreeImpl * node, size_t level) {
    4029                                nc = std::max(nc, (4 * level) + std::strlen(node->name));
    4130                        });
     
    4938
    5039
    51                         ForAllCounters(BaseCounter::top, 0, [&](BaseCounter * node, size_t level) {
     40                        Base::ForAll(top, 0, [&](Base::TreeImpl * node, size_t level) {
    5241                                std::cerr << std::string(level * 4, ' ');
    5342                                std::cerr << node->name;
     
    5847                                std::cerr << " |";
    5948                                std::cerr << '\n';
    60                                 delete node;
    61                         });
     49                        }, true);
    6250
    6351                        std::cerr << std::string(nct, '-') << std::endl;
    6452                }
    6553
    66                 BaseCounter::list_t BaseCounter::top;
     54                Base::TreeTop top;
     55
     56                extern bool enabled;
    6757        }
    6858}
  • src/Common/Stats/Counter.h

    r34737de rb38433b  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // Heap.h --
     7// Counter.h --
    88//
    99// Author           : Thierry Delisle
     
    1919#include <iostream>
    2020
     21#include "Common/Stats/Base.h"
     22
     23#if defined( NO_STATISTICS )
     24        #define NO_COUNTER_STATISTICS
     25#endif
     26
    2127namespace Stats {
    2228        namespace Counters {
    23                 void print();
     29#               if defined(NO_COUNTERS_STATISTICS)
    2430
    25                 class BaseCounter {
    26                 public:
    27                         BaseCounter(const char * const name) : name(name) {
    28                                 top.append(this);
     31                        static inline void print() {}
     32
     33                        class CounterGroup {
     34                        public:
     35                        };
     36
     37                        class SimpleCounter {
     38                        public:
     39                                inline void operator++(int) {}
     40                                inline void operator+=(size_t) {}
     41                        };
     42
     43                        template<typename T>
     44                        class AverageCounter {
     45                        public:
     46                                inline void push(T value) {}
     47                        };
     48
     49                        template<typename T>
     50                        class MaxCounter {
     51                        public:
     52                                inline void push(T value) {}
     53                        };
     54
     55                        template<typename counter_t>
     56                        counter_t * build(const char * const name) {
     57                                return nullptr;
    2958                        }
    3059
    31                         BaseCounter(const char * const name, BaseCounter * parent) : name(name) {
    32                                 parent->children.append(this);
     60                        template<typename counter_t>
     61                        counter_t * build(const char * const name, Base::Tree<top> * parent) {
     62                                        return nullptr;
    3363                        }
    34                 protected:
    35                         virtual ~BaseCounter() = default;
     64#               else
     65                        extern bool enabled;
    3666
    37                         struct list_t {
    38                                 BaseCounter * head = nullptr;
    39                                 BaseCounter * tail = nullptr;
     67                        extern Base::TreeTop top;
    4068
    41                                 void append(BaseCounter * node) {
    42                                         if(!head) { head = node; }
    43                                         else      { tail->next = node;}
    44                                         tail = node;
    45                                 }
     69                        class CounterGroup : public Base::Tree<top> {
     70                        public:
     71                                CounterGroup(const char * const name ) : Base::Tree<top>(name) {}
     72                                CounterGroup(const char * const name, Base::Tree<top> * parent) : Base::Tree<top>(name, parent) {}
     73
     74                                virtual void print(std::ostream & os) override { os << ""; }
     75                        protected:
     76                                virtual ~CounterGroup() = default;
    4677                        };
    4778
    48                 private:
    49                         virtual void print(std::ostream &) = 0;
     79                        class SimpleCounter : public Base::Tree<top> {
     80                        public:
     81                                SimpleCounter(const char * const name ) : Base::Tree<top>(name) {}
     82                                SimpleCounter(const char * const name, Base::Tree<top> * parent) : Base::Tree<top>(name, parent) {}
     83
     84                                virtual void print(std::ostream & os) override { os << count; }
     85
     86                                inline void operator++(int)          { if(!enabled) return; count++;        }
     87                                inline void operator+=(size_t value) { if(!enabled) return; count += value; }
     88
     89                        protected:
     90                                virtual ~SimpleCounter() = default;
     91
     92                        private:
     93                                size_t count = 0;
     94                        };
     95
    5096                        template<typename T>
    51                         friend void ForAllCounters(BaseCounter::list_t &, size_t, T );
    52                         friend void print();
     97                        class AverageCounter : public Base::Tree<top> {
     98                        public:
     99                                AverageCounter(const char * const name ) : Base::Tree<top>(name), sum{} {}
     100                                AverageCounter(const char * const name, Base::Tree<top> * parent) : Base::Tree<top>(name, parent), sum{} {}
    53101
    54                 private:
    55                         const char * const name;
     102                                virtual void print(std::ostream & os) { os << sum / count; }
    56103
    57                         BaseCounter * next = nullptr;
    58                         list_t children;
     104                                inline void push(T value) { if(!enabled) return; sum += value; count++; }
    59105
    60                         static list_t top;
    61                 };
     106                        protected:
     107                                virtual ~AverageCounter() = default;
    62108
    63                 class CounterGroup : public BaseCounter {
    64                 public:
    65                         CounterGroup(const char * const name ) : BaseCounter(name) {}
    66                         CounterGroup(const char * const name, BaseCounter * parent) : BaseCounter(name, parent) {}
     109                        private:
     110                                T sum;
     111                                size_t count = 1;
     112                        };
    67113
    68                 protected:
    69                         virtual ~CounterGroup() = default;
     114                        template<typename T>
     115                        class MaxCounter : public Base::Tree<top> {
     116                        public:
     117                                MaxCounter(const char * const name ) : Base::Tree<top>(name), max{} {}
     118                                MaxCounter(const char * const name, Base::Tree<top> * parent) : Base::Tree<top>(name, parent), max{} {}
    70119
    71                 private:
    72                         virtual void print(std::ostream & os) {
    73                                 os << "";
    74                         }
    75                         template<typename T>
    76                         friend void ForAllCounters(BaseCounter::list_t &, size_t, T );
    77                         friend void print();
    78                 };
     120                                virtual void print(std::ostream & os) { os << max; }
    79121
    80                 class SimpleCounter : public BaseCounter {
    81                 public:
    82                         SimpleCounter(const char * const name ) : BaseCounter(name) {}
    83                         SimpleCounter(const char * const name, BaseCounter * parent) : BaseCounter(name, parent) {}
     122                                inline void push(T value) { if(!enabled) return; max = std::max(max, value); }
    84123
    85                         inline void operator++(int)          { count++;        }
    86                         inline void operator+=(size_t value) { count += value; }
    87                 protected:
    88                         virtual ~SimpleCounter() = default;
     124                        protected:
     125                                virtual ~MaxCounter() = default;
    89126
    90                 private:
    91                         virtual void print(std::ostream & os) {
    92                                 os << count;
    93                         }
    94                         template<typename T>
    95                         friend void ForAllCounters(BaseCounter::list_t &, size_t, T );
    96                         friend void print();
     127                        private:
     128                                T max;
     129                        };
    97130
    98                         size_t count = 0;
    99 
    100                 };
    101 
    102                 template<typename T>
    103                 class AverageCounter : public BaseCounter {
    104                 public:
    105                         AverageCounter(const char * const name ) : BaseCounter(name), sum{} {}
    106                         AverageCounter(const char * const name, BaseCounter * parent) : BaseCounter(name, parent), sum{} {}
    107 
    108                         inline void push(T value) {
    109                                 sum += value;
    110                                 count++;
     131                        template<typename counter_t>
     132                        counter_t * build(const char * const name) {
     133                                if(!enabled) return nullptr;
     134                                return new counter_t(name);
    111135                        }
    112136
    113                 protected:
    114                         virtual ~AverageCounter() = default;
    115 
    116                 private:
    117                         virtual void print(std::ostream & os) {
    118                                 os << sum / count;
     137                        template<typename counter_t>
     138                        counter_t * build(const char * const name, Base::Tree<top> * parent) {
     139                                if(!enabled) return nullptr;
     140                                return new counter_t(name, parent);
    119141                        }
    120                         template<typename F>
    121                         friend void ForAllCounters(BaseCounter::list_t &, size_t, F );
    122                         friend void print();
    123 
    124                         T sum;
    125                         size_t count = 1;
    126                 };
    127 
    128                 template<typename T>
    129                 class MaxCounter : public BaseCounter {
    130                 public:
    131                         MaxCounter(const char * const name ) : BaseCounter(name), max{} {}
    132                         MaxCounter(const char * const name, BaseCounter * parent) : BaseCounter(name, parent), max{} {}
    133 
    134                         inline void push(T value) {
    135                                 max = std::max(max, value);
    136                         }
    137 
    138                 protected:
    139                         virtual ~MaxCounter() = default;
    140 
    141                 private:
    142                         virtual void print(std::ostream & os) {
    143                                 os << max;
    144                         }
    145                         template<typename F>
    146                         friend void ForAllCounters(BaseCounter::list_t &, size_t, F );
    147                         friend void print();
    148 
    149                         T max;
    150                 };
     142#               endif
    151143        }
    152144}
  • src/Common/Stats/Heap.cc

    r34737de rb38433b  
    2121#include <iostream>
    2222
     23#if defined( NO_STATISTICS )
     24        #define NO_HEAP_STATISTICS
     25#endif
     26
    2327namespace Stats {
    2428        namespace Heap {
     
    2832                void print() {}
    2933#else
     34                extern bool enabled;
     35
    3036                struct StatBlock {
    3137                        const char * name  = nullptr;   ///< Name of this pass
     
    7783
    7884                void print() {
     85                        if(!enabled) return;
     86
    7987                        size_t nc = 0;
    8088                        size_t total_mallocs = 0;
     
    166174                        void * malloc( size_t size ) {
    167175                                static auto __malloc = reinterpret_cast<void * (*)(size_t)>(interpose_symbol( "malloc", nullptr ));
    168                                 if( passes_cnt > 0 ) {
     176                                if( enabled && passes_cnt > 0 ) {
    169177                                        passes[passes_cnt - 1].mallocs++;
    170178                                        passes[passes_cnt - 1].n_allocs++;
     
    177185                        void free( void * ptr ) {
    178186                                static auto __free = reinterpret_cast<void   (*)(void *)>(interpose_symbol( "free", nullptr ));
    179                                 if( passes_cnt > 0 ) {
     187                                if( enabled && passes_cnt > 0 ) {
    180188                                        passes[passes_cnt - 1].frees++;
    181189                                        passes[passes_cnt - 1].n_allocs--;
     
    186194                        void * calloc( size_t nelem, size_t size ) {
    187195                                static auto __calloc = reinterpret_cast<void * (*)(size_t, size_t)>(interpose_symbol( "calloc", nullptr ));
    188                                 if( passes_cnt > 0 ) {
     196                                if( enabled && passes_cnt > 0 ) {
    189197                                        passes[passes_cnt - 1].mallocs++;
    190198                                        passes[passes_cnt - 1].n_allocs++;
     
    198206                                static auto __realloc = reinterpret_cast<void * (*)(void *, size_t)>(interpose_symbol( "realloc", nullptr ));
    199207                                void * s = __realloc( ptr, size );
    200                                 if ( s != ptr && passes_cnt > 0 ) {                     // did realloc get new storage ?
     208                                if ( enabled && s != ptr && passes_cnt > 0 ) {                  // did realloc get new storage ?
    201209                                        passes[passes_cnt - 1].mallocs++;
    202210                                        passes[passes_cnt - 1].frees++;
  • src/Common/module.mk

    r34737de rb38433b  
    1717SRC_COMMON = \
    1818      Common/Assert.cc \
     19      Common/Eval.cc \
     20      Common/PassVisitor.cc \
     21      Common/SemanticError.cc \
     22      Common/Stats/Counter.cc \
    1923      Common/Stats/Heap.cc \
    20       Common/Stats/Counter.cc \
    21       Common/Eval.cc \
    22       Common/SemanticError.cc \
     24      Common/Stats/Stats.cc \
     25      Common/Stats/Time.cc \
    2326      Common/UniqueName.cc
    2427
  • src/CompilationState.cc

    r34737de rb38433b  
    3838        codegenp = false,
    3939        prettycodegenp = false,
    40         linemarks = false,
    41         stats_heap = false,
    42         stats_counters = false;
     40        linemarks = false;
    4341
    4442// Local Variables: //
  • src/CompilationState.h

    r34737de rb38433b  
    3939        codegenp,
    4040        prettycodegenp,
    41         linemarks,
    42         stats_heap,
    43         stats_counters;
     41        linemarks;
    4442
    4543// is the compiler building prelude or libcfa?
  • src/Makefile.in

    r34737de rb38433b  
    165165        CodeGen/FixMain.$(OBJEXT) CodeGen/GenType.$(OBJEXT) \
    166166        CodeGen/OperatorTable.$(OBJEXT)
    167 am__objects_2 = Common/Assert.$(OBJEXT) Common/Stats/Heap.$(OBJEXT) \
    168         Common/Stats/Counter.$(OBJEXT) Common/Eval.$(OBJEXT) \
    169         Common/SemanticError.$(OBJEXT) Common/UniqueName.$(OBJEXT)
     167am__objects_2 = Common/Assert.$(OBJEXT) Common/Eval.$(OBJEXT) \
     168        Common/PassVisitor.$(OBJEXT) Common/SemanticError.$(OBJEXT) \
     169        Common/Stats/Counter.$(OBJEXT) Common/Stats/Heap.$(OBJEXT) \
     170        Common/Stats/Stats.$(OBJEXT) Common/Stats/Time.$(OBJEXT) \
     171        Common/UniqueName.$(OBJEXT)
    170172am__objects_3 = ControlStruct/ForExprMutator.$(OBJEXT) \
    171173        ControlStruct/LabelFixer.$(OBJEXT) \
     
    560562SRC_COMMON = \
    561563      Common/Assert.cc \
     564      Common/Eval.cc \
     565      Common/PassVisitor.cc \
     566      Common/SemanticError.cc \
     567      Common/Stats/Counter.cc \
    562568      Common/Stats/Heap.cc \
    563       Common/Stats/Counter.cc \
    564       Common/Eval.cc \
    565       Common/SemanticError.cc \
     569      Common/Stats/Stats.cc \
     570      Common/Stats/Time.cc \
    566571      Common/UniqueName.cc
    567572
     
    721726Common/Assert.$(OBJEXT): Common/$(am__dirstamp) \
    722727        Common/$(DEPDIR)/$(am__dirstamp)
     728Common/Eval.$(OBJEXT): Common/$(am__dirstamp) \
     729        Common/$(DEPDIR)/$(am__dirstamp)
     730Common/PassVisitor.$(OBJEXT): Common/$(am__dirstamp) \
     731        Common/$(DEPDIR)/$(am__dirstamp)
     732Common/SemanticError.$(OBJEXT): Common/$(am__dirstamp) \
     733        Common/$(DEPDIR)/$(am__dirstamp)
    723734Common/Stats/$(am__dirstamp):
    724735        @$(MKDIR_P) Common/Stats
     
    727738        @$(MKDIR_P) Common/Stats/$(DEPDIR)
    728739        @: > Common/Stats/$(DEPDIR)/$(am__dirstamp)
     740Common/Stats/Counter.$(OBJEXT): Common/Stats/$(am__dirstamp) \
     741        Common/Stats/$(DEPDIR)/$(am__dirstamp)
    729742Common/Stats/Heap.$(OBJEXT): Common/Stats/$(am__dirstamp) \
    730743        Common/Stats/$(DEPDIR)/$(am__dirstamp)
    731 Common/Stats/Counter.$(OBJEXT): Common/Stats/$(am__dirstamp) \
     744Common/Stats/Stats.$(OBJEXT): Common/Stats/$(am__dirstamp) \
    732745        Common/Stats/$(DEPDIR)/$(am__dirstamp)
    733 Common/Eval.$(OBJEXT): Common/$(am__dirstamp) \
    734         Common/$(DEPDIR)/$(am__dirstamp)
    735 Common/SemanticError.$(OBJEXT): Common/$(am__dirstamp) \
    736         Common/$(DEPDIR)/$(am__dirstamp)
     746Common/Stats/Time.$(OBJEXT): Common/Stats/$(am__dirstamp) \
     747        Common/Stats/$(DEPDIR)/$(am__dirstamp)
    737748Common/UniqueName.$(OBJEXT): Common/$(am__dirstamp) \
    738749        Common/$(DEPDIR)/$(am__dirstamp)
     
    11151126@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/DebugMalloc.Po@am__quote@
    11161127@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/Eval.Po@am__quote@
     1128@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/PassVisitor.Po@am__quote@
    11171129@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/SemanticError.Po@am__quote@
    11181130@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/UniqueName.Po@am__quote@
    11191131@AMDEP_TRUE@@am__include@ @am__quote@Common/Stats/$(DEPDIR)/Counter.Po@am__quote@
    11201132@AMDEP_TRUE@@am__include@ @am__quote@Common/Stats/$(DEPDIR)/Heap.Po@am__quote@
     1133@AMDEP_TRUE@@am__include@ @am__quote@Common/Stats/$(DEPDIR)/Stats.Po@am__quote@
     1134@AMDEP_TRUE@@am__include@ @am__quote@Common/Stats/$(DEPDIR)/Time.Po@am__quote@
    11211135@AMDEP_TRUE@@am__include@ @am__quote@Concurrency/$(DEPDIR)/Keywords.Po@am__quote@
    11221136@AMDEP_TRUE@@am__include@ @am__quote@Concurrency/$(DEPDIR)/Waitfor.Po@am__quote@
  • src/SymTab/Indexer.cc

    r34737de rb38433b  
    4545        // Statistics block
    4646        namespace {
    47                 auto idtable_group = new Stats::Counters::CounterGroup("IdTable");
    48                 auto idtable_find  = new Stats::Counters::SimpleCounter("Find calls", idtable_group);
    49                 auto idtable_size  = new Stats::Counters::AverageCounter<double>("Average Size", idtable_group);
    50                 auto idtable_key   = new Stats::Counters::AverageCounter<double>("Average Key Size", idtable_group);
    51 
    52                 auto indexers_group = new Stats::Counters::CounterGroup("Indexers");
    53                 auto indexers_count = new Stats::Counters::SimpleCounter("Count", indexers_group);
    54                 auto indexers_size  = new Stats::Counters::AverageCounter<double>("Average Size", indexers_group);
    55                 auto indexers_depth_a  = new Stats::Counters::AverageCounter<double>("Average Depth", indexers_group);
    56                 auto indexers_depth_m  = new Stats::Counters::MaxCounter<size_t>("Max Depth", indexers_group);
     47
     48                static inline auto stats_idtable() {
     49                        using namespace Stats::Counters;
     50                        static auto group = build<CounterGroup>("IdTable");
     51                        static struct {
     52                                SimpleCounter * find;
     53                                AverageCounter<double> * size;
     54                                AverageCounter<double> * key;
     55                        } ret = {
     56                                .find = build<SimpleCounter>("Find calls", group),
     57                                .size = build<AverageCounter<double>>("Average Size", group),
     58                                .key  = build<AverageCounter<double>>("Average Key Size", group),
     59                        };
     60                        return ret;
     61                }
     62
     63                static inline auto stats_indexers() {
     64                        using namespace Stats::Counters;
     65                        static auto group   = build<CounterGroup>("Indexers");
     66                        static struct {
     67                                SimpleCounter * count;
     68                                AverageCounter<double> * size;
     69                                AverageCounter<double> * depth_a;
     70                                MaxCounter<size_t> * depth_m;
     71                        } ret = {
     72                                .count   = build<SimpleCounter>("Count", group),
     73                                .size    = build<AverageCounter<double>>("Average Size", group),
     74                                .depth_a = build<AverageCounter<double>>("Average Depth", group),
     75                                .depth_m = build<MaxCounter<size_t>>("Max Depth", group),
     76                        };
     77                        return ret;
     78                }
    5779        }
    5880
     
    214236
    215237        Indexer::Indexer() : tables( 0 ), scope( 0 ) {
    216                 (*indexers_count)++;
     238                (*stats_indexers().count)++;
    217239        }
    218240
    219241        Indexer::Indexer( const Indexer &that ) : doDebug( that.doDebug ), tables( newRef( that.tables ) ), scope( that.scope ) {
    220                 (*indexers_count)++;
     242                (*stats_indexers().count)++;
    221243        }
    222244
     
    227249        Indexer::~Indexer() {
    228250                if(tables) {
    229                         indexers_size->push( tables->idTable.size() );
     251                        stats_indexers().size->push( tables->idTable.size() );
    230252                        size_t depth = 1;
    231253                        for( auto crnt = tables->base.tables; crnt; crnt = crnt->base.tables ) {
    232254                                ++depth;
    233255                        }
    234                         indexers_depth_a->push( depth );
    235                         indexers_depth_m->push( depth );
     256                        stats_indexers().depth_a->push( depth );
     257                        stats_indexers().depth_m->push( depth );
    236258                }
    237259                deleteRef( tables );
     
    266288                while ( searchTables ) {
    267289
    268                         (*idtable_find)++;
    269                         idtable_key->push( id.size() );
    270                         idtable_size->push( searchTables->idTable.size() );
     290                        (*stats_idtable().find)++;
     291                        stats_idtable().key->push( id.size() );
     292                        stats_idtable().size->push( searchTables->idTable.size() );
    271293                        IdTable::const_iterator decls = searchTables->idTable.find( id );
    272294                        if ( decls != searchTables->idTable.end() ) {
     
    345367                if ( tables->scope < scope ) return nullptr;
    346368
    347                 (*idtable_find)++;
    348                 idtable_key->push( id.size() );
    349                 idtable_size->push( tables->idTable.size() );
     369                (*stats_idtable().find)++;
     370                stats_idtable().key->push( id.size() );
     371                stats_idtable().size->push( tables->idTable.size() );
    350372                IdTable::const_iterator decls = tables->idTable.find( id );
    351373                if ( decls != tables->idTable.end() ) {
     
    366388                if ( tables->scope < scope ) return false;
    367389
    368                 (*idtable_find)++;
    369                 idtable_key->push( id.size() );
    370                 idtable_size->push( tables->idTable.size() );
     390                (*stats_idtable().find)++;
     391                stats_idtable().key->push( id.size() );
     392                stats_idtable().size->push( tables->idTable.size() );
    371393                IdTable::const_iterator decls = tables->idTable.find( id );
    372394                if ( decls != tables->idTable.end() ) {
     
    385407                if ( tables->scope < scope ) return false;
    386408
    387                 (*idtable_find)++;
    388                 idtable_key->push( id.size() );
    389                 idtable_size->push( tables->idTable.size() );
     409                (*stats_idtable().find)++;
     410                stats_idtable().key->push( id.size() );
     411                stats_idtable().size->push( tables->idTable.size() );
    390412                IdTable::const_iterator decls = tables->idTable.find( id );
    391413                if ( decls != tables->idTable.end() ) {
  • src/SymTab/Validate.cc

    r34737de rb38433b  
    304304                PassVisitor<FixQualifiedTypes> fixQual;
    305305
    306                 Stats::Heap::newPass("validate-A");
    307                 acceptAll( translationUnit, hoistDecls );
    308                 ReplaceTypedef::replaceTypedef( translationUnit );
    309                 ReturnTypeFixer::fix( translationUnit ); // must happen before autogen
    310                 acceptAll( translationUnit, epc ); // must happen before VerifyCtorDtorAssign, because void return objects should not exist; before LinkReferenceToTypes because it is an indexer and needs correct types for mangling
    311                 Stats::Heap::newPass("validate-B");
    312                 acceptAll( translationUnit, lrt ); // must happen before autogen, because sized flag needs to propagate to generated functions
    313                 mutateAll( translationUnit, fixQual ); // must happen after LinkReferenceToTypes, because aggregate members are accessed
    314                 HoistStruct::hoistStruct( translationUnit ); // must happen after EliminateTypedef, so that aggregate typedefs occur in the correct order
    315                 EliminateTypedef::eliminateTypedef( translationUnit ); //
    316                 Stats::Heap::newPass("validate-C");
    317                 acceptAll( translationUnit, genericParams );  // check as early as possible - can't happen before LinkReferenceToTypes
    318                 VerifyCtorDtorAssign::verify( translationUnit );  // must happen before autogen, because autogen examines existing ctor/dtors
    319                 ReturnChecker::checkFunctionReturns( translationUnit );
    320                 InitTweak::fixReturnStatements( translationUnit ); // must happen before autogen
    321                 Stats::Heap::newPass("validate-D");
    322                 Concurrency::applyKeywords( translationUnit );
    323                 acceptAll( translationUnit, fpd ); // must happen before autogenerateRoutines, after Concurrency::applyKeywords because uniqueIds must be set on declaration before resolution
    324                 ControlStruct::hoistControlDecls( translationUnit );  // hoist initialization out of for statements; must happen before autogenerateRoutines
    325                 autogenerateRoutines( translationUnit ); // moved up, used to be below compoundLiteral - currently needs EnumAndPointerDecay
    326                 Stats::Heap::newPass("validate-E");
    327                 Concurrency::implementMutexFuncs( translationUnit );
    328                 Concurrency::implementThreadStarter( translationUnit );
    329                 mutateAll( translationUnit, compoundliteral );
    330                 ResolvExpr::resolveWithExprs( translationUnit ); // must happen before FixObjectType because user-code is resolved and may contain with variables
    331                 Stats::Heap::newPass("validate-F");
    332                 FixObjectType::fix( translationUnit );
    333                 ArrayLength::computeLength( translationUnit );
    334                 acceptAll( translationUnit, finder ); // xxx - remove this pass soon
    335                 mutateAll( translationUnit, labelAddrFixer );
    336                 Validate::handleAttributes( translationUnit );
     306                {
     307                        Stats::Heap::newPass("validate-A");
     308                        Stats::Time::BlockGuard guard("validate-A");
     309                        acceptAll( translationUnit, hoistDecls );
     310                        ReplaceTypedef::replaceTypedef( translationUnit );
     311                        ReturnTypeFixer::fix( translationUnit ); // must happen before autogen
     312                        acceptAll( translationUnit, epc ); // must happen before VerifyCtorDtorAssign, because void return objects should not exist; before LinkReferenceToTypes because it is an indexer and needs correct types for mangling
     313                }
     314                {
     315                        Stats::Heap::newPass("validate-B");
     316                        Stats::Time::BlockGuard guard("validate-B");
     317                        Stats::Time::TimeBlock("Link Reference To Types", [&]() {
     318                                acceptAll( translationUnit, lrt ); // must happen before autogen, because sized flag needs to propagate to generated functions
     319                        });
     320                        Stats::Time::TimeBlock("Fix Qualified Types", [&]() {
     321                                mutateAll( translationUnit, fixQual ); // must happen after LinkReferenceToTypes, because aggregate members are accessed
     322                        });
     323                        Stats::Time::TimeBlock("Hoist Structs", [&]() {
     324                                HoistStruct::hoistStruct( translationUnit ); // must happen after EliminateTypedef, so that aggregate typedefs occur in the correct order
     325                        });
     326                        Stats::Time::TimeBlock("Eliminate Typedefs", [&]() {
     327                                EliminateTypedef::eliminateTypedef( translationUnit ); //
     328                        });
     329                }
     330                {
     331                        Stats::Heap::newPass("validate-C");
     332                        Stats::Time::BlockGuard guard("validate-C");
     333                        acceptAll( translationUnit, genericParams );  // check as early as possible - can't happen before LinkReferenceToTypes
     334                        VerifyCtorDtorAssign::verify( translationUnit );  // must happen before autogen, because autogen examines existing ctor/dtors
     335                        ReturnChecker::checkFunctionReturns( translationUnit );
     336                        InitTweak::fixReturnStatements( translationUnit ); // must happen before autogen
     337                }
     338                {
     339                        Stats::Heap::newPass("validate-D");
     340                        Stats::Time::BlockGuard guard("validate-D");
     341                        Stats::Time::TimeBlock("Apply Concurrent Keywords", [&]() {
     342                                Concurrency::applyKeywords( translationUnit );
     343                        });
     344                        Stats::Time::TimeBlock("Forall Pointer Decay", [&]() {
     345                                acceptAll( translationUnit, fpd ); // must happen before autogenerateRoutines, after Concurrency::applyKeywords because uniqueIds must be set on declaration before resolution
     346                        });
     347                        Stats::Time::TimeBlock("Hoist Control Declarations", [&]() {
     348                                ControlStruct::hoistControlDecls( translationUnit );  // hoist initialization out of for statements; must happen before autogenerateRoutines
     349                        });
     350                        Stats::Time::TimeBlock("Generate Autogen routines", [&]() {
     351                                autogenerateRoutines( translationUnit ); // moved up, used to be below compoundLiteral - currently needs EnumAndPointerDecay
     352                        });
     353                }
     354                {
     355                        Stats::Heap::newPass("validate-E");
     356                        Stats::Time::BlockGuard guard("validate-E");
     357                        Stats::Time::TimeBlock("Implement Mutex Func", [&]() {
     358                                Concurrency::implementMutexFuncs( translationUnit );
     359                        });
     360                        Stats::Time::TimeBlock("Implement Thread Start", [&]() {
     361                                Concurrency::implementThreadStarter( translationUnit );
     362                        });
     363                        Stats::Time::TimeBlock("Compound Literal", [&]() {
     364                                mutateAll( translationUnit, compoundliteral );
     365                        });
     366                        Stats::Time::TimeBlock("Resolve With Expressions", [&]() {
     367                                ResolvExpr::resolveWithExprs( translationUnit ); // must happen before FixObjectType because user-code is resolved and may contain with variables
     368                        });
     369                }
     370                {
     371                        Stats::Heap::newPass("validate-F");
     372                        Stats::Time::BlockGuard guard("validate-F");
     373                        Stats::Time::TimeBlock("Fix Object Type", [&]() {
     374                                FixObjectType::fix( translationUnit );
     375                        });
     376                        Stats::Time::TimeBlock("Array Length", [&]() {
     377                                ArrayLength::computeLength( translationUnit );
     378                        });
     379                        Stats::Time::TimeBlock("Find Special Declarations", [&]() {
     380                                acceptAll( translationUnit, finder ); // xxx - remove this pass soon
     381                        });
     382                        Stats::Time::TimeBlock("Fix Label Address", [&]() {
     383                                mutateAll( translationUnit, labelAddrFixer );
     384                        });
     385                        Stats::Time::TimeBlock("Handle Attributes", [&]() {
     386                                Validate::handleAttributes( translationUnit );
     387                        });
     388                }
    337389        }
    338390
  • src/main.cc

    r34737de rb38433b  
    6565using namespace std;
    6666
    67 #define PASS(name, pass)                   \
     67
     68void NewPass(const char * const name) {
     69        Stats::Heap::newPass(name);
     70        using namespace Stats::Counters;
     71        static auto pass_visitor_group = build<CounterGroup>("Pass Visitor");
     72        auto pass = build<CounterGroup>(name, pass_visitor_group);
     73        pass_visitor_stats.depth = 0;
     74        pass_visitor_stats.avg = build<AverageCounter<double>>("Average Depth", pass);
     75        pass_visitor_stats.max = build<MaxCounter<double>>("Max Depth", pass);
     76}
     77
     78#define PASS(name, pass)                  \
    6879        if ( errorp ) { cerr << name << endl; } \
    69         Stats::Heap::newPass(name);               \
    70         pass;
     80        NewPass(name);                          \
     81        Stats::Time::StartBlock(name);          \
     82        pass;                                   \
     83        Stats::Time::StopBlock();
    7184
    7285LinkageSpec::Spec linkage = LinkageSpec::Cforall;
     
    142155        backtrace( 6 );                                                                         // skip first 6 stack frames
    143156        signal( SIGABRT, SIG_DFL);                                                      // reset default signal handler
    144     raise( SIGABRT );                                                                   // reraise SIGABRT
     157                raise( SIGABRT );                                                                       // reraise SIGABRT
    145158} // sigAbortHandler
    146159
     
    181194                } // if
    182195
     196                Stats::Time::StartGlobal();
     197                NewPass("Parse");
     198                Stats::Time::StartBlock("Parse");
     199
    183200                // read in the builtins, extras, and the prelude
    184201                if ( ! nopreludep ) {                                                   // include gcc builtins
     
    231248                // works okay for now.
    232249                CodeTools::fillLocations( translationUnit );
     250                Stats::Time::StopBlock();
    233251
    234252                // add the assignment statement after the initialization of a type parameter
    235                 PASS( "validate", SymTab::validate( translationUnit, symtabp ) );
     253                PASS( "Validate", SymTab::validate( translationUnit, symtabp ) );
    236254                if ( symtabp ) {
    237255                        deleteAll( translationUnit );
     
    250268                } // if
    251269
    252                 PASS( "fixLabels", ControlStruct::fixLabels( translationUnit ) );
    253                 PASS( "fixNames", CodeGen::fixNames( translationUnit ) );
    254                 PASS( "genInit", InitTweak::genInit( translationUnit ) );
    255                 PASS( "expandMemberTuples" , Tuples::expandMemberTuples( translationUnit ) );
     270                PASS( "Fix Labels", ControlStruct::fixLabels( translationUnit ) );
     271                PASS( "Fix Names", CodeGen::fixNames( translationUnit ) );
     272                PASS( "Gen Init", InitTweak::genInit( translationUnit ) );
     273                PASS( "Expand Member Tuples" , Tuples::expandMemberTuples( translationUnit ) );
    256274                if ( libcfap ) {
    257275                        // generate the bodies of cfa library functions
     
    277295                }
    278296
    279                 PASS( "resolve", ResolvExpr::resolve( translationUnit ) );
     297                PASS( "Resolve", ResolvExpr::resolve( translationUnit ) );
    280298                if ( exprp ) {
    281299                        dump( translationUnit );
     
    284302
    285303                // fix ObjectDecl - replaces ConstructorInit nodes
    286                 PASS( "fixInit", InitTweak::fix( translationUnit, buildingLibrary() ) );
     304                PASS( "Fix Init", InitTweak::fix( translationUnit, buildingLibrary() ) );
    287305                if ( ctorinitp ) {
    288306                        dump ( translationUnit );
     
    290308                } // if
    291309
    292                 PASS( "expandUniqueExpr", Tuples::expandUniqueExpr( translationUnit ) ); // xxx - is this the right place for this? want to expand ASAP so tha, sequent passes don't need to worry about double-visiting a unique expr - needs to go after InitTweak::fix so that copy constructed return declarations are reused
    293 
    294                 PASS( "translateEHM" , ControlStruct::translateEHM( translationUnit ) );
    295 
    296                 PASS( "generateWaitfor" , Concurrency::generateWaitFor( translationUnit ) );
    297 
    298                 PASS( "convertSpecializations",  GenPoly::convertSpecializations( translationUnit ) ); // needs to happen before tuple types are expanded
    299 
    300                 PASS( "expandTuples", Tuples::expandTuples( translationUnit ) ); // xxx - is this the right place for this?
     310                PASS( "Expand Unique Expr", Tuples::expandUniqueExpr( translationUnit ) ); // xxx - is this the right place for this? want to expand ASAP so tha, sequent passes don't need to worry about double-visiting a unique expr - needs to go after InitTweak::fix so that copy constructed return declarations are reused
     311
     312                PASS( "Translate EHM" , ControlStruct::translateEHM( translationUnit ) );
     313
     314                PASS( "Gen Waitfor" , Concurrency::generateWaitFor( translationUnit ) );
     315
     316                PASS( "Convert Specializations",  GenPoly::convertSpecializations( translationUnit ) ); // needs to happen before tuple types are expanded
     317
     318                PASS( "Expand Tuples", Tuples::expandTuples( translationUnit ) ); // xxx - is this the right place for this?
    301319
    302320                if ( tuplep ) {
     
    305323                }
    306324
    307                 PASS( "virtual expandCasts", Virtual::expandCasts( translationUnit ) ); // Must come after translateEHM
    308 
    309                 PASS( "instantiateGenerics", GenPoly::instantiateGeneric( translationUnit ) );
     325                PASS( "Virtual Expand Casts", Virtual::expandCasts( translationUnit ) ); // Must come after translateEHM
     326
     327                PASS( "Instantiate Generics", GenPoly::instantiateGeneric( translationUnit ) );
    310328                if ( genericsp ) {
    311329                        dump( translationUnit );
    312330                        return 0;
    313331                }
    314                 PASS( "convertLvalue", GenPoly::convertLvalue( translationUnit ) );
     332                PASS( "Convert L-Value", GenPoly::convertLvalue( translationUnit ) );
    315333
    316334
     
    319337                        return 0;
    320338                } // if
    321                 PASS( "box", GenPoly::box( translationUnit ) );
     339                PASS( "Box", GenPoly::box( translationUnit ) );
    322340
    323341                if ( bcodegenp ) {
     
    331349
    332350                CodeTools::fillLocations( translationUnit );
    333                 PASS( "codegen", CodeGen::generate( translationUnit, *output, ! noprotop, prettycodegenp, true, linemarks ) );
     351                PASS( "Code Gen", CodeGen::generate( translationUnit, *output, ! noprotop, prettycodegenp, true, linemarks ) );
    334352
    335353                CodeGen::FixMain::fix( *output, (PreludeDirector + "/bootloader.c").c_str() );
     
    377395
    378396        deleteAll( translationUnit );
    379         if(!libcfap && !treep) {
    380                 if(stats_counters) Stats::Counters::print();
    381                 if(stats_heap) Stats::Heap::print();
    382         }
     397        Stats::print();
    383398
    384399        return 0;
     
    421436        while ( (c = getopt_long( argc, argv, "abBcCdefgGlLmnNpqrRstTvwW:yzZD:F:", long_opts, &long_index )) != -1 ) {
    422437                switch ( c ) {
    423                   case Ast:
    424                   case 'a':                                                                             // dump AST
     438                        case Ast:
     439                        case 'a':                                                                               // dump AST
    425440                        astp = true;
    426441                        break;
    427                   case Bresolver:
    428                   case 'b':                                                                             // print before resolver steps
     442                        case Bresolver:
     443                        case 'b':                                                                               // print before resolver steps
    429444                        bresolvep = true;
    430445                        break;
    431                   case 'B':                                                                             // print before box steps
     446                        case 'B':                                                                               // print before box steps
    432447                        bboxp = true;
    433448                        break;
    434                   case CtorInitFix:
    435                   case 'c':                                                                             // print after constructors and destructors are replaced
     449                        case CtorInitFix:
     450                        case 'c':                                                                               // print after constructors and destructors are replaced
    436451                        ctorinitp = true;
    437452                        break;
    438                   case 'C':                                                                             // print before code generation
     453                        case 'C':                                                                               // print before code generation
    439454                        bcodegenp = true;
    440455                        break;
    441                   case DeclStats:
    442                   case 'd':
    443                     declstatsp = true;
    444                         break;
    445                   case Expr:
    446                   case 'e':                                                                             // dump AST after expression analysis
     456                        case DeclStats:
     457                        case 'd':
     458                                declstatsp = true;
     459                        break;
     460                        case Expr:
     461                        case 'e':                                                                               // dump AST after expression analysis
    447462                        exprp = true;
    448463                        break;
    449                   case ExprAlt:
    450                   case 'f':                                                                             // print alternatives for expressions
     464                        case ExprAlt:
     465                        case 'f':                                                                               // print alternatives for expressions
    451466                        expraltp = true;
    452467                        break;
    453                   case Grammar:
    454                   case 'g':                                                                             // bison debugging info (grammar rules)
     468                        case Grammar:
     469                        case 'g':                                                                               // bison debugging info (grammar rules)
    455470                        yydebug = true;
    456471                        break;
    457                   case 'G':                                                                             // dump AST after instantiate generics
     472                        case 'G':                                                                               // dump AST after instantiate generics
    458473                        genericsp = true;
    459474                        break;
    460                   case LibCFA:
    461                   case 'l':                                                                             // generate libcfa.c
     475                        case LibCFA:
     476                        case 'l':                                                                               // generate libcfa.c
    462477                        libcfap = true;
    463478                        break;
    464                   case Linemarks:
    465                   case 'L':                                                                             // print lines marks
     479                        case Linemarks:
     480                        case 'L':                                                                               // print lines marks
    466481                        linemarks = true;
    467482                        break;
    468                   case Nopreamble:
    469                   case 'n':                                                                             // do not read preamble
     483                        case Nopreamble:
     484                        case 'n':                                                                               // do not read preamble
    470485                        nopreludep = true;
    471486                        break;
    472                   case Nolinemarks:
    473                   case 'N':                                                                             // suppress line marks
     487                        case Nolinemarks:
     488                        case 'N':                                                                               // suppress line marks
    474489                        linemarks = false;
    475490                        break;
    476                   case Prototypes:
    477                   case 'p':                                                                             // generate prototypes for preamble functions
     491                        case Prototypes:
     492                        case 'p':                                                                               // generate prototypes for preamble functions
    478493                        noprotop = true;
    479494                        break;
    480                   case PreludeDir:
    481                         PreludeDirector = optarg;
    482                         break;
    483                   case 'm':                                                                             // don't replace the main
    484                         nomainp = true;
    485                         break;
    486                   case Parse:
    487                   case 'q':                                                                             // dump parse tree
     495                        case PreludeDir:
     496                                PreludeDirector = optarg;
     497                        break;
     498                        case 'm':                                                                               // don't replace the main
     499                                nomainp = true;
     500                        break;
     501                        case Parse:
     502                        case 'q':                                                                               // dump parse tree
    488503                        parsep = true;
    489504                        break;
    490                   case Resolver:
    491                   case 'r':                                                                             // print resolver steps
     505                        case Resolver:
     506                        case 'r':                                                                               // print resolver steps
    492507                        resolvep = true;
    493508                        break;
    494                   case 'R':                                                                             // dump resolv-proto instance
     509                        case 'R':                                                                               // dump resolv-proto instance
    495510                        resolvprotop = true;
    496511                        break;
    497                   case Stats:
    498                         {
    499                                 std::stringstream ss(optarg);
    500                                 while(ss.good()) {
    501                                         std::string substr;
    502                                         getline( ss, substr, ',' );
    503                                         if(substr == "counters") {
    504                                                 stats_counters = true;
    505                                         } else if(substr == "heap") {
    506                                                 stats_heap = true;
    507                                         } else if(substr == "none") {
    508                                                 stats_counters = false;
    509                                                 stats_heap = false;
    510                                         } else {
    511                                                 std::cerr << "Ignoring unknown statistic " << substr << std::endl;
    512                                         }
    513                                 }
    514 
    515                         }
    516                         break;
    517                   case Symbol:
    518                   case 's':                                                                             // print symbol table events
     512                        case Stats:
     513                                Stats::parse_params(optarg);
     514                        break;
     515                        case Symbol:
     516                        case 's':                                                                               // print symbol table events
    519517                        symtabp = true;
    520518                        break;
    521                   case Tree:
    522                   case 't':                                                                             // build in tree
     519                        case Tree:
     520                        case 't':                                                                               // build in tree
    523521                        treep = true;
    524522                        break;
    525                   case TupleExpansion:
    526                   case 'T':                                                                             // print after tuple expansion
     523                        case TupleExpansion:
     524                        case 'T':                                                                               // print after tuple expansion
    527525                        tuplep = true;
    528526                        break;
    529                   case 'v':                                                                             // dump AST after decl validation pass
     527                        case 'v':                                                                               // dump AST after decl validation pass
    530528                        validp = true;
    531529                        break;
    532                   case 'w':
     530                        case 'w':
    533531                        Wsuppress = true;
    534532                        break;
    535                   case 'W':
     533                        case 'W':
    536534                        if ( strcmp( optarg, "all" ) == 0 ) {
    537535                                SemanticWarning_EnableAll();
     
    550548                        } // if
    551549                        break;
    552                   case 'y':                                                                             // dump AST on error
     550                        case 'y':                                                                               // dump AST on error
    553551                        errorp = true;
    554552                        break;
    555                   case 'z':                                                                             // dump as codegen rather than AST
     553                        case 'z':                                                                               // dump as codegen rather than AST
    556554                        codegenp = true;
    557555                        break;
     
    559557                        prettycodegenp = true;
    560558                        break;
    561                   case 'D':                                                                             // ignore -Dxxx
    562                         break;
    563                   case 'F':                                                                             // source file-name without suffix
     559                        case 'D':                                                                               // ignore -Dxxx
     560                        break;
     561                        case 'F':                                                                               // source file-name without suffix
    564562                        filename = optarg;
    565563                        break;
    566                   case '?':
     564                        case '?':
    567565                        if ( optopt ) {                                                         // short option ?
    568566                                assertf( false, "Unknown option: -%c\n", (char)optopt );
     
    573571                                __attribute__((fallthrough));
    574572                        #endif
    575                   default:
     573                        default:
    576574                        abort();
    577575                } // switch
Note: See TracChangeset for help on using the changeset viewer.