verify_flow_info improvements.

Jeffrey A Law law@cygnus.com
Tue Dec 14 01:19:00 GMT 1999


  In message <19991020181342.00811@atrey.karlin.mff.cuni.cz>you write:
  > The notes are easy to damage with no obvious problems with the resulting
  > code, so it is good to check them.
  > This code adds some of the checking stuff to verify_flow_info.
  > 
  > Wed Oct 20 18:11:23 MET DST 1999  Jan Hubicka  <hubicka@freesoft.cz>Q
  > 
  > 	* flow.c (note_inside_basic_block): New function
  > 	(verify_flow_info): Do more checking for notes.
  > 
  > *** flow.c.old	Wed Oct 20 16:11:17 1999
  > --- flow.c	Wed Oct 20 18:09:44 1999
  > *************** set_block_num (insn, bb)
  > *** 5803,5808 ****
  > --- 5801,5843 ----
  >     set_block_for_insn (insn, BASIC_BLOCK (bb));
  >   }
  >   
  > + /* Return 2 if note must be inside basic block,
  > +    1 if it can be and 0 if it can't be.  */
Instead of using 3 magic values, I would suggest returning an enum like
NOTE_INSIDE, NOTE_OUTSIDE, NOTE_INSIDE_OR_OUTSIDE or something of that
nature.  That way someone reading verify_flow_info can understand what
is happening without knowing what the values 0, 1 & 2 mean.


Also, don't forget proper indention of arguments.  5 spaces.  No more, no
less.  You're indention of "rtx x" in note_inside_basic_block is wrong.

In switch statements the '{' and each 'case' should be at the same indention
level (no, it doesn't make sense to me either, but those are the rules).

Also remember, always use tabs, not a series of 8 spaces.

  > + 	error ("Unknown note number: %i.",NOTE_LINE_NUMBER (x));
  > + 	abort();
Both these lines are missing whitespace.  Space between the comma and the
NOTE_LINE_NUMBER and between abort and the open paren.


I'd like to see this patch updated and resubmitted.  

jeff



More information about the Gcc-patches mailing list