Commit 7dcbf659 by Jan Hubicka Committed by Jan Hubicka

output.h (enum section_category): Export from varasm.c


	* output.h (enum section_category): Export from varasm.c
	(categorize_decl_for_section): Likewise.
	* varasm.c (enum section_category): Kill.
	(categorize_decl_for_section): Make global.
	* i386-protos.h (x86_output_aligned_bss, x86_elf_aligned_common):
	Declare.
	* i386.c (ix86_section_threshold): New static variable.
	(ix86_in_large_data_p, ix86_encode_section_info,
	x86_64_elf_unique_section,
	x86_64_elf_select_section): New functions.
	(TARGET_ENCODE_SECTION_INFO): Define
	(override_options): Enable medium model for PIC.
	(ix86_expand_prologue): Expand gen_set_got_rex64.
	(legitimate_constant_p): Handle new UNSPECs.
	(legitimate_pic_address_disp_p): Likewise.
	(legitimize_pic_address): Lower MEDIUM model addressing.
	* i386.h (PIC_OFFSET_TABLE_REGNUM): Set for medium model PIC.
	(enum cmodel): Add MEDIUM_PIC.
	(SYMBOL_REF_FAR_ADDR_P): New macro.
	(SYMBOL_FLAG_FAR_ADDR): New flag.
	* i386.md (movdi): Support medium model.
	(set_got_rex64): New pattern.
	* i386.opt (mlarge-data-threshold): New flag.
	* predicates.md (zext_operand/sext_operand): Deal with medium model.
	* x86-64.h (ASM_OUTPUT_ALIGNED_BSS): Use x86_output_aligned_bss.
	(ASM_OUTPUT_ALIGNED_COMMON, TARGET_ASM_SELECT_SECTION,
	TARGET_ASM_UNIQUE_SECTION): New.

	* invoke.texi (-mlarge_data_threshold): Document

From-SVN: r102606
parent 3601aa8a
2005-07-31 Jan Hubicka <jh@suse.cz> 2005-07-31 Jan Hubicka <jh@suse.cz>
* output.h (enum section_category): Export from varasm.c
(categorize_decl_for_section): Likewise.
* varasm.c (enum section_category): Kill.
(categorize_decl_for_section): Make global.
* i386-protos.h (x86_output_aligned_bss, x86_elf_aligned_common):
Declare.
* i386.c (ix86_section_threshold): New static variable.
(ix86_in_large_data_p, ix86_encode_section_info,
x86_64_elf_unique_section,
x86_64_elf_select_section): New functions.
(TARGET_ENCODE_SECTION_INFO): Define
(override_options): Enable medium model for PIC.
(ix86_expand_prologue): Expand gen_set_got_rex64.
(legitimate_constant_p): Handle new UNSPECs.
(legitimate_pic_address_disp_p): Likewise.
(legitimize_pic_address): Lower MEDIUM model addressing.
* i386.h (PIC_OFFSET_TABLE_REGNUM): Set for medium model PIC.
(enum cmodel): Add MEDIUM_PIC.
(SYMBOL_REF_FAR_ADDR_P): New macro.
(SYMBOL_FLAG_FAR_ADDR): New flag.
* i386.md (movdi): Support medium model.
(set_got_rex64): New pattern.
* i386.opt (mlarge-data-threshold): New flag.
* predicates.md (zext_operand/sext_operand): Deal with medium model.
* x86-64.h (ASM_OUTPUT_ALIGNED_BSS): Use x86_output_aligned_bss.
(ASM_OUTPUT_ALIGNED_COMMON, TARGET_ASM_SELECT_SECTION,
TARGET_ASM_UNIQUE_SECTION): New.
* invoke.texi (-mlarge_data_threshold): Document
2005-07-31 Jan Hubicka <jh@suse.cz>
* tree-outof-ssa.c (coalesce_ssa_name): Use coalesce_cost. * tree-outof-ssa.c (coalesce_ssa_name): Use coalesce_cost.
(coalesce_vars): Likewise. (coalesce_vars): Likewise.
* tree-ssa-live.c (coalesce_cost): New. * tree-ssa-live.c (coalesce_cost): New.
......
...@@ -259,6 +259,10 @@ struct ix86_address ...@@ -259,6 +259,10 @@ struct ix86_address
extern int ix86_decompose_address (rtx, struct ix86_address *); extern int ix86_decompose_address (rtx, struct ix86_address *);
extern int memory_address_length (rtx addr); extern int memory_address_length (rtx addr);
extern void x86_output_aligned_bss (FILE *, tree, const char *,
unsigned HOST_WIDE_INT, int);
extern void x86_elf_aligned_common (FILE *, const char *,
unsigned HOST_WIDE_INT, int);
#ifdef RTX_CODE #ifdef RTX_CODE
extern void ix86_fp_comparison_codes (enum rtx_code code, enum rtx_code *, extern void ix86_fp_comparison_codes (enum rtx_code code, enum rtx_code *,
......
...@@ -961,7 +961,8 @@ do { \ ...@@ -961,7 +961,8 @@ do { \
#define REAL_PIC_OFFSET_TABLE_REGNUM 3 #define REAL_PIC_OFFSET_TABLE_REGNUM 3
#define PIC_OFFSET_TABLE_REGNUM \ #define PIC_OFFSET_TABLE_REGNUM \
(TARGET_64BIT || !flag_pic ? INVALID_REGNUM \ ((TARGET_64BIT && ix86_cmodel == CM_SMALL_PIC) \
|| !flag_pic ? INVALID_REGNUM \
: reload_completed ? REGNO (pic_offset_table_rtx) \ : reload_completed ? REGNO (pic_offset_table_rtx) \
: REAL_PIC_OFFSET_TABLE_REGNUM) : REAL_PIC_OFFSET_TABLE_REGNUM)
...@@ -2143,7 +2144,8 @@ enum cmodel { ...@@ -2143,7 +2144,8 @@ enum cmodel {
CM_KERNEL, /* Assumes all code and data fits in the high 31 bits. */ CM_KERNEL, /* Assumes all code and data fits in the high 31 bits. */
CM_MEDIUM, /* Assumes code fits in the low 31 bits; data unlimited. */ CM_MEDIUM, /* Assumes code fits in the low 31 bits; data unlimited. */
CM_LARGE, /* No assumptions. */ CM_LARGE, /* No assumptions. */
CM_SMALL_PIC /* Assumes code+data+got/plt fits in a 31 bit region. */ CM_SMALL_PIC, /* Assumes code+data+got/plt fits in a 31 bit region. */
CM_MEDIUM_PIC /* Assumes code+got/plt fits in a 31 bit region. */
}; };
extern enum cmodel ix86_cmodel; extern enum cmodel ix86_cmodel;
...@@ -2160,7 +2162,7 @@ enum asm_dialect { ...@@ -2160,7 +2162,7 @@ enum asm_dialect {
extern enum asm_dialect ix86_asm_dialect; extern enum asm_dialect ix86_asm_dialect;
extern unsigned int ix86_preferred_stack_boundary; extern unsigned int ix86_preferred_stack_boundary;
extern int ix86_branch_cost; extern int ix86_branch_cost, ix86_section_threshold;
/* Smallest class containing REGNO. */ /* Smallest class containing REGNO. */
extern enum reg_class const regclass_map[FIRST_PSEUDO_REGISTER]; extern enum reg_class const regclass_map[FIRST_PSEUDO_REGISTER];
...@@ -2281,6 +2283,10 @@ struct machine_function GTY(()) ...@@ -2281,6 +2283,10 @@ struct machine_function GTY(())
#define X86_FILE_START_VERSION_DIRECTIVE false #define X86_FILE_START_VERSION_DIRECTIVE false
#define X86_FILE_START_FLTUSED false #define X86_FILE_START_FLTUSED false
/* Flag to mark data that is in the large address area. */
#define SYMBOL_FLAG_FAR_ADDR (SYMBOL_FLAG_MACH_DEP << 0)
#define SYMBOL_REF_FAR_ADDR_P(X) \
((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_FAR_ADDR) != 0)
/* /*
Local variables: Local variables:
version-control: t version-control: t
......
...@@ -13788,6 +13788,14 @@ ...@@ -13788,6 +13788,14 @@
[(set_attr "type" "multi") [(set_attr "type" "multi")
(set_attr "length" "12")]) (set_attr "length" "12")])
(define_insn "set_got_rex64"
[(set (match_operand:DI 0 "register_operand" "=r")
(unspec:DI [(const_int 0)] UNSPEC_SET_GOT))]
"TARGET_64BIT"
"lea{q}\t_GLOBAL_OFFSET_TABLE_(%%rip), %0"
[(set_attr "type" "lea")
(set_attr "length" "6")])
(define_expand "epilogue" (define_expand "epilogue"
[(const_int 1)] [(const_int 1)]
"" ""
......
...@@ -87,6 +87,10 @@ mbranch-cost= ...@@ -87,6 +87,10 @@ mbranch-cost=
Target RejectNegative Joined Var(ix86_branch_cost_string) Target RejectNegative Joined Var(ix86_branch_cost_string)
Branches are this expensive (1-5, arbitrary units) Branches are this expensive (1-5, arbitrary units)
mlarge-data-threshold=
Target RejectNegative Joined Var(ix86_section_threshold_string)
Data greater than given threshold will go into .ldata section in x86-64 medium model
mcmodel= mcmodel=
Target RejectNegative Joined Var(ix86_cmodel_string) Target RejectNegative Joined Var(ix86_cmodel_string)
Use given x86-64 code model Use given x86-64 code model
......
...@@ -110,7 +110,8 @@ ...@@ -110,7 +110,8 @@
/* TLS symbols are not constant. */ /* TLS symbols are not constant. */
if (tls_symbolic_operand (op, Pmode)) if (tls_symbolic_operand (op, Pmode))
return false; return false;
return (ix86_cmodel == CM_SMALL || ix86_cmodel == CM_KERNEL); return (ix86_cmodel == CM_SMALL || ix86_cmodel == CM_KERNEL
|| (ix86_cmodel == CM_MEDIUM && !SYMBOL_REF_FAR_ADDR_P (op)));
case LABEL_REF: case LABEL_REF:
/* For certain code models, the code is near as well. */ /* For certain code models, the code is near as well. */
...@@ -150,7 +151,9 @@ ...@@ -150,7 +151,9 @@
end of 31bits boundary. We may also accept pretty end of 31bits boundary. We may also accept pretty
large negative constants knowing that all objects are large negative constants knowing that all objects are
in the positive half of address space. */ in the positive half of address space. */
if (ix86_cmodel == CM_SMALL if ((ix86_cmodel == CM_SMALL
|| (ix86_cmodel == CM_MEDIUM
&& !SYMBOL_REF_FAR_ADDR_P (op1)))
&& offset < 16*1024*1024 && offset < 16*1024*1024
&& trunc_int_for_mode (offset, SImode) == offset) && trunc_int_for_mode (offset, SImode) == offset)
return 1; return 1;
...@@ -224,7 +227,9 @@ ...@@ -224,7 +227,9 @@
/* TLS symbols are not constant. */ /* TLS symbols are not constant. */
if (tls_symbolic_operand (op, Pmode)) if (tls_symbolic_operand (op, Pmode))
return false; return false;
return ix86_cmodel == CM_SMALL; return (ix86_cmodel == CM_SMALL
|| (ix86_cmodel == CM_MEDIUM
&& !SYMBOL_REF_FAR_ADDR_P (op)));
case LABEL_REF: case LABEL_REF:
/* For certain code models, the code is near as well. */ /* For certain code models, the code is near as well. */
...@@ -247,7 +252,9 @@ ...@@ -247,7 +252,9 @@
offsets, since one bit is available for free. Negative offsets, since one bit is available for free. Negative
offsets are limited by the size of NULL pointer area offsets are limited by the size of NULL pointer area
specified by the ABI. */ specified by the ABI. */
if (ix86_cmodel == CM_SMALL if ((ix86_cmodel == CM_SMALL
|| (ix86_cmodel == CM_MEDIUM
&& !SYMBOL_REF_FAR_ADDR_P (op1)))
&& GET_CODE (op2) == CONST_INT && GET_CODE (op2) == CONST_INT
&& trunc_int_for_mode (INTVAL (op2), DImode) > -0x10000 && trunc_int_for_mode (INTVAL (op2), DImode) > -0x10000
&& trunc_int_for_mode (INTVAL (op2), SImode) == INTVAL (op2)) && trunc_int_for_mode (INTVAL (op2), SImode) == INTVAL (op2))
......
...@@ -52,7 +52,11 @@ Boston, MA 02110-1301, USA. */ ...@@ -52,7 +52,11 @@ Boston, MA 02110-1301, USA. */
%{Wa,*:%*} %{m32:--32} %{m64:--64}" %{Wa,*:%*} %{m32:--32} %{m64:--64}"
#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN) x86_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
#undef ASM_OUTPUT_ALIGNED_COMMON
#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
x86_elf_aligned_common (FILE, NAME, SIZE, ALIGN);
/* This is used to align code labels according to Intel recommendations. */ /* This is used to align code labels according to Intel recommendations. */
...@@ -75,3 +79,9 @@ Boston, MA 02110-1301, USA. */ ...@@ -75,3 +79,9 @@ Boston, MA 02110-1301, USA. */
#undef PREFERRED_DEBUGGING_TYPE #undef PREFERRED_DEBUGGING_TYPE
#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
#undef TARGET_ASM_SELECT_SECTION
#define TARGET_ASM_SELECT_SECTION x86_64_elf_select_section
#undef TARGET_ASM_UNIQUE_SECTION
#define TARGET_ASM_UNIQUE_SECTION x86_64_elf_unique_section
...@@ -521,7 +521,7 @@ Objective-C and Objective-C++ Dialects}. ...@@ -521,7 +521,7 @@ Objective-C and Objective-C++ Dialects}.
-m96bit-long-double -mregparm=@var{num} -msseregparm @gol -m96bit-long-double -mregparm=@var{num} -msseregparm @gol
-momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
-mcmodel=@var{code-model} @gol -mcmodel=@var{code-model} @gol
-m32 -m64} -m32 -m64 -mlarge-data-threshold=@var{num}}
@emph{IA-64 Options} @emph{IA-64 Options}
@gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
...@@ -9046,6 +9046,11 @@ their size as well as function calling convention for function taking ...@@ -9046,6 +9046,11 @@ their size as well as function calling convention for function taking
@code{long double} will be modified. Hence they will not be binary @code{long double} will be modified. Hence they will not be binary
compatible with arrays or structures in code compiled without that switch. compatible with arrays or structures in code compiled without that switch.
@item -mmlarge-data-threshold=@var{number}
@opindex mlarge-data-threshold=@var{number}
When @option{-mcmodel=medium} is specified, the data greater than
@var{threshold} are placed in large data section. This value must be the
same across all object linked into the binarry and defaults to 65535.
@item -msvr3-shlib @item -msvr3-shlib
@itemx -mno-svr3-shlib @itemx -mno-svr3-shlib
......
...@@ -500,6 +500,44 @@ extern void no_asm_to_stream (FILE *); ...@@ -500,6 +500,44 @@ extern void no_asm_to_stream (FILE *);
#define SECTION_NOTYPE 0x80000 /* don't output @progbits */ #define SECTION_NOTYPE 0x80000 /* don't output @progbits */
#define SECTION_MACH_DEP 0x100000 /* subsequent bits reserved for target */ #define SECTION_MACH_DEP 0x100000 /* subsequent bits reserved for target */
/* A helper function for default_elf_select_section and
default_elf_unique_section. Categorizes the DECL. */
enum section_category
{
SECCAT_TEXT,
SECCAT_RODATA,
SECCAT_RODATA_MERGE_STR,
SECCAT_RODATA_MERGE_STR_INIT,
SECCAT_RODATA_MERGE_CONST,
SECCAT_SRODATA,
SECCAT_DATA,
/* To optimize loading of shared programs, define following subsections
of data section:
_REL Contains data that has relocations, so they get grouped
together and dynamic linker will visit fewer pages in memory.
_RO Contains data that is otherwise read-only. This is useful
with prelinking as most relocations won't be dynamically
linked and thus stay read only.
_LOCAL Marks data containing relocations only to local objects.
These relocations will get fully resolved by prelinking. */
SECCAT_DATA_REL,
SECCAT_DATA_REL_LOCAL,
SECCAT_DATA_REL_RO,
SECCAT_DATA_REL_RO_LOCAL,
SECCAT_SDATA,
SECCAT_TDATA,
SECCAT_BSS,
SECCAT_SBSS,
SECCAT_TBSS
};
extern bool set_named_section_flags (const char *, unsigned int); extern bool set_named_section_flags (const char *, unsigned int);
#define named_section_flags(NAME, FLAGS) \ #define named_section_flags(NAME, FLAGS) \
named_section_real((NAME), (FLAGS), /*decl=*/NULL_TREE) named_section_real((NAME), (FLAGS), /*decl=*/NULL_TREE)
...@@ -510,6 +548,7 @@ extern unsigned int default_section_type_flags_1 (tree, const char *, int, int); ...@@ -510,6 +548,7 @@ extern unsigned int default_section_type_flags_1 (tree, const char *, int, int);
extern void default_no_named_section (const char *, unsigned int, tree); extern void default_no_named_section (const char *, unsigned int, tree);
extern void default_elf_asm_named_section (const char *, unsigned int, tree); extern void default_elf_asm_named_section (const char *, unsigned int, tree);
extern enum section_category categorize_decl_for_section (tree, int, int);
extern void default_coff_asm_named_section (const char *, unsigned int, tree); extern void default_coff_asm_named_section (const char *, unsigned int, tree);
extern void default_pe_asm_named_section (const char *, unsigned int, tree); extern void default_pe_asm_named_section (const char *, unsigned int, tree);
......
...@@ -5017,47 +5017,7 @@ default_select_section (tree decl, int reloc, ...@@ -5017,47 +5017,7 @@ default_select_section (tree decl, int reloc,
data_section (); data_section ();
} }
/* A helper function for default_elf_select_section and
default_elf_unique_section. Categorizes the DECL. */
enum section_category enum section_category
{
SECCAT_TEXT,
SECCAT_RODATA,
SECCAT_RODATA_MERGE_STR,
SECCAT_RODATA_MERGE_STR_INIT,
SECCAT_RODATA_MERGE_CONST,
SECCAT_SRODATA,
SECCAT_DATA,
/* To optimize loading of shared programs, define following subsections
of data section:
_REL Contains data that has relocations, so they get grouped
together and dynamic linker will visit fewer pages in memory.
_RO Contains data that is otherwise read-only. This is useful
with prelinking as most relocations won't be dynamically
linked and thus stay read only.
_LOCAL Marks data containing relocations only to local objects.
These relocations will get fully resolved by prelinking. */
SECCAT_DATA_REL,
SECCAT_DATA_REL_LOCAL,
SECCAT_DATA_REL_RO,
SECCAT_DATA_REL_RO_LOCAL,
SECCAT_SDATA,
SECCAT_TDATA,
SECCAT_BSS,
SECCAT_SBSS,
SECCAT_TBSS
};
static enum section_category
categorize_decl_for_section (tree, int, int);
static enum section_category
categorize_decl_for_section (tree decl, int reloc, int shlib) categorize_decl_for_section (tree decl, int reloc, int shlib)
{ {
enum section_category ret; enum section_category ret;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment