[all-commits] [llvm/llvm-project] 95dd17: [clang] Change representation of CurLexerKind (#70...

serge-sans-paille via All-commits all-commits at lists.llvm.org
Sun Nov 5 23:13:19 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 95dd17848383315050a5d64051bd695d0a653c51
      https://github.com/llvm/llvm-project/commit/95dd17848383315050a5d64051bd695d0a653c51
  Author: serge-sans-paille <serge.guelton at telecom-bretagne.eu>
  Date:   2023-11-06 (Mon, 06 Nov 2023)

  Changed paths:
    M clang/include/clang/Lex/Preprocessor.h
    M clang/lib/Lex/PPCaching.cpp
    M clang/lib/Lex/PPLexerChange.cpp
    M clang/lib/Lex/Preprocessor.cpp
    M clang/utils/ClangVisualizers/clang.natvis

  Log Message:
  -----------
  [clang] Change representation of CurLexerKind (#70381)

Previous representation used an enumeration combined to a switch to
dispatch to the appropriate lexer.

Use function pointer so that the dispatching is just an indirect call,
which is actually better because lexing is a costly task compared to a
function call.

This also makes the code slightly cleaner, speedup on compile time
tracker are consistent and range form -0.05% to -0.20% for NewPM-O0-g,
see


https://llvm-compile-time-tracker.com/compare.php?from=f9906508bc4f05d3950e2219b4c56f6c078a61ef&to=608c85ec1283638db949d73e062bcc3355001ce4&stat=instructions:u

Considering just the preprocessing task, preprocessing the sqlite
amalgametion takes -0.6% instructions (according to valgrind
--tool=callgrind)

---------

Co-authored-by: serge-sans-paille <sguelton at mozilla.com>
Co-authored-by: cor3ntin <corentinjabot at gmail.com>




More information about the All-commits mailing list