[PATCH] D110036: [TargetInfo][LangOpts] Refactor target info and language options adjustment.

Anton Zabaznov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 19 07:02:45 PDT 2021


azabaznov created this revision.
azabaznov added reviewers: aaron.ballman, Anastasia, svenvh.
Herald added subscribers: dexonsmith, kerbowa, sunfish, kbarton, jgravelle-google, sbc100, nhaehnle, jvesely, nemanjai, dschuff.
azabaznov requested review of this revision.
Herald added subscribers: cfe-commits, aheejin.
Herald added a project: clang.

- Function CreateTargetInfo() has an access to language options which makes target immutable after creation without modification of language options themselves. Target specific hook TargetInfo::adjustAccordingToLangOpts() can be used if such modification depends on certain target.

- Introduce LangOptions::adjustAccordingToTI() to apply changes to language options based on target info (also without modification of target info). This also involves adding of some hooks (hasAtomics() / hasAltivec() as this options are used in PPC and WebAssembly in original TargetInfo::adjust()) which potentially can be reused.

- Validation of OpenCL target is in CreateTargetInfo() as language options are available at that point.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110036

Files:
  clang/include/clang/Basic/LangOptions.h
  clang/include/clang/Basic/TargetInfo.h
  clang/lib/Basic/LangOptions.cpp
  clang/lib/Basic/TargetInfo.cpp
  clang/lib/Basic/Targets.cpp
  clang/lib/Basic/Targets/AMDGPU.cpp
  clang/lib/Basic/Targets/AMDGPU.h
  clang/lib/Basic/Targets/PPC.cpp
  clang/lib/Basic/Targets/PPC.h
  clang/lib/Basic/Targets/SPIR.h
  clang/lib/Basic/Targets/WebAssembly.cpp
  clang/lib/Basic/Targets/WebAssembly.h
  clang/lib/Frontend/ASTUnit.cpp
  clang/lib/Frontend/ChainedIncludesSource.cpp
  clang/lib/Frontend/CompilerInstance.cpp
  clang/lib/Interpreter/Interpreter.cpp
  clang/tools/clang-import-test/clang-import-test.cpp
  clang/unittests/Analysis/MacroExpansionContextTest.cpp
  clang/unittests/Basic/SourceManagerTest.cpp
  clang/unittests/CodeGen/TestCompiler.h
  clang/unittests/Lex/HeaderSearchTest.cpp
  clang/unittests/Lex/LexerTest.cpp
  clang/unittests/Lex/PPCallbacksTest.cpp
  clang/unittests/Lex/PPConditionalDirectiveRecordTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110036.373456.patch
Type: text/x-patch
Size: 24080 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210919/937dcd22/attachment-0001.bin>


More information about the cfe-commits mailing list