[PATCH] D27123: Add AVR target and toolchain to Clang
saaadhu added a comment. Would someone with a llvm bugzilla account please file the PR for me? New user registration is disabled, and I've been waiting for llvm-ad...@lists.llvm.org to respond for nearly a week now. And how should I proceed after that? Would one of the reviewers commit the patch for me? https://reviews.llvm.org/D27123 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D28343: [AVR] Fix register numbers for in getGCCAddlRegNames()
saaadhu added a comment. If you've added X, Y, Z and SP to GCCRegNames, you don't need AddlRegNames array at all, The reason I had them in AddlRegNames was to tell Clang that they alias regs in GCCRegNames. I followed X86TargetInfo's example - it has "ax" in GCCRegNames, and "al", "ah", "eax" and "rax" in AddlRegNames. I figured Clang could potentially use the fact that they alias when analyzing inline asm to detect unintended clobbers. https://reviews.llvm.org/D28343 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27123: Add AVR target and toolchain to Clang
saaadhu updated this revision to Diff 80575. saaadhu added a comment. Thanks, setting DoubleFormat and LongDoubleFormat fixed the __DBL_ and __LDBL_ differences. Also, setting SigAtomicType fixed the __SIG_ATOMIC_ differences as well. I've added those defines to the test. Unrelated, but I also removed a redundant set of LongLongAlign and overriding of GetDefaultDwarfVersion (returning 2 wasn't necessary). The only remaining (textually) conflicting defines between "avr-gcc -dM -E" and "clang -dM -E" are 1. short vs int for a bunch of __xxx_TYPE__ defines, like say __CHAR16_TYPE__. short and int are both 2 bytes for the avr, so I think either one is ok. 2. Casts vs plain literals in the defines for double MIN, MAX values. avr-gcc, for example, defines #define __DBL_MAX__ ((double)3.40282347e+38L), whereas clang does #define __DBL_MAX__ 3.40282347e+38. Again, I think this shouldn't matter - I've added the literals sans the cast to the test. https://reviews.llvm.org/D27123 Files: lib/Basic/Targets.cpp lib/Driver/Driver.cpp lib/Driver/ToolChains.cpp lib/Driver/ToolChains.h lib/Driver/Tools.cpp lib/Driver/Tools.h test/Driver/avr-toolchain.c test/Preprocessor/init.c Index: test/Preprocessor/init.c === --- test/Preprocessor/init.c +++ test/Preprocessor/init.c @@ -9189,3 +9189,174 @@ // RUN: %clang_cc1 -E -dM -ffreestanding -triple x86_64-windows-cygnus < /dev/null | FileCheck -match-full-lines -check-prefix CYGWIN-X64 %s // CYGWIN-X64: #define __USER_LABEL_PREFIX__ +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=avr \ +// RUN: < /dev/null \ +// RUN: | FileCheck -match-full-lines -check-prefix=AVR %s +// +// AVR:#define __ATOMIC_ACQUIRE 2 +// AVR:#define __ATOMIC_ACQ_REL 4 +// AVR:#define __ATOMIC_CONSUME 1 +// AVR:#define __ATOMIC_RELAXED 0 +// AVR:#define __ATOMIC_RELEASE 3 +// AVR:#define __ATOMIC_SEQ_CST 5 +// AVR:#define __AVR__ 1 +// AVR:#define __BIGGEST_ALIGNMENT__ 1 +// AVR:#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ +// AVR:#define __CHAR16_TYPE__ unsigned short +// AVR:#define __CHAR32_TYPE__ long unsigned int +// AVR:#define __CHAR_BIT__ 8 +// AVR:#define __DBL_DECIMAL_DIG__ 9 +// AVR:#define __DBL_DENORM_MIN__ 1.40129846e-45 +// AVR:#define __DBL_DIG__ 6 +// AVR:#define __DBL_EPSILON__ 1.19209290e-7 +// AVR:#define __DBL_HAS_DENORM__ 1 +// AVR:#define __DBL_HAS_INFINITY__ 1 +// AVR:#define __DBL_HAS_QUIET_NAN__ 1 +// AVR:#define __DBL_MANT_DIG__ 24 +// AVR:#define __DBL_MAX_10_EXP__ 38 +// AVR:#define __DBL_MAX_EXP__ 128 +// AVR:#define __DBL_MAX__ 3.40282347e+38 +// AVR:#define __DBL_MIN_10_EXP__ (-37) +// AVR:#define __DBL_MIN_EXP__ (-125) +// AVR:#define __DBL_MIN__ 1.17549435e-38 +// AVR:#define __FINITE_MATH_ONLY__ 0 +// AVR:#define __FLT_DECIMAL_DIG__ 9 +// AVR:#define __FLT_DENORM_MIN__ 1.40129846e-45F +// AVR:#define __FLT_DIG__ 6 +// AVR:#define __FLT_EPSILON__ 1.19209290e-7F +// AVR:#define __FLT_EVAL_METHOD__ 0 +// AVR:#define __FLT_HAS_DENORM__ 1 +// AVR:#define __FLT_HAS_INFINITY__ 1 +// AVR:#define __FLT_HAS_QUIET_NAN__ 1 +// AVR:#define __FLT_MANT_DIG__ 24 +// AVR:#define __FLT_MAX_10_EXP__ 38 +// AVR:#define __FLT_MAX_EXP__ 128 +// AVR:#define __FLT_MAX__ 3.40282347e+38F +// AVR:#define __FLT_MIN_10_EXP__ (-37) +// AVR:#define __FLT_MIN_EXP__ (-125) +// AVR:#define __FLT_MIN__ 1.17549435e-38F +// AVR:#define __FLT_RADIX__ 2 +// AVR:#define __GCC_ATOMIC_BOOL_LOCK_FREE 1 +// AVR:#define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 1 +// AVR:#define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 1 +// AVR:#define __GCC_ATOMIC_CHAR_LOCK_FREE 1 +// AVR:#define __GCC_ATOMIC_INT_LOCK_FREE 1 +// AVR:#define __GCC_ATOMIC_LLONG_LOCK_FREE 1 +// AVR:#define __GCC_ATOMIC_LONG_LOCK_FREE 1 +// AVR:#define __GCC_ATOMIC_POINTER_LOCK_FREE 1 +// AVR:#define __GCC_ATOMIC_SHORT_LOCK_FREE 1 +// AVR:#define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1 +// AVR:#define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 1 +// AVR:#define __GXX_ABI_VERSION 1002 +// AVR:#define __INT16_C_SUFFIX__ +// AVR:#define __INT16_MAX__ 32767 +// AVR:#define __INT16_TYPE__ short +// AVR:#define __INT32_C_SUFFIX__ L +// AVR:#define __INT32_MAX__ 2147483647L +// AVR:#define __INT32_TYPE__ long int +// AVR:#define __INT64_C_SUFFIX__ LL +// AVR:#define __INT64_MAX__ 9223372036854775807LL +// AVR:#define __INT64_TYPE__ long long int +// AVR:#define __INT8_C_SUFFIX__ +// AVR:#define __INT8_MAX__ 127 +// AVR:#define __INT8_TYPE__ signed char +// AVR:#define __INTMAX_C_SUFFIX__ LL +// AVR:#define __INTMAX_MAX__ 9223372036854775807LL +// AVR:#define __INTMAX_TYPE__ long long int +// AVR:#define __INTPTR_MAX__ 32767 +// AVR:#define __INTPTR_TYPE__ int +// AVR:#define __INT_FAST16_MAX__ 32767 +// AVR:#define __INT_FAST16_TYPE__ short +// AVR:#define __INT_FAST32_MAX__ 2147483647L +// AVR:#define __INT_FAST32_TYPE__ long int +// AVR:#define __INT_FAST64_MAX__ 9223372036854775807LL +// AVR:#define __INT_FAST64_TYPE__ long long int +// AVR:#define __INT_FAST8_MAX__ 127 +// AVR:#defi
[PATCH] D27123: Add AVR target and toolchain to Clang
saaadhu updated this revision to Diff 80721. saaadhu added a comment. Make defines for CHAR16_TYPE, {U,}INT_{LEAST,FAST}16_TYPE use int instead of short. {U,}INT16_TYPE still gets defined as short though - lib/Frontend/InitPreprocessor.cpp::DefineExactWidthIntType does not use TargetInfo::getIntTypeByWidth. Instead, InitializePredefinedMacros calls the function with the specific type (SignedShort/UnsignedShort), as getShortWidth() > getCharWidth(), but getIntWidth() == getShortWidth(). Not sure what the best way to fix that is - should I make DefineExactWidthType use TargetInfo::getIntTypeByWidth? https://reviews.llvm.org/D27123 Files: lib/Basic/Targets.cpp lib/Driver/Driver.cpp lib/Driver/ToolChains.cpp lib/Driver/ToolChains.h lib/Driver/Tools.cpp lib/Driver/Tools.h test/Driver/avr-toolchain.c test/Preprocessor/init.c Index: test/Preprocessor/init.c === --- test/Preprocessor/init.c +++ test/Preprocessor/init.c @@ -9189,3 +9189,174 @@ // RUN: %clang_cc1 -E -dM -ffreestanding -triple x86_64-windows-cygnus < /dev/null | FileCheck -match-full-lines -check-prefix CYGWIN-X64 %s // CYGWIN-X64: #define __USER_LABEL_PREFIX__ +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=avr \ +// RUN: < /dev/null \ +// RUN: | FileCheck -match-full-lines -check-prefix=AVR %s +// +// AVR:#define __ATOMIC_ACQUIRE 2 +// AVR:#define __ATOMIC_ACQ_REL 4 +// AVR:#define __ATOMIC_CONSUME 1 +// AVR:#define __ATOMIC_RELAXED 0 +// AVR:#define __ATOMIC_RELEASE 3 +// AVR:#define __ATOMIC_SEQ_CST 5 +// AVR:#define __AVR__ 1 +// AVR:#define __BIGGEST_ALIGNMENT__ 1 +// AVR:#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ +// AVR:#define __CHAR16_TYPE__ unsigned int +// AVR:#define __CHAR32_TYPE__ long unsigned int +// AVR:#define __CHAR_BIT__ 8 +// AVR:#define __DBL_DECIMAL_DIG__ 9 +// AVR:#define __DBL_DENORM_MIN__ 1.40129846e-45 +// AVR:#define __DBL_DIG__ 6 +// AVR:#define __DBL_EPSILON__ 1.19209290e-7 +// AVR:#define __DBL_HAS_DENORM__ 1 +// AVR:#define __DBL_HAS_INFINITY__ 1 +// AVR:#define __DBL_HAS_QUIET_NAN__ 1 +// AVR:#define __DBL_MANT_DIG__ 24 +// AVR:#define __DBL_MAX_10_EXP__ 38 +// AVR:#define __DBL_MAX_EXP__ 128 +// AVR:#define __DBL_MAX__ 3.40282347e+38 +// AVR:#define __DBL_MIN_10_EXP__ (-37) +// AVR:#define __DBL_MIN_EXP__ (-125) +// AVR:#define __DBL_MIN__ 1.17549435e-38 +// AVR:#define __FINITE_MATH_ONLY__ 0 +// AVR:#define __FLT_DECIMAL_DIG__ 9 +// AVR:#define __FLT_DENORM_MIN__ 1.40129846e-45F +// AVR:#define __FLT_DIG__ 6 +// AVR:#define __FLT_EPSILON__ 1.19209290e-7F +// AVR:#define __FLT_EVAL_METHOD__ 0 +// AVR:#define __FLT_HAS_DENORM__ 1 +// AVR:#define __FLT_HAS_INFINITY__ 1 +// AVR:#define __FLT_HAS_QUIET_NAN__ 1 +// AVR:#define __FLT_MANT_DIG__ 24 +// AVR:#define __FLT_MAX_10_EXP__ 38 +// AVR:#define __FLT_MAX_EXP__ 128 +// AVR:#define __FLT_MAX__ 3.40282347e+38F +// AVR:#define __FLT_MIN_10_EXP__ (-37) +// AVR:#define __FLT_MIN_EXP__ (-125) +// AVR:#define __FLT_MIN__ 1.17549435e-38F +// AVR:#define __FLT_RADIX__ 2 +// AVR:#define __GCC_ATOMIC_BOOL_LOCK_FREE 1 +// AVR:#define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 1 +// AVR:#define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 1 +// AVR:#define __GCC_ATOMIC_CHAR_LOCK_FREE 1 +// AVR:#define __GCC_ATOMIC_INT_LOCK_FREE 1 +// AVR:#define __GCC_ATOMIC_LLONG_LOCK_FREE 1 +// AVR:#define __GCC_ATOMIC_LONG_LOCK_FREE 1 +// AVR:#define __GCC_ATOMIC_POINTER_LOCK_FREE 1 +// AVR:#define __GCC_ATOMIC_SHORT_LOCK_FREE 1 +// AVR:#define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1 +// AVR:#define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 1 +// AVR:#define __GXX_ABI_VERSION 1002 +// AVR:#define __INT16_C_SUFFIX__ +// AVR:#define __INT16_MAX__ 32767 +// AVR:#define __INT16_TYPE__ short +// AVR:#define __INT32_C_SUFFIX__ L +// AVR:#define __INT32_MAX__ 2147483647L +// AVR:#define __INT32_TYPE__ long int +// AVR:#define __INT64_C_SUFFIX__ LL +// AVR:#define __INT64_MAX__ 9223372036854775807LL +// AVR:#define __INT64_TYPE__ long long int +// AVR:#define __INT8_C_SUFFIX__ +// AVR:#define __INT8_MAX__ 127 +// AVR:#define __INT8_TYPE__ signed char +// AVR:#define __INTMAX_C_SUFFIX__ LL +// AVR:#define __INTMAX_MAX__ 9223372036854775807LL +// AVR:#define __INTMAX_TYPE__ long long int +// AVR:#define __INTPTR_MAX__ 32767 +// AVR:#define __INTPTR_TYPE__ int +// AVR:#define __INT_FAST16_MAX__ 32767 +// AVR:#define __INT_FAST16_TYPE__ int +// AVR:#define __INT_FAST32_MAX__ 2147483647L +// AVR:#define __INT_FAST32_TYPE__ long int +// AVR:#define __INT_FAST64_MAX__ 9223372036854775807LL +// AVR:#define __INT_FAST64_TYPE__ long long int +// AVR:#define __INT_FAST8_MAX__ 127 +// AVR:#define __INT_FAST8_TYPE__ signed char +// AVR:#define __INT_LEAST16_MAX__ 32767 +// AVR:#define __INT_LEAST16_TYPE__ int +// AVR:#define __INT_LEAST32_MAX__ 2147483647L +// AVR:#define __INT_LEAST32_TYPE__ long int +// AVR:#define __INT_LEAST64_MAX__ 9223372036854775807LL +// AVR:#define __INT_LEAST64_TYPE__ long long int +// AVR:#define __INT_LEAST8_MAX__ 12