;; ??? Currently does not have define_function_unit support for the R8000.
;; Must include new entries for fmadd in addition to existing entries.
+;; UNSPEC values used in mips.md
+;; Number USE
+;; 0 movsi_ul
+;; 1 movsi_us, get_fnaddr
+;; 2 loadgp
+;; 3 eh_set_return
+;; 20 builtin_setjmp_setup
+;;
+;; UNSPEC_VOLATILE values
+;; 0 blockage
+;; 3 builtin_longjmp
+;; 10 consttable_qi
+;; 11 consttable_hi
+;; 12 consttable_si
+;; 13 consttable_di
+;; 14 consttable_sf
+;; 15 consttable_df
+;; 16 align_2
+;; 17 align_4
+;; 18 align_8
\f
;; ....................
(set_attr "mode" "none")
(set_attr "length" "16")])
+;; This is used in compiling the unwind routines.
+(define_expand "eh_return"
+ [(use (match_operand 0 "general_operand" ""))
+ (use (match_operand 1 "general_operand" ""))]
+ ""
+ "
+{
+ enum machine_mode gpr_mode = TARGET_64BIT ? DImode : SImode;
+
+ if (GET_MODE (operands[1]) != gpr_mode)
+ operands[1] = convert_to_mode (gpr_mode, operands[1], 0);
+ if (TARGET_64BIT)
+ emit_insn (gen_eh_set_lr_di (operands[1]));
+ else
+ emit_insn (gen_eh_set_lr_si (operands[1]));
+
+ emit_move_insn (EH_RETURN_STACKADJ_RTX, operands[0]);
+ DONE;
+}")
+
+;; Clobber the return address on the stack. We can't expand this
+;; until we know where it will be put in the stack frame.
+
+(define_insn "eh_set_lr_si"
+ [(unspec [(match_operand:SI 0 "register_operand" "r")] 3)
+ (clobber (match_scratch:SI 1 "=&r"))]
+ "! TARGET_64BIT"
+ "#")
+
+(define_insn "eh_set_lr_di"
+ [(unspec [(match_operand:DI 0 "register_operand" "r")] 3)
+ (clobber (match_scratch:DI 1 "=&r"))]
+ "TARGET_64BIT"
+ "#")
+
+(define_split
+ [(unspec [(match_operand 0 "register_operand" "r")] 3)
+ (clobber (match_scratch 1 "=&r"))]
+ "reload_completed"
+ [(const_int 0)]
+ "
+{
+ HOST_WIDE_INT gp_offset;
+ rtx base;
+
+ compute_frame_size (get_frame_size ());
+ if (((current_frame_info.mask >> 31) & 1) == 0)
+ abort ();
+ gp_offset = current_frame_info.gp_sp_offset;
+
+ if (gp_offset < 32768)
+ base = stack_pointer_rtx;
+ else
+ {
+ base = operands[1];
+ emit_move_insn (base, GEN_INT (gp_offset));
+ if (Pmode == DImode)
+ emit_insn (gen_adddi3 (base, base, stack_pointer_rtx));
+ else
+ emit_insn (gen_addsi3 (base, base, stack_pointer_rtx));
+ gp_offset = 0;
+ }
+ emit_move_insn (gen_rtx_MEM (GET_MODE (operands[0]),
+ plus_constant (base, gp_offset)),
+ operands[0]);
+ DONE;
+}")
\f
;;
;; ....................
const unsigned char *aug = cie->augmentation;
const unsigned char *p = aug + strlen (aug) + 1;
const unsigned char *ret = NULL;
- _Unwind_Word code_align;
- _Unwind_Sword data_align;
+ _Unwind_Ptr tmp;
/* Immediately following the augmentation are the code and
data alignment and return address column. */
- p = read_uleb128 (p, &code_align);
- p = read_sleb128 (p, &data_align);
- fs->code_align = code_align;
- fs->data_align = data_align;
+ p = read_uleb128 (p, &tmp); fs->code_align = tmp;
+ p = read_sleb128 (p, &tmp); fs->data_align = (saddr) tmp;
fs->retaddr_column = *p++;
fs->lsda_encoding = DW_EH_PE_omit;
the size. */
if (*aug == 'z')
{
- _Unwind_Word i;
- p = read_uleb128 (p, &i);
- ret = p + i;
+ p = read_uleb128 (p, &tmp);
+ ret = p + tmp;
fs->saw_z = 1;
++aug;
enum dwarf_location_atom op = *op_ptr++;
_Unwind_Word result, reg;
_Unwind_Sword offset;
+ _Unwind_Ptr ptrtmp;
switch (op)
{
op_ptr += 8;
break;
case DW_OP_constu:
- op_ptr = read_uleb128 (op_ptr, &result);
+ op_ptr = read_uleb128 (op_ptr, &ptrtmp);
+ result = ptrtmp;
break;
case DW_OP_consts:
- op_ptr = read_sleb128 (op_ptr, &offset);
- result = offset;
+ op_ptr = read_sleb128 (op_ptr, &ptrtmp);
+ result = (saddr)ptrtmp;
break;
case DW_OP_reg0:
result = _Unwind_GetGR (context, op - DW_OP_reg0);
break;
case DW_OP_regx:
- op_ptr = read_uleb128 (op_ptr, ®);
+ op_ptr = read_uleb128 (op_ptr, &ptrtmp); reg = ptrtmp;
result = _Unwind_GetGR (context, reg);
break;
case DW_OP_breg29:
case DW_OP_breg30:
case DW_OP_breg31:
- op_ptr = read_sleb128 (op_ptr, &offset);
+ op_ptr = read_sleb128 (op_ptr, &ptrtmp); offset = (saddr)ptrtmp;
result = _Unwind_GetGR (context, op - DW_OP_breg0) + offset;
break;
case DW_OP_bregx:
- op_ptr = read_uleb128 (op_ptr, ®);
- op_ptr = read_sleb128 (op_ptr, &offset);
+ op_ptr = read_uleb128 (op_ptr, &ptrtmp); reg = ptrtmp;
+ op_ptr = read_sleb128 (op_ptr, &ptrtmp); offset = (saddr)ptrtmp;
result = _Unwind_GetGR (context, reg) + offset;
break;
result = ~result;
break;
case DW_OP_plus_uconst:
- op_ptr = read_uleb128 (op_ptr, ®);
+ op_ptr = read_uleb128 (op_ptr, &ptrtmp); reg = ptrtmp;
result += reg;
break;
}
while (insn_ptr < insn_end && fs->pc < context->ra)
{
unsigned char insn = *insn_ptr++;
- _Unwind_Word reg, uoffset;
+ _Unwind_Word reg;
_Unwind_Sword offset;
+ _Unwind_Ptr ptrtmp;
if (insn & DW_CFA_advance_loc)
fs->pc += (insn & 0x3f) * fs->code_align;
else if (insn & DW_CFA_offset)
{
reg = insn & 0x3f;
- insn_ptr = read_uleb128 (insn_ptr, &uoffset);
- offset = (_Unwind_Sword)uoffset * fs->data_align;
+ insn_ptr = read_uleb128 (insn_ptr, &ptrtmp);
+ offset = ptrtmp * fs->data_align;
fs->regs.reg[reg].how = REG_SAVED_OFFSET;
fs->regs.reg[reg].loc.offset = offset;
}
break;
case DW_CFA_advance_loc1:
- fs->pc += read_1u (insn_ptr);
+ fs->pc += read_1u (insn_ptr) * fs->code_align;
insn_ptr += 1;
break;
case DW_CFA_advance_loc2:
- fs->pc += read_2u (insn_ptr);
+ fs->pc += read_2u (insn_ptr) * fs->code_align;
insn_ptr += 2;
break;
case DW_CFA_advance_loc4:
- fs->pc += read_4u (insn_ptr);
+ fs->pc += read_4u (insn_ptr) * fs->code_align;
insn_ptr += 4;
break;
case DW_CFA_offset_extended:
- insn_ptr = read_uleb128 (insn_ptr, ®);
- insn_ptr = read_uleb128 (insn_ptr, &uoffset);
- offset = (_Unwind_Sword)uoffset * fs->data_align;
+ insn_ptr = read_uleb128 (insn_ptr, &ptrtmp); reg = ptrtmp;
+ insn_ptr = read_uleb128 (insn_ptr, &ptrtmp);
+ offset = ptrtmp * fs->data_align;
fs->regs.reg[reg].how = REG_SAVED_OFFSET;
fs->regs.reg[reg].loc.offset = offset;
break;
case DW_CFA_restore_extended:
- insn_ptr = read_uleb128 (insn_ptr, ®);
+ insn_ptr = read_uleb128 (insn_ptr, &ptrtmp); reg = ptrtmp;
fs->regs.reg[reg].how = REG_UNSAVED;
break;
case DW_CFA_register:
{
_Unwind_Word reg2;
- insn_ptr = read_uleb128 (insn_ptr, ®);
- insn_ptr = read_uleb128 (insn_ptr, ®2);
+ insn_ptr = read_uleb128 (insn_ptr, &ptrtmp); reg = ptrtmp;
+ insn_ptr = read_uleb128 (insn_ptr, &ptrtmp); reg2 = ptrtmp;
fs->regs.reg[reg].how = REG_SAVED_REG;
fs->regs.reg[reg].loc.reg = reg2;
}
break;
case DW_CFA_def_cfa:
- insn_ptr = read_uleb128 (insn_ptr, &fs->cfa_reg);
- insn_ptr = read_uleb128 (insn_ptr, &uoffset);
- fs->cfa_offset = uoffset;
+ insn_ptr = read_uleb128 (insn_ptr, &ptrtmp);
+ fs->cfa_reg = ptrtmp;
+ insn_ptr = read_uleb128 (insn_ptr, &ptrtmp);
+ fs->cfa_offset = ptrtmp;
fs->cfa_how = CFA_REG_OFFSET;
break;
case DW_CFA_def_cfa_register:
- insn_ptr = read_uleb128 (insn_ptr, &fs->cfa_reg);
+ insn_ptr = read_uleb128 (insn_ptr, &ptrtmp);
+ fs->cfa_reg = ptrtmp;
fs->cfa_how = CFA_REG_OFFSET;
break;
case DW_CFA_def_cfa_offset:
- insn_ptr = read_uleb128 (insn_ptr, &uoffset);
- fs->cfa_offset = uoffset;
+ insn_ptr = read_uleb128 (insn_ptr, &ptrtmp);
+ fs->cfa_offset = ptrtmp;
/* cfa_how deliberately not set. */
break;
case DW_CFA_def_cfa_expression:
- insn_ptr = read_uleb128 (insn_ptr, &uoffset);
+ insn_ptr = read_uleb128 (insn_ptr, &ptrtmp);
fs->cfa_exp = insn_ptr;
fs->cfa_how = CFA_EXP;
- insn_ptr += uoffset;
+ insn_ptr += ptrtmp;
break;
case DW_CFA_expression:
- insn_ptr = read_uleb128 (insn_ptr, ®);
- insn_ptr = read_uleb128 (insn_ptr, &uoffset);
+ insn_ptr = read_uleb128 (insn_ptr, &ptrtmp); reg = ptrtmp;
+ insn_ptr = read_uleb128 (insn_ptr, &ptrtmp);
fs->regs.reg[reg].how = REG_SAVED_EXP;
fs->regs.reg[reg].loc.exp = insn_ptr;
- insn_ptr += uoffset;
+ insn_ptr += ptrtmp;
break;
/* From the 2.1 draft. */
case DW_CFA_offset_extended_sf:
- insn_ptr = read_uleb128 (insn_ptr, ®);
- insn_ptr = read_sleb128 (insn_ptr, &offset);
- offset *= fs->data_align;
+ insn_ptr = read_uleb128 (insn_ptr, &ptrtmp); reg = ptrtmp;
+ insn_ptr = read_sleb128 (insn_ptr, &ptrtmp);
+ offset = (saddr)ptrtmp * fs->data_align;
fs->regs.reg[reg].how = REG_SAVED_OFFSET;
fs->regs.reg[reg].loc.offset = offset;
break;
case DW_CFA_def_cfa_sf:
- insn_ptr = read_uleb128 (insn_ptr, &fs->cfa_reg);
- insn_ptr = read_sleb128 (insn_ptr, &fs->cfa_offset);
+ insn_ptr = read_uleb128 (insn_ptr, &ptrtmp);
+ fs->cfa_reg = ptrtmp;
+ insn_ptr = read_sleb128 (insn_ptr, &ptrtmp);
+ fs->cfa_offset = (saddr)ptrtmp;
fs->cfa_how = CFA_REG_OFFSET;
break;
case DW_CFA_def_cfa_offset_sf:
- insn_ptr = read_uleb128 (insn_ptr, &fs->cfa_offset);
+ insn_ptr = read_uleb128 (insn_ptr, &ptrtmp);
+ fs->cfa_offset = ptrtmp;
/* cfa_how deliberately not set. */
break;
break;
case DW_CFA_GNU_args_size:
- insn_ptr = read_uleb128 (insn_ptr, &context->args_size);
+ insn_ptr = read_uleb128 (insn_ptr, &ptrtmp);
+ context->args_size = ptrtmp;
break;
case DW_CFA_GNU_negative_offset_extended:
/* Obsoleted by DW_CFA_offset_extended_sf, but used by
older PowerPC code. */
- insn_ptr = read_uleb128 (insn_ptr, ®);
- insn_ptr = read_uleb128 (insn_ptr, &uoffset);
- offset = (_Unwind_Sword)uoffset * fs->data_align;
+ insn_ptr = read_uleb128 (insn_ptr, &ptrtmp); reg = ptrtmp;
+ insn_ptr = read_uleb128 (insn_ptr, &ptrtmp);
+ offset = ptrtmp * fs->data_align;
fs->regs.reg[reg].how = REG_SAVED_OFFSET;
fs->regs.reg[reg].loc.offset = -offset;
break;
insn = NULL;
if (fs->saw_z)
{
- _Unwind_Word i;
+ _Unwind_Ptr i;
aug = read_uleb128 (aug, &i);
insn = aug + i;
}
that this will not be a problem. */
{
const unsigned char *exp = fs->cfa_exp;
- _Unwind_Word len;
+ _Unwind_Ptr len;
exp = read_uleb128 (exp, &len);
cfa = (void *) (_Unwind_Ptr)
case REG_SAVED_EXP:
{
const unsigned char *exp = fs->regs.reg[i].loc.exp;
- _Unwind_Word len;
+ _Unwind_Ptr len;
_Unwind_Ptr val;
exp = read_uleb128 (exp, &len);