|
1 dnl This Source Code Form is subject to the terms of the Mozilla Public |
|
2 dnl License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/. |
|
4 |
|
5 dnl Check if the compiler is gcc and has PR49911. If so |
|
6 dnl disable vrp. |
|
7 |
|
8 AC_DEFUN([MOZ_GCC_PR49911], |
|
9 [ |
|
10 if test "$GNU_CC"; then |
|
11 |
|
12 AC_MSG_CHECKING(for gcc PR49911) |
|
13 ac_have_gcc_pr49911="no" |
|
14 AC_LANG_SAVE |
|
15 AC_LANG_CPLUSPLUS |
|
16 |
|
17 _SAVE_CXXFLAGS=$CXXFLAGS |
|
18 CXXFLAGS="-O2" |
|
19 AC_TRY_RUN([ |
|
20 extern "C" void abort(void); |
|
21 typedef enum { |
|
22 eax, ecx, edx, ebx, esp, ebp, |
|
23 esi, edi } |
|
24 RegisterID; |
|
25 union StateRemat { |
|
26 RegisterID reg_; |
|
27 int offset_; |
|
28 }; |
|
29 static StateRemat FromRegister(RegisterID reg) { |
|
30 StateRemat sr; |
|
31 sr.reg_ = reg; |
|
32 return sr; |
|
33 } |
|
34 static StateRemat FromAddress3(int address) { |
|
35 StateRemat sr; |
|
36 sr.offset_ = address; |
|
37 if (address < 46 && address >= 0) { |
|
38 abort(); |
|
39 } |
|
40 return sr; |
|
41 } |
|
42 struct FrameState { |
|
43 StateRemat dataRematInfo2(bool y, int z) { |
|
44 if (y) return FromRegister(RegisterID(1)); |
|
45 return FromAddress3(z); |
|
46 } |
|
47 }; |
|
48 FrameState frame; |
|
49 StateRemat x; |
|
50 __attribute__((noinline)) void jsop_setelem(bool y, int z) { |
|
51 x = frame.dataRematInfo2(y, z); |
|
52 } |
|
53 int main(void) { |
|
54 jsop_setelem(0, 47); |
|
55 } |
|
56 ], true, |
|
57 ac_have_gcc_pr49911="yes", |
|
58 true) |
|
59 CXXFLAGS="$_SAVE_CXXFLAGS" |
|
60 |
|
61 AC_LANG_RESTORE |
|
62 |
|
63 if test "$ac_have_gcc_pr49911" = "yes"; then |
|
64 AC_MSG_RESULT(yes) |
|
65 CFLAGS="$CFLAGS -fno-tree-vrp" |
|
66 CXXFLAGS="$CXXFLAGS -fno-tree-vrp" |
|
67 else |
|
68 AC_MSG_RESULT(no) |
|
69 fi |
|
70 fi |
|
71 ]) |