[PATCH] D53426: NFC. opt_storage refactored toward thread local options

Yevgeny Rouban via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 19 02:50:11 PDT 2018


yrouban created this revision.
yrouban added reviewers: chandlerc, espindola, sepavloff, reames, skatkov.
Herald added subscribers: kristina, dexonsmith, steven_wu, atanasyan, jrtc27, gbedwell, JDevlieghere, sdardis, mehdi_amini.
Herald added a reviewer: andreadb.

This patch refactors the template class //cl::opt_storage<DataType, false, true>// to make it possible to override the access to the stored //DataType//. This is needed for the patch

- https://reviews.llvm.org/D53424 Enable thread specific cl::opt values for multi-threaded support

Having //DataType// extended by //cl::opt_storage// it is impossible to control reads and writes of the base //DataType// using instances of  //cl::opt_storage// because the dot-operator cannot be overridden.

  cl::opt<std::string> MyOption;
  ...
  if (MyOption.empty())

In this snippet //empty()// is applied directly to the base type of //MyOption// (which is //DataType//) without use of any operator.

This patch makes //cl::opt_storage<DataType, false, true>// wrap //DataType// as a field as it is done in //cl::opt_storage<DataType, false, false>//.
In addition to the //getValue()// methods to access to the field there are added operators *, -> and data type conversion for convenience.
Two templates are added for most frequently used methods for DataType=std::string: //empty()// and //StringRef()//.
All places in the LLVM code are fixed accordingly. There are several fixes in project clang (will be sent separately).
All changes except in CommandLine.h are straightforward. Similar changes should be done in all depended projects if needed.


Repository:
  rL LLVM

https://reviews.llvm.org/D53426

Files:
  include/llvm/Support/CommandLine.h
  lib/CodeGen/MachineBlockPlacement.cpp
  lib/TableGen/Main.cpp
  lib/Target/Mips/MipsOs16.cpp
  lib/Transforms/IPO/BlockExtractor.cpp
  lib/Transforms/IPO/LowerTypeTests.cpp
  lib/Transforms/IPO/WholeProgramDevirt.cpp
  lib/Transforms/Instrumentation/AddressSanitizer.cpp
  lib/Transforms/Instrumentation/ControlHeightReduction.cpp
  lib/Transforms/Instrumentation/GCOVProfiling.cpp
  lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
  tools/bugpoint/ExecutionDriver.cpp
  tools/bugpoint/Miscompilation.cpp
  tools/bugpoint/OptimizerDriver.cpp
  tools/bugpoint/ToolRunner.cpp
  tools/llc/llc.cpp
  tools/lli/lli.cpp
  tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
  tools/llvm-cat/llvm-cat.cpp
  tools/llvm-cfi-verify/llvm-cfi-verify.cpp
  tools/llvm-cov/CodeCoverage.cpp
  tools/llvm-cov/TestingSupport.cpp
  tools/llvm-cxxmap/llvm-cxxmap.cpp
  tools/llvm-dis/llvm-dis.cpp
  tools/llvm-dwarfdump/llvm-dwarfdump.cpp
  tools/llvm-dwp/llvm-dwp.cpp
  tools/llvm-exegesis/llvm-exegesis.cpp
  tools/llvm-lto/llvm-lto.cpp
  tools/llvm-lto2/llvm-lto2.cpp
  tools/llvm-mc/llvm-mc.cpp
  tools/llvm-mca/llvm-mca.cpp
  tools/llvm-modextract/llvm-modextract.cpp
  tools/llvm-objdump/MachODump.cpp
  tools/llvm-objdump/llvm-objdump.cpp
  tools/llvm-opt-report/OptReport.cpp
  tools/llvm-pdbutil/llvm-pdbutil.cpp
  tools/llvm-profdata/llvm-profdata.cpp
  tools/llvm-rtdyld/llvm-rtdyld.cpp
  tools/llvm-split/llvm-split.cpp
  tools/llvm-xray/xray-account.cpp
  tools/llvm-xray/xray-converter.cpp
  tools/llvm-xray/xray-extract.cpp
  tools/llvm-xray/xray-fdr-dump.cpp
  tools/llvm-xray/xray-graph-diff.cpp
  tools/llvm-xray/xray-graph.cpp
  tools/llvm-xray/xray-stacks.cpp
  tools/opt/opt.cpp
  tools/sancov/sancov.cpp
  tools/sanstats/sanstats.cpp
  tools/verify-uselistorder/verify-uselistorder.cpp
  tools/yaml2obj/yaml2obj.cpp
  unittests/Support/CommandLineTest.cpp
  utils/FileCheck/FileCheck.cpp
  utils/TableGen/AsmMatcherEmitter.cpp
  utils/TableGen/GlobalISelEmitter.cpp
  utils/yaml-bench/YAMLBench.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53426.170172.patch
Type: text/x-patch
Size: 57783 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181019/7d5bd6ad/attachment-0001.bin>


More information about the llvm-commits mailing list