This is an archive of the discontinued LLVM Phabricator instance.

[TableGen] Add frontend/backend phase timing capability
ClosedPublic

Authored by Paul-C-Anagnostopoulos on Nov 12 2020, 1:35 PM.

Details

Summary

This patch adds a timing capability that shows the clock times and percentages for phases of the TableGen frontend and appropriately instrumented backends. It is requested with the --time-phases option.

I instrumented about five backends and will continue to instrument more of them over time.

I removed an old timing feature that was only used by one backend.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptNov 12 2020, 1:35 PM
Paul-C-Anagnostopoulos requested review of this revision.Nov 12 2020, 1:35 PM

I forgot to add the new -time-phases option to the xxx-tblgen documentation.

I also added a null backend to make timing the parser easier.

lattner accepted this revision.Nov 13 2020, 9:54 AM

Looks reasonable to me Paul! The null backend is a great idea for analysis

This revision is now accepted and ready to land.Nov 13 2020, 9:54 AM
thakis added a subscriber: thakis.Nov 14 2020, 7:22 AM
thakis added inline comments.
llvm/lib/TableGen/Record.cpp
2614
../../llvm/lib/TableGen/Record.cpp:2613:7: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
      BackendTimer = false;
      ^

Was the if (BackendTime) supposed to have braces?

jankratochvil added a subscriber: jankratochvil.EditedNov 14 2020, 7:25 AM

http://lab.llvm.org:8014/#/builders/14/builds/1886

[144/5147] Building CXX object lib/TableGen/CMakeFiles/LLVMTableGen.dir/Main.cpp.o
FAILED: lib/TableGen/CMakeFiles/LLVMTableGen.dir/Main.cpp.o 
/usr/lib64/ccache/c++  -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Ilib/TableGen -I/home/buildbot/worker/lldb-x86_64-fedora/llvm-project/llvm/lib/TableGen -Iinclude -I/home/buildbot/worker/lldb-x86_64-fedora/llvm-project/llvm/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-redundant-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -fdiagnostics-color -ffunction-sections -fdata-sections -O2     -fno-exceptions -fno-rtti -UNDEBUG -std=c++14 -MD -MT lib/TableGen/CMakeFiles/LLVMTableGen.dir/Main.cpp.o -MF lib/TableGen/CMakeFiles/LLVMTableGen.dir/Main.cpp.o.d -o lib/TableGen/CMakeFiles/LLVMTableGen.dir/Main.cpp.o -c /home/buildbot/worker/lldb-x86_64-fedora/llvm-project/llvm/lib/TableGen/Main.cpp
In file included from /home/buildbot/worker/lldb-x86_64-fedora/llvm-project/llvm/include/llvm/TableGen/Error.h:18,
                 from /home/buildbot/worker/lldb-x86_64-fedora/llvm-project/llvm/lib/TableGen/TGParser.h:17,
                 from /home/buildbot/worker/lldb-x86_64-fedora/llvm-project/llvm/lib/TableGen/Main.cpp:18:
/home/buildbot/worker/lldb-x86_64-fedora/llvm-project/llvm/include/llvm/TableGen/Record.h:29:10: fatal error: llvm/Support/timer.h: No such file or directory
   29 | #include "llvm/Support/timer.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

Probably already fixed by: Fix build after 54f9ee3

llvm/lib/TableGen/Record.cpp
2614

Absolutely! Thanks for catching this.