[llvm-commits] [llvm-gcc-4.2] r50405 - in /llvm-gcc-4.2/trunk/gcc/config/i386: cygming.h i386.c i386.h i386elf.h mingw32.h unix.h
Anton Korobeynikov
asl at math.spbu.ru
Mon Apr 28 23:24:14 PDT 2008
Author: asl
Date: Tue Apr 29 01:24:14 2008
New Revision: 50405
URL: http://llvm.org/viewvc/llvm-project?rev=50405&view=rev
Log:
Backport from mainline.
Finally add necessary bits for win64
Modified:
llvm-gcc-4.2/trunk/gcc/config/i386/cygming.h
llvm-gcc-4.2/trunk/gcc/config/i386/i386.c
llvm-gcc-4.2/trunk/gcc/config/i386/i386.h
llvm-gcc-4.2/trunk/gcc/config/i386/i386elf.h
llvm-gcc-4.2/trunk/gcc/config/i386/mingw32.h
llvm-gcc-4.2/trunk/gcc/config/i386/unix.h
Modified: llvm-gcc-4.2/trunk/gcc/config/i386/cygming.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/cygming.h?rev=50405&r1=50404&r2=50405&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/cygming.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/cygming.h Tue Apr 29 01:24:14 2008
@@ -21,22 +21,43 @@
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
+/* LLVM LOCAL begin mainline */
+#if TARGET_64BIT_DEFAULT
+#ifndef DWARF2_DEBUGGING_INFO
+#define DWARF2_DEBUGGING_INFO 1
+#endif
+#ifndef DWARF2_UNWIND_INFO
+#define DWARF2_UNWIND_INFO 1
+#endif
+#endif
+/* LLVM LOCAL end mainline */
+
#define DBX_DEBUGGING_INFO 1
#define SDB_DEBUGGING_INFO 1
#undef PREFERRED_DEBUGGING_TYPE
+/* LLVM LOCAL begin mainline */
+#if TARGET_64BIT_DEFAULT
+#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
+#else
#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
+#endif
+
+#undef TARGET_64BIT_MS_ABI
+#define TARGET_64BIT_MS_ABI TARGET_64BIT
+/* LLVM LOCAL end mainline */
#ifdef HAVE_GAS_PE_SECREL32_RELOC
#define DWARF2_DEBUGGING_INFO 1
-/* LLVM LOCAL begin mainline 125696 */
+/* LLVM LOCAL begin mainline */
/* Map gcc register number to DBX register number. Maintain
compatibility with old -gstabs compiled code. */
-/* LLVM LOCAL end mainline 125696 */
#undef DBX_REGISTER_NUMBER
-#define DBX_REGISTER_NUMBER(n) (write_symbols == DWARF2_DEBUG \
- ? svr4_dbx_register_map[n] \
- : dbx_register_map[n])
+#define DBX_REGISTER_NUMBER(n) \
+ (TARGET_64BIT ? dbx64_register_map[n] \
+ : (write_symbols == DWARF2_DEBUG \
+ ? svr4_dbx_register_map[n] : dbx_register_map[n]))
+/* LLVM LOCAL end mainline */
/* LLVM LOCAL begin mainline 125696 */
/* Map gcc register number to DWARF 2 CFA column number. Always
@@ -109,14 +130,37 @@
#undef MATH_LIBRARY
#define MATH_LIBRARY ""
-#define SIZE_TYPE "unsigned int"
-#define PTRDIFF_TYPE "int"
+/* LLVM LOCAL begin mainline */
+#define SIZE_TYPE (TARGET_64BIT ? "long long unsigned int" : "unsigned int")
+#define PTRDIFF_TYPE (TARGET_64BIT ? "long long int" : "int")
+
#define WCHAR_TYPE_SIZE 16
#define WCHAR_TYPE "short unsigned int"
+/* Windows64 continues to use a 32-bit long type. */
+#undef LONG_TYPE_SIZE
+#define LONG_TYPE_SIZE 32
+
+#undef REG_PARM_STACK_SPACE
+#define REG_PARM_STACK_SPACE(FNDECL) (TARGET_64BIT_MS_ABI ? 32 : 0)
+
+#undef OUTGOING_REG_PARM_STACK_SPACE
+#define OUTGOING_REG_PARM_STACK_SPACE (TARGET_64BIT_MS_ABI ? 1 : 0)
+
+#undef REGPARM_MAX
+#define REGPARM_MAX (TARGET_64BIT_MS_ABI ? 4 : 3)
+
+#undef SSE_REGPARM_MAX
+#define SSE_REGPARM_MAX (TARGET_64BIT_MS_ABI ? 4 : TARGET_SSE ? 3 : 0)
+/* LLVM LOCAL end mainline */
+
/* Enable parsing of #pragma pack(push,<n>) and #pragma pack(pop). */
#define HANDLE_PRAGMA_PACK_PUSH_POP 1
+/* LLVM LOCAL begin mainline */
+/* Enable push_macro & pop_macro */
+#define HANDLE_PRAGMA_PUSH_POP_MACRO 1
+/* LLVM LOCAL end mainline */
union tree_node;
#define TREE union tree_node *
@@ -202,14 +246,21 @@
#define CHECK_STACK_LIMIT 4000
+/* LLVM LOCAL begin mainline */
+#undef STACK_BOUNDARY
+#define STACK_BOUNDARY (TARGET_64BIT_MS_ABI ? 128 : BITS_PER_WORD)
+/* LLVM LOCAL end mainline */
+
/* By default, target has a 80387, uses IEEE compatible arithmetic,
returns float values in the 387 and needs stack probes.
We also align doubles to 64-bits for MSVC default compatibility. */
+/* LLVM LOCAL begin mainline */
#undef TARGET_SUBTARGET_DEFAULT
#define TARGET_SUBTARGET_DEFAULT \
- (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_STACK_PROBE \
- | MASK_ALIGN_DOUBLE)
+ (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS \
+ | MASK_STACK_PROBE | MASK_ALIGN_DOUBLE)
+/* LLVM LOCAL end mainline */
/* This is how to output an assembler line
that says to advance the location counter
@@ -393,9 +444,11 @@
#undef TARGET_USE_LOCAL_THUNK_ALIAS_P
#define TARGET_USE_LOCAL_THUNK_ALIAS_P(DECL) (!DECL_ONE_ONLY (DECL))
+/* LLVM LOCAL begin mainline */
#define SUBTARGET_ATTRIBUTE_TABLE \
- /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */ \
{ "selectany", 0, 0, true, false, false, ix86_handle_selectany_attribute }
+ /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */
+/* LLVM LOCAL end mainline */
/* mcount() does not need a counter variable. */
#undef NO_PROFILE_COUNTERS
Modified: llvm-gcc-4.2/trunk/gcc/config/i386/i386.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/i386.c?rev=50405&r1=50404&r2=50405&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/i386.c (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/i386.c Tue Apr 29 01:24:14 2008
@@ -1443,6 +1443,10 @@
#define TARGET_INTERNAL_ARG_POINTER ix86_internal_arg_pointer
#undef TARGET_DWARF_HANDLE_FRAME_UNSPEC
#define TARGET_DWARF_HANDLE_FRAME_UNSPEC ix86_dwarf_handle_frame_unspec
+/* LLVM LOCAL begin mainline */
+#undef TARGET_STRICT_ARGUMENT_NAMING
+#define TARGET_STRICT_ARGUMENT_NAMING hook_bool_CUMULATIVE_ARGS_true
+/* LLVM LOCAL end mainline */
#undef TARGET_GIMPLIFY_VA_ARG_EXPR
#define TARGET_GIMPLIFY_VA_ARG_EXPR ix86_gimplify_va_arg
@@ -1776,9 +1780,18 @@
}
else
{
- ix86_cmodel = CM_32;
- if (TARGET_64BIT)
+ /* LLVM LOCAL begin mainline */
+ /* For TARGET_64BIT_MS_ABI, force pic on, in order to enable the
+ use of rip-relative addressing. This eliminates fixups that
+ would otherwise be needed if this object is to be placed in a
+ DLL, and is essentially just as efficient as direct addressing. */
+ if (TARGET_64BIT_MS_ABI)
+ ix86_cmodel = CM_SMALL_PIC, flag_pic = 1;
+ else if (TARGET_64BIT)
ix86_cmodel = flag_pic ? CM_SMALL_PIC : CM_SMALL;
+ else
+ ix86_cmodel = CM_32;
+ /* LLVM LOCAL end mainline */
}
if (ix86_asm_string != 0)
{
@@ -1894,15 +1907,20 @@
/* Validate -mregparm= value. */
if (ix86_regparm_string)
{
+ /* LLVM LOCAL begin mainline */
+ if (TARGET_64BIT)
+ warning (0, "-mregparm is ignored in 64-bit mode");
+ /* LLVM LOCAL end mainline */
i = atoi (ix86_regparm_string);
if (i < 0 || i > REGPARM_MAX)
error ("-mregparm=%d is not between 0 and %d", i, REGPARM_MAX);
else
ix86_regparm = i;
}
- else
- if (TARGET_64BIT)
- ix86_regparm = REGPARM_MAX;
+ /* LLVM LOCAL begin mainline */
+ if (TARGET_64BIT)
+ ix86_regparm = REGPARM_MAX;
+ /* LLVM LOCAL end mainline */
/* If the user has provided any of the -malign-* options,
warn and use that value only if -falign-* is not set.
@@ -1996,8 +2014,6 @@
/* APPLE LOCAL begin mainline */
if (TARGET_64BIT)
{
- if (TARGET_ALIGN_DOUBLE)
- error ("-malign-double makes no sense in the 64bit mode");
if (TARGET_RTD)
error ("-mrtd calling convention not supported in the 64bit mode");
/* APPLE LOCAL begin radar 4877693 */
@@ -2697,8 +2713,12 @@
if (TARGET_64BIT)
{
- warning (OPT_Wattributes, "%qs attribute ignored",
- IDENTIFIER_POINTER (name));
+ /* LLVM LOCAL begin mainline */
+ /* Do not warn when emulating the MS ABI. */
+ if (!TARGET_64BIT_MS_ABI)
+ warning (OPT_Wattributes, "%qs attribute ignored",
+ IDENTIFIER_POINTER (name));
+ /* LLVM LOCAL end mainline */
*no_add_attrs = true;
return NULL_TREE;
}
@@ -4056,23 +4076,44 @@
the argument itself. The pointer is passed in whatever way is
appropriate for passing a pointer to that type. */
+/* LLVM LOCAL begin mainline */
static bool
ix86_pass_by_reference (CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED,
enum machine_mode mode ATTRIBUTE_UNUSED,
tree type, bool named ATTRIBUTE_UNUSED)
{
- if (!TARGET_64BIT)
- return 0;
-
- if (type && int_size_in_bytes (type) == -1)
+ /* See Windows x64 Software Convention. */
+ if (TARGET_64BIT_MS_ABI)
{
- if (TARGET_DEBUG_ARG)
- fprintf (stderr, "function_arg_pass_by_reference\n");
- return 1;
+ int msize = (int) GET_MODE_SIZE (mode);
+ if (type)
+ {
+ /* Arrays are passed by reference. */
+ if (TREE_CODE (type) == ARRAY_TYPE)
+ return true;
+
+ if (AGGREGATE_TYPE_P (type))
+ {
+ /* Structs/unions of sizes other than 8, 16, 32, or 64 bits
+ are passed by reference. */
+ msize = int_size_in_bytes (type);
+ }
+ }
+
+ /* __m128 is passed by reference. */
+ switch (msize) {
+ case 1: case 2: case 4: case 8:
+ break;
+ default:
+ return true;
+ }
}
+ else if (TARGET_64BIT && type && int_size_in_bytes (type) == -1)
+ return 1;
return 0;
}
+/* LLVM LOCAL end mainline */
/* Return true when TYPE should be 128bit aligned for 32bit argument passing
ABI. Only called if TARGET_SSE. */
@@ -19708,7 +19749,7 @@
{
int tmp_regno = 2 /* ECX */;
if (lookup_attribute ("fastcall",
- TYPE_ATTRIBUTES (TREE_TYPE (function))))
+ TYPE_ATTRIBUTES (TREE_TYPE (function))))
tmp_regno = 0 /* EAX */;
tmp = gen_rtx_REG (SImode, tmp_regno);
}
Modified: llvm-gcc-4.2/trunk/gcc/config/i386/i386.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/i386.h?rev=50405&r1=50404&r2=50405&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/i386.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/i386.h Tue Apr 29 01:24:14 2008
@@ -306,6 +306,12 @@
it's analogous to similar code for Mach-O on PowerPC. darwin.h
redefines this to 1. */
#define TARGET_MACHO 0
+
+/* LLVM LOCAL begin mainline */
+/* Likewise, for the Windows 64-bit ABI. */
+#define TARGET_64BIT_MS_ABI 0
+/* LLVM LOCAL end mainline */
+
/* APPLE LOCAL begin mach-o cleanup */
#define MACHOPIC_INDIRECT 0
#define MACHOPIC_PURE 0
Modified: llvm-gcc-4.2/trunk/gcc/config/i386/i386elf.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/i386elf.h?rev=50405&r1=50404&r2=50405&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/i386elf.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/i386elf.h Tue Apr 29 01:24:14 2008
@@ -27,11 +27,6 @@
#define TARGET_VERSION fprintf (stderr, " (i386 bare ELF target)");
-/* By default, target has a 80387, uses IEEE compatible arithmetic,
- and returns float values in the 387. */
-
-#define TARGET_SUBTARGET_DEFAULT (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS)
-
/* The ELF ABI for the i386 says that records and unions are returned
in memory. */
Modified: llvm-gcc-4.2/trunk/gcc/config/i386/mingw32.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/mingw32.h?rev=50405&r1=50404&r2=50405&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/mingw32.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/mingw32.h Tue Apr 29 01:24:14 2008
@@ -20,10 +20,18 @@
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
+/* LLVM LOCAL begin mainline */
#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (x86 MinGW)");
+#if TARGET_64BIT_DEFAULT
+#define TARGET_VERSION fprintf (stderr,"(x86_64 MinGW");
+#else
+#define TARGET_VERSION fprintf (stderr," (x86 MinGW)");
+#endif
+/* LLVM LOCAL end mainline */
-/* See i386/crtdll.h for an alternative definition. */
+/* LLVM LOCAL begin mainline */
+/* See i386/crtdll.h for an alternative definition. _INTEGRAL_MAX_BITS
+ is for compatibility with native compiler. */
#define EXTRA_OS_CPP_BUILTINS() \
do \
{ \
@@ -32,13 +40,28 @@
builtin_define ("_WIN32"); \
builtin_define_std ("WIN32"); \
builtin_define_std ("WINNT"); \
+ builtin_define_with_int_value ("_INTEGRAL_MAX_BITS", \
+ TYPE_PRECISION (intmax_type_node));\
+ if (TARGET_64BIT_MS_ABI) \
+ { \
+ builtin_define ("__MINGW64__"); \
+ builtin_define_std ("WIN64"); \
+ builtin_define_std ("_WIN64"); \
+ } \
} \
while (0)
+/* LLVM LOCAL end mainline */
/* Override the standard choice of /usr/include as the default prefix
to try when searching for header files. */
#undef STANDARD_INCLUDE_DIR
+/* LLVM LOCAL begin mainline */
+#if TARGET_64BIT_DEFAULT
+#define STANDARD_INCLUDE_DIR "/mingw/include64"
+#else
#define STANDARD_INCLUDE_DIR "/mingw/include"
+#endif
+/* LLVM LOCAL end mainline */
#undef STANDARD_INCLUDE_COMPONENT
#define STANDARD_INCLUDE_COMPONENT "MINGW"
@@ -78,8 +101,14 @@
/* Override startfile prefix defaults. */
#ifndef STANDARD_STARTFILE_PREFIX_1
+/* LLVM LOCAL begin mainline */
+#if TARGET_64BIT_DEFAULT
+#define STANDARD_STARTFILE_PREFIX_1 "/mingw/lib64/"
+#else
#define STANDARD_STARTFILE_PREFIX_1 "/mingw/lib/"
#endif
+/* LLVM LOCAL end mainline */
+#endif
#ifndef STANDARD_STARTFILE_PREFIX_2
#define STANDARD_STARTFILE_PREFIX_2 ""
#endif
@@ -121,10 +150,48 @@
#define GOMP_SELF_SPECS "%{fopenmp: -mthreads}"
-/* LLVM LOCAL begin mainline 125696 */
-/* This works on mingw32. */
-#undef TARGET_USE_JCR_SECTION
-#define TARGET_USE_JCR_SECTION 1
+/* LLVM LOCAL begin mainline */
+/* Contains a pointer to type target_ovr_attr defining the target specific
+ overrides of format attributes. See c-format.h for structure
+ definition. */
+#undef TARGET_OVERRIDES_FORMAT_ATTRIBUTES
+#define TARGET_OVERRIDES_FORMAT_ATTRIBUTES mingw_format_attribute_overrides
+
+/* Specify the count of elements in TARGET_OVERRIDES_ATTRIBUTE. */
+#undef TARGET_OVERRIDES_FORMAT_ATTRIBUTES_COUNT
+#define TARGET_OVERRIDES_FORMAT_ATTRIBUTES_COUNT 3
+
+/* MS specific format attributes for ms_printf, ms_scanf, ms_strftime. */
+#undef TARGET_FORMAT_TYPES
+#define TARGET_FORMAT_TYPES mingw_format_attributes
+
+#undef TARGET_N_FORMAT_TYPES
+#define TARGET_N_FORMAT_TYPES 3
+
+#define TARGET_USE_JCR_SECTION 0
+
+#undef MINGW_ENABLE_EXECUTE_STACK
+#define MINGW_ENABLE_EXECUTE_STACK \
+extern void __enable_execute_stack (void *); \
+void \
+__enable_execute_stack (void *addr) \
+{ \
+ MEMORY_BASIC_INFORMATION b; \
+ if (!VirtualQuery (addr, &b, sizeof(b))) \
+ abort (); \
+ VirtualProtect (b.BaseAddress, b.RegionSize, PAGE_EXECUTE_READWRITE, \
+ &b.Protect); \
+}
+
+#undef ENABLE_EXECUTE_STACK
+#define ENABLE_EXECUTE_STACK MINGW_ENABLE_EXECUTE_STACK
+
+#ifdef IN_LIBGCC2
+#include <windows.h>
+#endif
+
+#if !TARGET_64BIT
#define MD_UNWIND_SUPPORT "config/i386/w32-unwind.h"
-/* LLVM LOCAL end mainline 125696 */
+#endif
+/* LLVM LOCAL end mainline */
Modified: llvm-gcc-4.2/trunk/gcc/config/i386/unix.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/unix.h?rev=50405&r1=50404&r2=50405&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/unix.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/unix.h Tue Apr 29 01:24:14 2008
@@ -61,5 +61,12 @@
/* By default, target has a 80387, uses IEEE compatible arithmetic,
and returns float values in the 387. */
+/* LLVM LOCAL begin mainline */
+#define TARGET_SUBTARGET_DEFAULT \
+ (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS)
-#define TARGET_SUBTARGET_DEFAULT (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS)
+/* By default, 64-bit mode uses 128-bit long double. */
+#undef TARGET_SUBTARGET64_DEFAULT
+#define TARGET_SUBTARGET64_DEFAULT \
+ MASK_128BIT_LONG_DOUBLE
+/* LLVM LOCAL end mainline */
More information about the llvm-commits
mailing list