This is the mail archive of the gcc-patches@gcc.gnu.org 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]

PR 11350


Hi,
the problem is that the destination of tablejump gets spilled onto stack and
the tablejump gets elliminated after reload so the load stays in the code.
Bootstrappping/regtesting i686-pc-gnu-linux in progress, OK?

Honza

typedef __builtin_va_list __gnuc_va_list;
typedef __gnuc_va_list __not_va_list__;


typedef unsigned long XID;

typedef unsigned long Time;		//keep
typedef XID Window;			//keep
typedef int Cardinal;
typedef struct {
    short x, y;
} XPoint;		//keep

typedef struct _XDisplay Display;	//keep

typedef struct {
        int type;
        unsigned long serial;
        int send_event;
        Display *display;
        Window window;
        Window root;
        Window subwindow;
        Time time;
        int x, y;
        int x_root, y_root;
        unsigned int state;
        unsigned int button;
        int same_screen;
} XButtonEvent;

typedef struct {
        int type;
        unsigned long serial;
        int send_event;
        Display *display;
        Window window;
        Window root;
        Window subwindow;
        Time time;
        int x, y;
        int x_root, y_root;
        unsigned int state;
        char is_hint;
        int same_screen;
} XMotionEvent;

typedef struct {
        int type;
        unsigned long serial;
        int send_event;
        Display *display;
        Window window;
        Window root;
        Window subwindow;
        Time time;
        int x, y;
        int x_root, y_root;
        int mode;
        int detail;
        int same_screen;
        int focus;
        unsigned int state;
} XCrossingEvent;


typedef union _XEvent {
        int type;
        XButtonEvent xbutton;
        XMotionEvent xmotion;
        XCrossingEvent xcrossing;
        long pad[24];
} XEvent;

typedef char *String;			//keep
typedef struct _WidgetRec *Widget;	//keep


typedef struct _XtAppStruct *XtAppContext;	//keep


extern XtAppContext XtWidgetToApplicationContext( Widget); //keep

extern void XtAppWarning(XtAppContext, const char*);  //keep


// keep any thing below here
int XmuSnprintf(char *str,  int size,  const char *fmt,     ... );



Widget FindMenu(Widget, String);
void PositionMenu(Widget, XPoint*);
void Highlight(Widget, XEvent*, String*, Cardinal*);
void PositionMenuAction(Widget, XEvent*, String*, Cardinal*);

void
PositionMenuAction(Widget w, XEvent *event,
                   String *params, Cardinal *num_params)
{
    Widget menu;
    XPoint loc;

    if (*num_params != 1) {
        XtAppWarning(XtWidgetToApplicationContext(w),
                     "SimpleMenuWidget: position menu action expects "
                     "only one parameter which is the name of the menu.");
        return;
    }

    if ((menu = FindMenu(w, params[0])) == ((void *)0)) {
        char error_buf[8192];

        (void)XmuSnprintf(error_buf, sizeof(error_buf),
                          "SimpleMenuWidget: could not find menu named %s.",
                          params[0]);
        XtAppWarning(XtWidgetToApplicationContext(w), error_buf);
        return;
    }

    switch (event->type) {
        case 4:
        case 5:
            loc.x = event->xbutton.x_root;
            loc.y = event->xbutton.y_root;
            PositionMenu(menu, &loc);
            break;
        case 7:
        case 8:
            loc.x = event->xcrossing.x_root;
            loc.y = event->xcrossing.y_root;
            PositionMenu(menu, &loc);
            break;
        case 6:
            loc.x = event->xmotion.x_root;
            loc.y = event->xmotion.y_root;
            PositionMenu(menu, &loc);
            break;
        default:
            PositionMenu(menu, ((void *)0));
            break;
    }
}
2004-01-10  Jan Hubicka  <jh@suse.cz>
	PR opt/11350
	* cfgcleanup.c (try_optimize_cfg): Supress tablejump removal after reload.
	* cfgrtl.c (rtl_can_merge_blocks, cfglayout_can_merge_blocks,
	rtl_try_redirect_by_replacing_branch): Likewise.
Index: gcc/cfgcleanup.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgcleanup.c,v
retrieving revision 1.97
diff -c -3 -p -r1.97 cfgcleanup.c
*** gcc/cfgcleanup.c	13 Dec 2003 04:11:19 -0000	1.97
--- gcc/cfgcleanup.c	10 Jan 2004 21:42:23 -0000
*************** try_optimize_cfg (int mode)
*** 1794,1800 ****
  			   /* If the jump insn has side effects,
  			      we can't kill the edge.  */
  			   && (GET_CODE (BB_END (b)) != JUMP_INSN
! 			       || (flow2_completed
  				   ? simplejump_p (BB_END (b))
  				   : onlyjump_p (BB_END (b))))
  			   && (next = merge_blocks_move (s, b, c, mode)))
--- 1766,1772 ----
  			   /* If the jump insn has side effects,
  			      we can't kill the edge.  */
  			   && (GET_CODE (BB_END (b)) != JUMP_INSN
! 			       || (reload_completed
  				   ? simplejump_p (BB_END (b))
  				   : onlyjump_p (BB_END (b))))
  			   && (next = merge_blocks_move (s, b, c, mode)))
Index: gcc/cfgrtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgrtl.c,v
retrieving revision 1.101
diff -c -3 -p -r1.101 cfgrtl.c
*** gcc/cfgrtl.c	11 Dec 2003 00:20:36 -0000	1.101
--- gcc/cfgrtl.c	10 Jan 2004 21:42:23 -0000
*************** rtl_can_merge_blocks (basic_block a,basi
*** 661,667 ****
  	  /* If the jump insn has side effects,
  	     we can't kill the edge.  */
  	  && (GET_CODE (BB_END (a)) != JUMP_INSN
! 	      || (flow2_completed
  		  ? simplejump_p (BB_END (a)) : onlyjump_p (BB_END (a)))));
  }
  
--- 661,667 ----
  	  /* If the jump insn has side effects,
  	     we can't kill the edge.  */
  	  && (GET_CODE (BB_END (a)) != JUMP_INSN
! 	      || (reload_completed
  		  ? simplejump_p (BB_END (a)) : onlyjump_p (BB_END (a)))));
  }
  
*************** try_redirect_by_replacing_jump (edge e, 
*** 703,709 ****
  
    if (tmp || !onlyjump_p (insn))
      return false;
!   if ((!optimize || flow2_completed) && tablejump_p (insn, NULL, NULL))
      return false;
  
    /* Avoid removing branch with side effects.  */
--- 703,709 ----
  
    if (tmp || !onlyjump_p (insn))
      return false;
!   if ((!optimize || reload_completed) && tablejump_p (insn, NULL, NULL))
      return false;
  
    /* Avoid removing branch with side effects.  */
*************** cfg_layout_can_merge_blocks_p (basic_blo
*** 2599,2605 ****
  	  /* If the jump insn has side effects,
  	     we can't kill the edge.  */
  	  && (GET_CODE (BB_END (a)) != JUMP_INSN
! 	      || (flow2_completed
  		  ? simplejump_p (BB_END (a)) : onlyjump_p (BB_END (a)))));
  }
  
--- 2606,2612 ----
  	  /* If the jump insn has side effects,
  	     we can't kill the edge.  */
  	  && (GET_CODE (BB_END (a)) != JUMP_INSN
! 	      || (reload_completed
  		  ? simplejump_p (BB_END (a)) : onlyjump_p (BB_END (a)))));
  }
  


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