On 05/18/2018 07:15 AM, David Malcolm wrote: > On Fri, 2018-05-18 at 13:11 +0200, Richard Biener wrote: >> The following adds a simple alloc/free_flag machinery allocating >> bits from an int typed pool and applies that to bb->flags and edge- >>> flags. >> This should allow infrastructure pieces to use egde/bb flags >> temporarily >> without worrying that users might already use it as for example >> BB_VISITED and friends. It converts one clever user to the new >> interface. >> >> The allocation state is per CFG but we could also make it global >> or merge the two pools so one allocates a flag that can be used for >> bbs and edges at the same time. >> >> Thus - any opinions welcome. I'm mainly targeting cfganal algorithms >> where I want to add a few region-based ones that to be O(region-size) >> complexity may not use sbitmaps for visited sets because of the >> clearing >> overhead and bitmaps are probably more expensive to use than a >> BB/edge >> flag that needs to be cleared afterwards. >> >> Built on x86_64, otherwise untested. >> >> Any comments? > > Rather than putting alloc/free pairs at the usage sites, how about an > RAII class? Something like this: Yes, please if at all possible we should be using RAII.
jeff