[PATCH] D29032: [mips] Define macros related to -mabicalls in the preprocessor
This revision was automatically updated to reflect the committed changes. Closed by commit rL295728: [mips] Define macros related to -mabicalls in the preprocessor (authored by sdardis). Changed prior to commit: https://reviews.llvm.org/D29032?vs=85392&id=89219#toc Repository: rL LLVM https://reviews.llvm.org/D29032 Files: cfe/trunk/lib/Basic/Targets.cpp cfe/trunk/test/Preprocessor/init.c Index: cfe/trunk/test/Preprocessor/init.c === --- cfe/trunk/test/Preprocessor/init.c +++ cfe/trunk/test/Preprocessor/init.c @@ -3040,6 +3040,7 @@ // MIPS32BE:#define __llvm__ 1 // MIPS32BE:#define __mips 32 // MIPS32BE:#define __mips__ 1 +// MIPS32BE:#define __mips_abicalls 1 // MIPS32BE:#define __mips_fpr 32 // MIPS32BE:#define __mips_hard_float 1 // MIPS32BE:#define __mips_o32 1 @@ -3246,6 +3247,7 @@ // MIPS32EL:#define __llvm__ 1 // MIPS32EL:#define __mips 32 // MIPS32EL:#define __mips__ 1 +// MIPS32EL:#define __mips_abicalls 1 // MIPS32EL:#define __mips_fpr 32 // MIPS32EL:#define __mips_hard_float 1 // MIPS32EL:#define __mips_o32 1 @@ -3555,6 +3557,7 @@ // MIPSN32BE: #define __mips64 1 // MIPSN32BE: #define __mips64__ 1 // MIPSN32BE: #define __mips__ 1 +// MIPSN32BE: #define __mips_abicalls 1 // MIPSN32BE: #define __mips_fpr 64 // MIPSN32BE: #define __mips_hard_float 1 // MIPSN32BE: #define __mips_isa_rev 2 @@ -3861,6 +3864,7 @@ // MIPSN32EL: #define __mips64 1 // MIPSN32EL: #define __mips64__ 1 // MIPSN32EL: #define __mips__ 1 +// MIPSN32EL: #define __mips_abicalls 1 // MIPSN32EL: #define __mips_fpr 64 // MIPSN32EL: #define __mips_hard_float 1 // MIPSN32EL: #define __mips_isa_rev 2 @@ -4073,6 +4077,7 @@ // MIPS64BE:#define __mips64 1 // MIPS64BE:#define __mips64__ 1 // MIPS64BE:#define __mips__ 1 +// MIPS64BE:#define __mips_abicalls 1 // MIPS64BE:#define __mips_fpr 64 // MIPS64BE:#define __mips_hard_float 1 // MIPS64BE:#define __mips_n64 1 @@ -4282,6 +4287,7 @@ // MIPS64EL:#define __mips64 1 // MIPS64EL:#define __mips64__ 1 // MIPS64EL:#define __mips__ 1 +// MIPS64EL:#define __mips_abicalls 1 // MIPS64EL:#define __mips_fpr 64 // MIPS64EL:#define __mips_hard_float 1 // MIPS64EL:#define __mips_n64 1 @@ -4513,6 +4519,45 @@ // MIPS-XXR6:#define __mips_fpr 64 // MIPS-XXR6:#define __mips_nan2008 1 // +// RUN: %clang_cc1 -target-cpu mips32 \ +// RUN: -E -dM -triple=mips-unknown-netbsd -mrelocation-model pic < /dev/null \ +// RUN: | FileCheck -match-full-lines -check-prefix MIPS-ABICALLS-NETBSD %s +// MIPS-ABICALLS-NETBSD-NOT: #define __ABICALLS__ 1 +// MIPS-ABICALLS-NETBSD: #define __mips_abicalls 1 +// +// RUN: %clang_cc1 -target-cpu mips64 \ +// RUN: -E -dM -triple=mips64-unknown-netbsd -mrelocation-model pic < \ +// RUN: /dev/null | FileCheck -match-full-lines \ +// RUN: -check-prefix MIPS-ABICALLS-NETBSD64 %s +// MIPS-ABICALLS-NETBSD64-NOT: #define __ABICALLS__ 1 +// MIPS-ABICALLS-NETBSD64: #define __mips_abicalls 1 +// +// RUN: %clang_cc1 -target-cpu mips32 \ +// RUN: -E -dM -triple=mips-unknown-freebsd -mrelocation-model pic < /dev/null \ +// RUN: | FileCheck -match-full-lines -check-prefix MIPS-ABICALLS-FREEBSD %s +// MIPS-ABICALLS-FREEBSD: #define __ABICALLS__ 1 +// MIPS-ABICALLS-FREEBSD: #define __mips_abicalls 1 +// +// RUN: %clang_cc1 -target-cpu mips64 \ +// RUN: -E -dM -triple=mips64-unknown-freebsd -mrelocation-model pic < \ +// RUN: /dev/null | FileCheck -match-full-lines \ +// RUN: -check-prefix MIPS-ABICALLS-FREEBSD64 %s +// MIPS-ABICALLS-FREEBSD64: #define __ABICALLS__ 1 +// MIPS-ABICALLS-FREEBSD64: #define __mips_abicalls 1 +// +// RUN: %clang_cc1 -target-cpu mips32 \ +// RUN: -E -dM -triple=mips-unknown-openbsd -mrelocation-model pic < /dev/null \ +// RUN: | FileCheck -match-full-lines -check-prefix MIPS-ABICALLS-OPENBSD %s +// MIPS-ABICALLS-OPENBSD: #define __ABICALLS__ 1 +// MIPS-ABICALLS-OPENBSD: #define __mips_abicalls 1 +// +// RUN: %clang_cc1 -target-cpu mips64 \ +// RUN: -E -dM -triple=mips64-unknown-openbsd -mrelocation-model pic < \ +// RUN: /dev/null | FileCheck -match-full-lines \ +// RUN: -check-prefix MIPS-ABICALLS-OPENBSD64 %s +// MIPS-ABICALLS-OPENBSD64: #define __ABICALLS__ 1 +// MIPS-ABICALLS-OPENBSD64: #define __mips_abicalls 1 +// // RUN: %clang_cc1 -E -dM -ffreestanding -triple=msp430-none-none < /dev/null | FileCheck -match-full-lines -check-prefix MSP430 %s // RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -triple=msp430-none-none < /dev/null | FileCheck -match-full-lines -check-prefix MSP430 -check-prefix MSP430-CXX %s // Index: cfe/trunk/lib/Basic/Targets.cpp === --- cfe/trunk/lib/Basic/Targets.cpp +++ cfe/trunk/lib/Basic/Targets.cpp @@ -7464,6 +7464,8 @@ bool IsMicromips; bool IsNan2008; bool IsSingleFloat; + bool IsNoABICalls; + bool CanUseBSDABICalls; enum MipsFloatABI { HardFloat, SoftFloat } FloatABI; @@ -7479,16 +7481,20 @@ public: MipsTarge
[PATCH] D29032: [mips] Define macros related to -mabicalls in the preprocessor
sdardis added a comment. Ok, I'll have `__mips_abicalls` unconditionally defined for everyone, The other two BSD's will have the traditional macro defined as well. https://reviews.llvm.org/D29032 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D29032: [mips] Define macros related to -mabicalls in the preprocessor
joerg added a comment. No need to preserve the BSD behavior for NetBSD. https://reviews.llvm.org/D29032 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D29032: [mips] Define macros related to -mabicalls in the preprocessor
sdardis added a comment. @joerg ping? https://reviews.llvm.org/D29032 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D29032: [mips] Define macros related to -mabicalls in the preprocessor
emaste added a comment. > My concern is that the stock gcc distributions for FreeBSD, NetBSD from your > sources doesn't define __mips_abicalls, I think we should consider that a bug in GCC that we'll rectify. If `__mips_abicalls` is used in Linux GCC then we can expect 3rd party sources to check it, and we can migrate the in-tree (base system) uses to follow suit (even if we're stuck with the toolchain defining both indefinitely). https://reviews.llvm.org/D29032 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D29032: [mips] Define macros related to -mabicalls in the preprocessor
joerg added a comment. Always defining __mips_abicalls is certainly the saner choice. I'm discussing with the NetBSD/MIPS guys whether we just want to go with it all the time and drop our custom changes for __ABICALLS__. Chances are quite good that we are going in that direction. https://reviews.llvm.org/D29032 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D29032: [mips] Define macros related to -mabicalls in the preprocessor
sdardis added a comment. @joerg , @emaste : My concern is that the stock gcc distributions for FreeBSD, NetBSD from your sources doesn't define __mips_abicalls, so I'm worried about potential incompatibilities. Comment at: test/Preprocessor/init.c:4533 +// MIPS-ABICALLS-NETBSD64: #define __ABICALLS__ 1 +// MIPS-ABICALLS-NETBSD-NOT: #define __mips_abicalls 1 +// Nit to self: this should be MIPS-ABICALLS-NETBSD64-NOT. Likewise for FREEBSD64 and OPENBSD64. https://reviews.llvm.org/D29032 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D29032: [mips] Define macros related to -mabicalls in the preprocessor
emaste added a comment. In https://reviews.llvm.org/D29032#654854, @emaste wrote: > As mentioned in https://reviews.llvm.org/D29032 Err, that should be https://reviews.llvm.org/D29024 https://reviews.llvm.org/D29032 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D29032: [mips] Define macros related to -mabicalls in the preprocessor
emaste added a comment. As mentioned in https://reviews.llvm.org/D29032 I agree with @joerg - `__mips_abicalls` should always be defined if this is what GCC does. https://reviews.llvm.org/D29032 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D29032: [mips] Define macros related to -mabicalls in the preprocessor
seanbruno accepted this revision. seanbruno added a comment. This revision is now accepted and ready to land. FreeBSD is happy with this. https://reviews.llvm.org/D29032 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D29032: [mips] Define macros related to -mabicalls in the preprocessor
joerg added a comment. I'm not terribly attached to using __ABICALLS__ for NetBSD, but let me check back with some of the MIPS folks. I would prefer __mips_abicalls to be always defined though, independent of the historic behavior. https://reviews.llvm.org/D29032 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D29032: [mips] Define macros related to -mabicalls in the preprocessor
sdardis added a comment. Sending it to the correct list this time. https://reviews.llvm.org/D29032 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D29032: [mips] Define macros related to -mabicalls in the preprocessor
sdardis created this revision. Historically, NetBSD, FreeBSD and OpenBSD have defined the macro ABICALLS in the preprocessor when -mabicalls is in effect. Mainline GCC later defined __mips_abicalls when -mabicalls is in effect. This patch teaches the preprocessor to define these macros when appropriate. This resolves PR/31694. Thanks to Sean Bruno for highlighting this issue! https://reviews.llvm.org/D29032 Files: lib/Basic/Targets.cpp test/Preprocessor/init.c Index: test/Preprocessor/init.c === --- test/Preprocessor/init.c +++ test/Preprocessor/init.c @@ -3040,6 +3040,7 @@ // MIPS32BE:#define __llvm__ 1 // MIPS32BE:#define __mips 32 // MIPS32BE:#define __mips__ 1 +// MIPS32BE:#define __mips_abicalls 1 // MIPS32BE:#define __mips_fpr 32 // MIPS32BE:#define __mips_hard_float 1 // MIPS32BE:#define __mips_o32 1 @@ -3246,6 +3247,7 @@ // MIPS32EL:#define __llvm__ 1 // MIPS32EL:#define __mips 32 // MIPS32EL:#define __mips__ 1 +// MIPS32EL:#define __mips_abicalls 1 // MIPS32EL:#define __mips_fpr 32 // MIPS32EL:#define __mips_hard_float 1 // MIPS32EL:#define __mips_o32 1 @@ -3555,6 +3557,7 @@ // MIPSN32BE: #define __mips64 1 // MIPSN32BE: #define __mips64__ 1 // MIPSN32BE: #define __mips__ 1 +// MIPSN32BE: #define __mips_abicalls 1 // MIPSN32BE: #define __mips_fpr 64 // MIPSN32BE: #define __mips_hard_float 1 // MIPSN32BE: #define __mips_isa_rev 2 @@ -3861,6 +3864,7 @@ // MIPSN32EL: #define __mips64 1 // MIPSN32EL: #define __mips64__ 1 // MIPSN32EL: #define __mips__ 1 +// MIPSN32EL: #define __mips_abicalls 1 // MIPSN32EL: #define __mips_fpr 64 // MIPSN32EL: #define __mips_hard_float 1 // MIPSN32EL: #define __mips_isa_rev 2 @@ -4073,6 +4077,7 @@ // MIPS64BE:#define __mips64 1 // MIPS64BE:#define __mips64__ 1 // MIPS64BE:#define __mips__ 1 +// MIPS64BE:#define __mips_abicalls 1 // MIPS64BE:#define __mips_fpr 64 // MIPS64BE:#define __mips_hard_float 1 // MIPS64BE:#define __mips_n64 1 @@ -4282,6 +4287,7 @@ // MIPS64EL:#define __mips64 1 // MIPS64EL:#define __mips64__ 1 // MIPS64EL:#define __mips__ 1 +// MIPS64EL:#define __mips_abicalls 1 // MIPS64EL:#define __mips_fpr 64 // MIPS64EL:#define __mips_hard_float 1 // MIPS64EL:#define __mips_n64 1 @@ -4513,6 +4519,45 @@ // MIPS-XXR6:#define __mips_fpr 64 // MIPS-XXR6:#define __mips_nan2008 1 // +// RUN: %clang_cc1 -target-cpu mips32 \ +// RUN: -E -dM -triple=mips-unknown-netbsd -mrelocation-model pic < /dev/null \ +// RUN: | FileCheck -match-full-lines -check-prefix MIPS-ABICALLS-NETBSD %s +// MIPS-ABICALLS-NETBSD: #define __ABICALLS__ 1 +// MIPS-ABICALLS-NETBSD-NOT: #define __mips_abicalls 1 +// +// RUN: %clang_cc1 -target-cpu mips64 \ +// RUN: -E -dM -triple=mips64-unknown-netbsd -mrelocation-model pic < \ +// RUN: /dev/null | FileCheck -match-full-lines \ +// RUN: -check-prefix MIPS-ABICALLS-NETBSD64 %s +// MIPS-ABICALLS-NETBSD64: #define __ABICALLS__ 1 +// MIPS-ABICALLS-NETBSD-NOT: #define __mips_abicalls 1 +// +// RUN: %clang_cc1 -target-cpu mips32 \ +// RUN: -E -dM -triple=mips-unknown-freebsd -mrelocation-model pic < /dev/null \ +// RUN: | FileCheck -match-full-lines -check-prefix MIPS-ABICALLS-FREEBSD %s +// MIPS-ABICALLS-FREEBSD: #define __ABICALLS__ 1 +// MIPS-ABICALLS-FREEBSD-NOT: #define __mips_abicalls 1 +// +// RUN: %clang_cc1 -target-cpu mips64 \ +// RUN: -E -dM -triple=mips64-unknown-freebsd -mrelocation-model pic < \ +// RUN: /dev/null | FileCheck -match-full-lines \ +// RUN: -check-prefix MIPS-ABICALLS-FREEBSD64 %s +// MIPS-ABICALLS-FREEBSD64: #define __ABICALLS__ 1 +// MIPS-ABICALLS-FREEBSD-NOT: #define __mips_abicalls 1 +// +// RUN: %clang_cc1 -target-cpu mips32 \ +// RUN: -E -dM -triple=mips-unknown-openbsd -mrelocation-model pic < /dev/null \ +// RUN: | FileCheck -match-full-lines -check-prefix MIPS-ABICALLS-OPENBSD %s +// MIPS-ABICALLS-OPENBSD: #define __ABICALLS__ 1 +// MIPS-ABICALLS-OPENBSD-NOT: #define __mips_abicalls 1 +// +// RUN: %clang_cc1 -target-cpu mips64 \ +// RUN: -E -dM -triple=mips64-unknown-openbsd -mrelocation-model pic < \ +// RUN: /dev/null | FileCheck -match-full-lines \ +// RUN: -check-prefix MIPS-ABICALLS-OPENBSD64 %s +// MIPS-ABICALLS-OPENBSD64: #define __ABICALLS__ 1 +// MIPS-ABICALLS-OPENBSD-NOT: #define __mips_abicalls 1 +// // RUN: %clang_cc1 -E -dM -ffreestanding -triple=msp430-none-none < /dev/null | FileCheck -match-full-lines -check-prefix MSP430 %s // RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -triple=msp430-none-none < /dev/null | FileCheck -match-full-lines -check-prefix MSP430 -check-prefix MSP430-CXX %s // Index: lib/Basic/Targets.cpp === --- lib/Basic/Targets.cpp +++ lib/Basic/Targets.cpp @@ -7434,6 +7434,8 @@ bool IsMicromips; bool IsNan2008; bool IsSingleFloat; + bool IsNoABICalls; + bool CanUseBSDABICalls; enum MipsFloatABI { HardFloat, SoftFloat } FloatABI; @@ -7449,16 +7451,21 @@