{
rtx mem, reg_ssp;
- mem = gen_rtx_MEM (Pmode, plus_constant (Pmode, operands[0],
- 3 * GET_MODE_SIZE (Pmode)));
- reg_ssp = gen_reg_rtx (Pmode);
+ mem = gen_rtx_MEM (word_mode,
+ plus_constant (Pmode, operands[0],
+ 3 * GET_MODE_SIZE (ptr_mode)));
+ reg_ssp = gen_reg_rtx (word_mode);
emit_insn (gen_rtx_SET (reg_ssp, const0_rtx));
- emit_insn ((Pmode == SImode)
- ? gen_rdsspsi (reg_ssp, reg_ssp)
- : gen_rdsspdi (reg_ssp, reg_ssp));
+ emit_insn ((word_mode == SImode)
+ ? gen_rdsspsi (reg_ssp, reg_ssp)
+ : gen_rdsspdi (reg_ssp, reg_ssp));
emit_move_insn (mem, reg_ssp);
}
DONE;
/* Get the current shadow stack pointer. The code below will check if
SHSTK feature is enabled. If it is not enabled the RDSSP instruction
is a NOP. */
- reg_ssp = gen_reg_rtx (Pmode);
+ reg_ssp = gen_reg_rtx (word_mode);
emit_insn (gen_rtx_SET (reg_ssp, const0_rtx));
- emit_insn ((Pmode == SImode)
+ emit_insn ((word_mode == SImode)
? gen_rdsspsi (reg_ssp, reg_ssp)
: gen_rdsspdi (reg_ssp, reg_ssp));
- mem_buf = gen_rtx_MEM (Pmode, plus_constant (Pmode, operands[0],
- 3 * GET_MODE_SIZE (Pmode)));
+ mem_buf = gen_rtx_MEM (word_mode,
+ plus_constant (Pmode, operands[0],
+ 3 * GET_MODE_SIZE (ptr_mode)));
/* Compare through substraction the saved and the current ssp to decide
if ssp has to be adjusted. */
- reg_adj = gen_reg_rtx (Pmode);
- tmp = gen_rtx_SET (reg_adj, gen_rtx_MINUS (Pmode, reg_ssp, mem_buf));
+ tmp = gen_rtx_SET (reg_ssp, gen_rtx_MINUS (word_mode, reg_ssp, mem_buf));
clob = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (CCmode, FLAGS_REG));
tmp = gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, tmp, clob));
emit_insn (tmp);
JUMP_LABEL (jump) = noadj_label;
/* Compute the numebr of frames to adjust. */
+ reg_adj = gen_lowpart (ptr_mode, reg_ssp);
tmp = gen_rtx_SET (reg_adj,
- gen_rtx_LSHIFTRT (Pmode, negate_rtx (Pmode, reg_adj),
- GEN_INT ((Pmode == SImode)
+ gen_rtx_LSHIFTRT (ptr_mode,
+ negate_rtx (ptr_mode, reg_adj),
+ GEN_INT ((word_mode == SImode)
? 2
: 3)));
clob = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (CCmode, FLAGS_REG));
emit_label (loop_label);
LABEL_NUSES (loop_label) = 1;
- emit_insn ((Pmode == SImode)
- ? gen_incsspsi (reg_adj)
- : gen_incsspdi (reg_adj));
- tmp = gen_rtx_SET (reg_adj, gen_rtx_MINUS (Pmode,
+ emit_insn ((word_mode == SImode)
+ ? gen_incsspsi (reg_ssp)
+ : gen_incsspdi (reg_ssp));
+ tmp = gen_rtx_SET (reg_adj, gen_rtx_MINUS (ptr_mode,
reg_adj,
GEN_INT (255)));
clob = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (CCmode, FLAGS_REG));
emit_label (inc_label);
LABEL_NUSES (inc_label) = 1;
- emit_insn ((Pmode == SImode)
- ? gen_incsspsi (reg_adj)
- : gen_incsspdi (reg_adj));
+ emit_insn ((word_mode == SImode)
+ ? gen_incsspsi (reg_ssp)
+ : gen_incsspdi (reg_ssp));
emit_label (noadj_label);
LABEL_NUSES (noadj_label) = 1;
}
/* This code is the same as in expand_buildin_longjmp. */
- fp = gen_rtx_MEM (Pmode, operands[0]);
- lab = gen_rtx_MEM (Pmode, plus_constant (Pmode, operands[0],
- GET_MODE_SIZE (Pmode)));
+ fp = gen_rtx_MEM (ptr_mode, operands[0]);
+ lab = gen_rtx_MEM (ptr_mode, plus_constant (Pmode, operands[0],
+ GET_MODE_SIZE (ptr_mode)));
stack = gen_rtx_MEM (sa_mode, plus_constant (Pmode, operands[0],
- 2 * GET_MODE_SIZE (Pmode)));
+ 2 * GET_MODE_SIZE (ptr_mode)));
lab = copy_to_reg (lab);
emit_clobber (gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (VOIDmode)));
emit_clobber (gen_rtx_MEM (BLKmode, hard_frame_pointer_rtx));
+ if (GET_MODE (fp) != Pmode)
+ fp = convert_to_mode (Pmode, fp, 1);
emit_move_insn (hard_frame_pointer_rtx, fp);
emit_stack_restore (SAVE_NONLOCAL, stack);