TableGen -time-regions option

I'm pondering a new timing feature for TableGen and am wondering whether anyone uses the existing -time-regions option. Some instrumentation for it appears in CodeGenTarget.cpp and GICombinerEmitter.cpp but nowhere else. If no one is using it, I'll be tempted to remove it.

I’m not hearing anyone jump up and down about this - go for it Paul,


It is on my to-do list. Thanks!

Hi Paul,

I'm rather late to the thread but I added the existing -time-regions option when I was debugging a particularly nasty perf problem in TableGen. I really only use it when we have a perf problem downstream.

The main thing I was getting out of it was the ability to annotate periods of time in Xcode Instruments just by adding a NamedRegionTimer to the right function/block (see That helped me track down the work that was taking the time and let me filter out the noise from elsewhere so I could look at the relevant memory allocations+churn. Feel free to change it but I'd like to keep that Instruments integration if we can as I'm sure we'll hit another perf problem sooner or later.

The new timing feature lets you insert timers anywhere you want. Each timer stops the previous one. If there are no timers in the backend, then TableGen times the overall backend.

I've used the new feature to locate the bottleneck in the -emit-dag-isel backend.

Ah, I spoke too soon. Let me investigate how the new feature works with Instruments and then I will enhance it if necessary.