[PATCH] D52920: Introduce code_model macros

Ali Tamur via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 4 18:30:18 PDT 2018


tamur created this revision.
tamur added reviewers: compnerd, MaskRay.
tamur added a project: clang.
Herald added a subscriber: cfe-commits.

gcc defines macros such as __code_model_small_ based on the user passed command line flag -mcmodel. clang accepts a flag with the same name and similar effects, but does not generate any macro that the user can use. This cl narrows the gap between gcc and clang behaviour.

However, achieving full compatibility with gcc is not trivial: The set of valid values for mcmodel in gcc and clang are not equal. Also, gcc defines different macros for different architectures. In this cl, we only tackle an easy part of the problem and define the macro only for x64 architecture. When the user does not specify a mcmodel, the macro for small code model is produced, as is the case with gcc.


Repository:
  rC Clang

https://reviews.llvm.org/D52920

Files:
  include/clang/Basic/TargetOptions.h
  lib/Basic/Targets/X86.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/Preprocessor/init.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52920.168427.patch
Type: text/x-patch
Size: 7934 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181005/091771c1/attachment-0001.bin>


More information about the cfe-commits mailing list