Commit c7453384 by Eric Christopher Committed by Eric Christopher

s390.c (s390_valid_pointer_mode): New.

2003-07-22  Eric Christopher <echristo@redhat.com>

	* config/s390.c (s390_valid_pointer_mode): New.
	(TARGET_VALID_POINTER_MODE): Use.
	(s390_emit_prologue): Add tpf profiling hooks.
	(s390_emit_epilogue): Ditto.
	* config/s390.h (MASK_TPF): New.
	(TARGET_TPF): Use.
	(POINTERS_EXTEND_UNSIGNED): Define.
	* config/s390.md (ptr_extend): New pattern.

From-SVN: r69674
parent 817aed6f
2003-07-22 Eric Christopher <echristo@redhat.com>
* config/s390.c (s390_valid_pointer_mode): New.
(TARGET_VALID_POINTER_MODE): Use.
(s390_emit_prologue): Add tpf profiling hooks.
(s390_emit_epilogue): Ditto.
* config/s390.h (MASK_TPF): New.
(TARGET_TPF): Use.
(POINTERS_EXTEND_UNSIGNED): Define.
* config/s390.md (ptr_extend): New pattern.
2003-07-22 Zack Weinberg <zack@codesourcery.com>
* hashtable.c (approx_sqrt): Make static.
......
......@@ -76,7 +76,7 @@ static int s390_sched_reorder2 PARAMS ((FILE *, int, rtx *, int *, int));
static bool s390_rtx_costs PARAMS ((rtx, int, int, int *));
static int s390_address_cost PARAMS ((rtx));
static void s390_reorg PARAMS ((void));
static bool s390_valid_pointer_mode PARAMS ((enum machine_mode));
#undef TARGET_ASM_ALIGNED_HI_OP
#define TARGET_ASM_ALIGNED_HI_OP "\t.word\t"
......@@ -138,6 +138,9 @@ static void s390_reorg PARAMS ((void));
#undef TARGET_MACHINE_DEPENDENT_REORG
#define TARGET_MACHINE_DEPENDENT_REORG s390_reorg
#undef TARGET_VALID_POINTER_MODE
#define TARGET_VALID_POINTER_MODE s390_valid_pointer_mode
struct gcc_target targetm = TARGET_INITIALIZER;
extern int reload_completed;
......@@ -5515,11 +5518,13 @@ s390_emit_prologue ()
s390_frame_info ();
/* Choose best register to use for temp use within prologue. */
/* Choose best register to use for temp use within prologue.
See below for why TPF must use the register 1. */
if (!current_function_is_leaf
&& !has_hard_reg_initial_val (Pmode, RETURN_REGNUM)
&& get_pool_size () < S390_POOL_CHUNK_MAX / 2)
&& get_pool_size () < S390_POOL_CHUNK_MAX / 2
&& !TARGET_TPF)
temp_reg = gen_rtx_REG (Pmode, RETURN_REGNUM);
else
temp_reg = gen_rtx_REG (Pmode, 1);
......@@ -5670,7 +5675,29 @@ s390_emit_prologue ()
/* Set up got pointer, if needed. */
if (flag_pic && regs_ever_live[PIC_OFFSET_TABLE_REGNUM])
s390_load_got (true);
s390_load_got(true);
if (TARGET_TPF)
{
/* Generate a BAS instruction to serve as a function
entry intercept to facilitate the use of tracing
algorithms located at the branch target.
This must use register 1. */
rtx addr;
rtx unkn;
rtx link;
addr = GEN_INT (0xfe0);
unkn = CONST0_RTX (SImode);
link = gen_rtx_REG (Pmode, 1);
emit_call_insn (gen_call_exp (gen_rtx_MEM (QImode, addr), unkn, link));
/* Emit a blockage here so that all code
lies between the profiling mechanisms. */
emit_insn (gen_blockage ());
}
}
/* Expand the epilogue into a bunch of separate insns. */
......@@ -5682,6 +5709,30 @@ s390_emit_epilogue ()
int area_bottom, area_top, offset = 0;
rtvec p;
if (TARGET_TPF)
{
/* Generate a BAS instruction to serve as a function
entry intercept to facilitate the use of tracing
algorithms located at the branch target.
This must use register 1. */
rtx addr;
rtx unkn;
rtx link;
addr = GEN_INT (0xfe6);
unkn = CONST0_RTX (SImode);
link = gen_rtx_REG (Pmode, 1);
/* Emit a blockage here so that all code
lies between the profiling mechanisms. */
emit_insn (gen_blockage ());
emit_call_insn (gen_call_exp (gen_rtx_MEM (QImode, addr), unkn, link));
}
/* Check whether to use frame or stack pointer for restore. */
frame_pointer = frame_pointer_needed ?
......@@ -6248,6 +6299,7 @@ s390_va_arg (valist, type)
reg = gpr;
n_reg = (size + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
sav_ofs = 2 * UNITS_PER_WORD;
if (size < UNITS_PER_WORD)
sav_ofs += UNITS_PER_WORD - size;
......@@ -6889,6 +6941,13 @@ s390_output_mi_thunk (file, thunk, delta, vcall_offset, function)
}
}
bool
s390_valid_pointer_mode (mode)
enum machine_mode mode;
{
return (mode == SImode || (TARGET_64BIT && mode == DImode));
}
/* How to allocate a 'struct machine_function'. */
static struct machine_function *
......
......@@ -94,6 +94,7 @@ extern int target_flags;
#define MASK_64BIT 0x10
#define MASK_ZARCH 0x20
#define MASK_MVCLE 0x40
#define MASK_TPF 0x80
#define TARGET_HARD_FLOAT (target_flags & MASK_HARD_FLOAT)
#define TARGET_SOFT_FLOAT (!(target_flags & MASK_HARD_FLOAT))
......@@ -103,6 +104,7 @@ extern int target_flags;
#define TARGET_64BIT (target_flags & MASK_64BIT)
#define TARGET_ZARCH (target_flags & MASK_ZARCH)
#define TARGET_MVCLE (target_flags & MASK_MVCLE)
#define TARGET_TPF (target_flags & MASK_TPF)
/* ??? Once this actually works, it could be made a runtime option. */
#define TARGET_IBM_FLOAT 0
......@@ -129,6 +131,8 @@ extern int target_flags;
{ "esa", -32, N_("ESA/390 architecture")}, \
{ "mvcle", 64, N_("mvcle use")}, \
{ "no-mvcle", -64, N_("mvc&ex")}, \
{ "tpf", 128, N_("enable tpf OS code")}, \
{ "no-tpf", -128, N_("disable tpf OS code")}, \
{ "", TARGET_DEFAULT, 0 } }
#define TARGET_OPTIONS \
......@@ -1103,6 +1107,9 @@ extern int s390_nr_constants;
between pointers and any other objects of this machine mode. */
#define Pmode ((enum machine_mode) (TARGET_64BIT ? DImode : SImode))
/* This is -1 for "pointer mode" extend. See ptr_extend in s390.md. */
#define POINTERS_EXTEND_UNSIGNED -1
/* A function address in a call instruction is a byte address (for
indexing purposes) so give the MEM rtx a byte's mode. */
#define FUNCTION_MODE QImode
......
......@@ -7197,3 +7197,24 @@
}
[(set_attr "op_type" "NN")
(set_attr "type" "larl")])
;; Instruction definition to extend a 31-bit pointer into a 64-bit
;; pointer. This is used for compatability.
(define_expand "ptr_extend"
[(set (match_operand:DI 0 "register_operand" "=r")
(match_operand:SI 1 "register_operand" "r"))]
""
"
{
/*
emit_insn (gen_zero_extendsidi2 (operands[0], operands[1]));
emit_insn (gen_anddi3 (operands[0], operands[0], GEN_INT (0x7fffffff)));
*/
emit_insn (gen_anddi3 (operands[0],
gen_lowpart (DImode, operands[1]),
GEN_INT (0x7fffffff)));
DONE;
}")
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