[PATCH] D97204: [RFC] Clang 64-bit source locations

Mikhail Maltsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 22 09:18:41 PST 2021


miyuki created this revision.
miyuki added a reviewer: rsmith.
Herald added subscribers: dexonsmith, lebedev.ri, martong, arphaman, kbarton, hiraditya, mgorny, nemanjai.
Herald added a reviewer: lebedev.ri.
miyuki requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

This patch is a draft implementation of 64-bit source locations in
Clang. The intent is to evaluate viability of using 64-bit source
locations.

The patch implements a compile-time switch for the bit width of source
locations.

A major thing worth noting is that 64-bit source locations will
require an ABI breakage in libclang. This patch changes the bit width
in libclang unconditionally, rather than making it configurable.

In some places libclang uses `void *` to store source locations, this
obviously will not work on 32-bit hosts, I plan to address this issue
if the overall approach gets accepted.

I've performed two benchmarks to evaluate the effects of the patch on
memory consumption and performance:

1. LLVM+Clang release build:
  - Average memory usage during a parallel (32 thread) build increased by 8.333 ± 0.185 % (95 % confidence interval)
  - Peak memory usage increased by 8.319 ± 1.680 %
  - Total time increased by 0.669 ± 0.047 %
2. Parsing and semantic analysis (i.e. -fsyntax-only) of a large C++ source file from the LLVM LNT test suite: https://github.com/llvm/llvm-test-suite/tree/main/MultiSource/Benchmarks/tramp3d-v4
  - Memory usage increased by 8.97 % (exact measurement)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D97204

Files:
  clang-tools-extra/clang-tidy/readability/FunctionCognitiveComplexityCheck.cpp
  clang/CMakeLists.txt
  clang/include/clang-c/Index.h
  clang/include/clang/AST/DeclBase.h
  clang/include/clang/AST/DeclarationName.h
  clang/include/clang/AST/Stmt.h
  clang/include/clang/Analysis/ProgramPoint.h
  clang/include/clang/Basic/SourceLocation.h
  clang/include/clang/Basic/SourceManager.h
  clang/include/clang/Lex/Preprocessor.h
  clang/include/clang/Lex/Token.h
  clang/include/clang/Serialization/ASTBitCodes.h
  clang/include/clang/Serialization/ASTReader.h
  clang/include/clang/Serialization/ASTWriter.h
  clang/include/clang/Serialization/ModuleFile.h
  clang/lib/ARCMigrate/TransEmptyStatementsAndDealloc.cpp
  clang/lib/AST/NestedNameSpecifier.cpp
  clang/lib/AST/SelectorLocationsKind.cpp
  clang/lib/Basic/SourceLocation.cpp
  clang/lib/Basic/SourceManager.cpp
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGStmt.cpp
  clang/lib/CodeGen/CodeGenAction.cpp
  clang/lib/CodeGen/CoverageMappingGen.cpp
  clang/lib/Format/FormatTokenLexer.cpp
  clang/lib/Lex/Lexer.cpp
  clang/lib/Lex/ModuleMap.cpp
  clang/lib/Lex/PPCaching.cpp
  clang/lib/Lex/TokenLexer.cpp
  clang/lib/Parse/ParseStmtAsm.cpp
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTWriter.cpp
  clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
  clang/test/CMakeLists.txt
  clang/test/Lexer/SourceLocationsOverflow.c
  clang/test/lit.cfg.py
  clang/test/lit.site.cfg.py.in
  clang/tools/libclang/CIndex.cpp
  llvm/include/llvm/IR/DiagnosticInfo.h
  llvm/include/llvm/IR/LLVMContext.h
  llvm/include/llvm/MC/MCParser/MCAsmParser.h
  llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
  llvm/lib/CodeGen/MachineInstr.cpp
  llvm/lib/IR/LLVMContext.cpp
  llvm/lib/MC/MCParser/AsmParser.cpp
  llvm/lib/MC/MCParser/MasmParser.cpp
  llvm/tools/llc/llc.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97204.325467.patch
Type: text/x-patch
Size: 84085 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210222/1755425c/attachment-0001.bin>


More information about the llvm-commits mailing list