This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Can shrink-wrapping ever move prologue past an ASM statement?


I've been asked to look into the item one of and found out
that at least shrink-wrapping happily moves prologue past an asm
statement which can be bad if the asm statement contains a call

Am I right concluding that this is a bug?  Looking into the manual and
at requires_stack_frame_p() in shrink-wrap.c, I do not see any obvious
way of marking the asm statement as requiring the stack frame (but I
will not mind being proven wrong).  Do we want to create one, such as
only disallowing moving prologue past volatile asm statements?  Any
other ideas?



This is an x86_64 testcase, compare output of gcc -O2 -S and
gcc -S -O2 -fno-shrink-wrap

enum machine_mode

typedef int *rtx;
typedef long unsigned int size_t;
extern unsigned char mode_size[NUM_MACHINE_MODES];

extern rtx c_readstr (const char *, enum machine_mode);
extern rtx convert_to_mode (enum machine_mode, rtx, int);
extern rtx expand_mult (enum machine_mode, rtx, rtx, rtx, int);
extern rtx force_reg (enum machine_mode, rtx);
extern unsigned char mode_size_inline (enum machine_mode);
extern void *memset (void *__s, int __c, size_t __n);

builtin_memset_gen_str (void *data, long offset __attribute__ ((__unused__)),
			enum machine_mode mode)
  rtx target, coeff;
  size_t size;
  char *p;
  asm volatile ("#zzzzzzzzzzzzzzzzzzzzzzzzzzzz" : : :);

  size = ((unsigned short) (__builtin_constant_p (mode)
			    ? mode_size_inline (mode) : mode_size[mode]));
  if (size == 1)
    return (rtx) data;

  p = ((char *) __builtin_alloca(sizeof (char) * (size)));
  memset (p, 1, size);
  coeff = c_readstr (p, mode);

  target = convert_to_mode (mode, (rtx) data, 1);
  target = expand_mult (mode, target, coeff, (rtx) 0, 1);
  return force_reg (mode, target);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]