diff mbox

Cleanup gimple.h accesses to ops array

Message ID alpine.LSU.2.11.1508051506180.19642@zhemvz.fhfr.qr
State New
Headers show

Commit Message

Richard Biener Aug. 5, 2015, 1:12 p.m. UTC
This cleans up the acceses to ops arrays in gimple accessors that already
take a code-specific class as argument.  There is no need to go through
the indirection of gimple_ops () computing the offset of the ops array
at runtime.  For all cases there is also already index checking in place
in the accessor or the class is always allocated with at least the number
of operands that are accessed.

Bootstrap & regtest in progress on x86_64-unknown-linux-gnu.

Richard.

2015-08-05  Richard Biener  <rguenther@suse.de>

	* gimple.h (gimple_call_set_fn): Access op member directly.
	(gimple_call_chain_ptr): Likewise.
	(gimple_call_set_chain): Likewise.
	(gimple_cond_lhs_ptr): Likewise.
	(gimple_cond_set_lhs): Likewise.
	(gimple_cond_rhs_ptr): Likewise.
	(gimple_cond_set_rhs): Likewise.
	(gimple_cond_true_label): Likewise.
	(gimple_cond_set_true_label): Likewise.
	(gimple_cond_set_false_label): Likewise.
	(gimple_cond_false_label): Likewise.
	(gimple_label_label): Likewise.
	(gimple_label_set_label): Likewise.
	(gimple_goto_set_dest): Likewise.
	(gimple_asm_input_op): Likewise.
	(gimple_asm_input_op_ptr): Likewise.
	(gimple_asm_set_input_op): Likewise.
	(gimple_asm_output_op): Likewise.
	(gimple_asm_output_op_ptr): Likewise.
	(gimple_asm_set_output_op): Likewise.
	(gimple_asm_clobber_op): Likewise.
	(gimple_asm_set_clobber_op): Likewise.
	(gimple_asm_label_op): Likewise.
	(gimple_asm_set_label_op): Likewise.
	(gimple_switch_index): Likewise.
	(gimple_switch_index_ptr): Likewise.
	(gimple_return_retval_ptr): Likewise.
	(gimple_return_retval): Likewise.
	(gimple_return_set_retval): Likewise.
	(gimple_switch_set_index): Likewise.  Remove superfluous GIMPLE_CHECK.
	(gimple_switch_label): Likewise.
	(gimple_switch_set_label): Likewise.
diff mbox

Patch

Index: gcc/gimple.h
===================================================================
--- gcc/gimple.h	(revision 226623)
+++ gcc/gimple.h	(working copy)
@@ -2757,7 +2757,7 @@  static inline void
 gimple_call_set_fn (gcall *gs, tree fn)
 {
   gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
-  gimple_set_op (gs, 1, fn);
+  gs->op[1] = fn;
 }
 
 
@@ -2826,7 +2826,7 @@  gimple_call_chain (const_gimple gs)
 static inline tree *
 gimple_call_chain_ptr (const gcall *call_stmt)
 {
-  return gimple_op_ptr (call_stmt, 2);
+  return const_cast<tree *> (&call_stmt->op[2]);
 }
 
 /* Set CHAIN to be the static chain for call statement CALL_STMT.  */
@@ -2834,7 +2834,7 @@  gimple_call_chain_ptr (const gcall *call
 static inline void
 gimple_call_set_chain (gcall *call_stmt, tree chain)
 {
-  gimple_set_op (call_stmt, 2, chain);
+  call_stmt->op[2] = chain;
 }
 
 
@@ -3099,7 +3099,7 @@  gimple_cond_lhs (const_gimple gs)
 static inline tree *
 gimple_cond_lhs_ptr (const gcond *gs)
 {
-  return gimple_op_ptr (gs, 0);
+  return const_cast<tree *> (&gs->op[0]);
 }
 
 /* Set LHS to be the LHS operand of the predicate computed by
@@ -3108,7 +3108,7 @@  gimple_cond_lhs_ptr (const gcond *gs)
 static inline void
 gimple_cond_set_lhs (gcond *gs, tree lhs)
 {
-  gimple_set_op (gs, 0, lhs);
+  gs->op[0] = lhs;
 }
 
 
@@ -3127,7 +3127,7 @@  gimple_cond_rhs (const_gimple gs)
 static inline tree *
 gimple_cond_rhs_ptr (const gcond *gs)
 {
-  return gimple_op_ptr (gs, 1);
+  return const_cast<tree *> (&gs->op[1]);
 }
 
 
@@ -3137,7 +3137,7 @@  gimple_cond_rhs_ptr (const gcond *gs)
 static inline void
 gimple_cond_set_rhs (gcond *gs, tree rhs)
 {
-  gimple_set_op (gs, 1, rhs);
+  gs->op[1] = rhs;
 }
 
 
@@ -3147,7 +3147,7 @@  gimple_cond_set_rhs (gcond *gs, tree rhs
 static inline tree
 gimple_cond_true_label (const gcond *gs)
 {
-  return gimple_op (gs, 2);
+  return gs->op[2];
 }
 
 
@@ -3157,7 +3157,7 @@  gimple_cond_true_label (const gcond *gs)
 static inline void
 gimple_cond_set_true_label (gcond *gs, tree label)
 {
-  gimple_set_op (gs, 2, label);
+  gs->op[2] = label;
 }
 
 
@@ -3167,7 +3167,7 @@  gimple_cond_set_true_label (gcond *gs, t
 static inline void
 gimple_cond_set_false_label (gcond *gs, tree label)
 {
-  gimple_set_op (gs, 3, label);
+  gs->op[3] = label;
 }
 
 
@@ -3177,8 +3177,7 @@  gimple_cond_set_false_label (gcond *gs,
 static inline tree
 gimple_cond_false_label (const gcond *gs)
 {
-
-  return gimple_op (gs, 3);
+  return gs->op[3];
 }
 
 
@@ -3269,7 +3268,7 @@  gimple_cond_set_condition (gcond *stmt,
 static inline tree
 gimple_label_label (const glabel *gs)
 {
-  return gimple_op (gs, 0);
+  return gs->op[0];
 }
 
 
@@ -3279,7 +3278,7 @@  gimple_label_label (const glabel *gs)
 static inline void
 gimple_label_set_label (glabel *gs, tree label)
 {
-  gimple_set_op (gs, 0, label);
+  gs->op[0] = label;
 }
 
 
@@ -3298,7 +3297,7 @@  gimple_goto_dest (const_gimple gs)
 static inline void
 gimple_goto_set_dest (ggoto *gs, tree dest)
 {
-  gimple_set_op (gs, 0, dest);
+  gs->op[0] = dest;
 }
 
 
@@ -3436,7 +3435,7 @@  static inline tree
 gimple_asm_input_op (const gasm *asm_stmt, unsigned index)
 {
   gcc_gimple_checking_assert (index < asm_stmt->ni);
-  return gimple_op (asm_stmt, index + asm_stmt->no);
+  return asm_stmt->op[index + asm_stmt->no];
 }
 
 /* Return a pointer to input operand INDEX of GIMPLE_ASM ASM_STMT.  */
@@ -3445,7 +3444,7 @@  static inline tree *
 gimple_asm_input_op_ptr (const gasm *asm_stmt, unsigned index)
 {
   gcc_gimple_checking_assert (index < asm_stmt->ni);
-  return gimple_op_ptr (asm_stmt, index + asm_stmt->no);
+  return const_cast<tree *> (&asm_stmt->op[index + asm_stmt->no]);
 }
 
 
@@ -3456,7 +3455,7 @@  gimple_asm_set_input_op (gasm *asm_stmt,
 {
   gcc_gimple_checking_assert (index < asm_stmt->ni
 			      && TREE_CODE (in_op) == TREE_LIST);
-  gimple_set_op (asm_stmt, index + asm_stmt->no, in_op);
+  asm_stmt->op[index + asm_stmt->no] = in_op;
 }
 
 
@@ -3466,7 +3465,7 @@  static inline tree
 gimple_asm_output_op (const gasm *asm_stmt, unsigned index)
 {
   gcc_gimple_checking_assert (index < asm_stmt->no);
-  return gimple_op (asm_stmt, index);
+  return asm_stmt->op[index];
 }
 
 /* Return a pointer to output operand INDEX of GIMPLE_ASM ASM_STMT.  */
@@ -3475,7 +3474,7 @@  static inline tree *
 gimple_asm_output_op_ptr (const gasm *asm_stmt, unsigned index)
 {
   gcc_gimple_checking_assert (index < asm_stmt->no);
-  return gimple_op_ptr (asm_stmt, index);
+  return const_cast<tree *> (&asm_stmt->op[index]);
 }
 
 
@@ -3486,7 +3485,7 @@  gimple_asm_set_output_op (gasm *asm_stmt
 {
   gcc_gimple_checking_assert (index < asm_stmt->no
 			      && TREE_CODE (out_op) == TREE_LIST);
-  gimple_set_op (asm_stmt, index, out_op);
+  asm_stmt->op[index] = out_op;
 }
 
 
@@ -3496,7 +3495,7 @@  static inline tree
 gimple_asm_clobber_op (const gasm *asm_stmt, unsigned index)
 {
   gcc_gimple_checking_assert (index < asm_stmt->nc);
-  return gimple_op (asm_stmt, index + asm_stmt->ni + asm_stmt->no);
+  return asm_stmt->op[index + asm_stmt->ni + asm_stmt->no];
 }
 
 
@@ -3507,7 +3506,7 @@  gimple_asm_set_clobber_op (gasm *asm_stm
 {
   gcc_gimple_checking_assert (index < asm_stmt->nc
 			      && TREE_CODE (clobber_op) == TREE_LIST);
-  gimple_set_op (asm_stmt, index + asm_stmt->ni + asm_stmt->no, clobber_op);
+  asm_stmt->op[index + asm_stmt->ni + asm_stmt->no] = clobber_op;
 }
 
 /* Return label operand INDEX of GIMPLE_ASM ASM_STMT.  */
@@ -3516,7 +3515,7 @@  static inline tree
 gimple_asm_label_op (const gasm *asm_stmt, unsigned index)
 {
   gcc_gimple_checking_assert (index < asm_stmt->nl);
-  return gimple_op (asm_stmt, index + asm_stmt->ni + asm_stmt->nc);
+  return asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc];
 }
 
 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT.  */
@@ -3526,7 +3525,7 @@  gimple_asm_set_label_op (gasm *asm_stmt,
 {
   gcc_gimple_checking_assert (index < asm_stmt->nl
 			      && TREE_CODE (label_op) == TREE_LIST);
-  gimple_set_op (asm_stmt, index + asm_stmt->ni + asm_stmt->nc, label_op);
+  asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc] = label_op;
 }
 
 /* Return the string representing the assembly instruction in
@@ -4122,7 +4121,7 @@  gimple_switch_set_num_labels (gswitch *g
 static inline tree
 gimple_switch_index (const gswitch *gs)
 {
-  return gimple_op (gs, 0);
+  return gs->op[0];
 }
 
 
@@ -4131,7 +4130,7 @@  gimple_switch_index (const gswitch *gs)
 static inline tree *
 gimple_switch_index_ptr (const gswitch *gs)
 {
-  return gimple_op_ptr (gs, 0);
+  return const_cast<tree *> (&gs->op[0]);
 }
 
 
@@ -4140,9 +4139,8 @@  gimple_switch_index_ptr (const gswitch *
 static inline void
 gimple_switch_set_index (gswitch *gs, tree index)
 {
-  GIMPLE_CHECK (gs, GIMPLE_SWITCH);
   gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
-  gimple_set_op (gs, 0, index);
+  gs->op[0] = index;
 }
 
 
@@ -4152,9 +4150,8 @@  gimple_switch_set_index (gswitch *gs, tr
 static inline tree
 gimple_switch_label (const gswitch *gs, unsigned index)
 {
-  GIMPLE_CHECK (gs, GIMPLE_SWITCH);
   gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
-  return gimple_op (gs, index + 1);
+  return gs->op[index + 1];
 }
 
 /* Set the label number INDEX to LABEL.  0 is always the default label.  */
@@ -4162,11 +4159,10 @@  gimple_switch_label (const gswitch *gs,
 static inline void
 gimple_switch_set_label (gswitch *gs, unsigned index, tree label)
 {
-  GIMPLE_CHECK (gs, GIMPLE_SWITCH);
   gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
 			      && (label == NULL_TREE
 			          || TREE_CODE (label) == CASE_LABEL_EXPR));
-  gimple_set_op (gs, index + 1, label);
+  gs->op[index + 1] = label;
 }
 
 /* Return the default label for a switch statement.  */
@@ -5520,7 +5516,7 @@  gimple_transaction_set_subcode (gtransac
 static inline tree *
 gimple_return_retval_ptr (const greturn *gs)
 {
-  return gimple_op_ptr (gs, 0);
+  return const_cast<tree *> (&gs->op[0]);
 }
 
 /* Return the return value for GIMPLE_RETURN GS.  */
@@ -5528,7 +5524,7 @@  gimple_return_retval_ptr (const greturn
 static inline tree
 gimple_return_retval (const greturn *gs)
 {
-  return gimple_op (gs, 0);
+  return gs->op[0];
 }
 
 
@@ -5537,7 +5533,7 @@  gimple_return_retval (const greturn *gs)
 static inline void
 gimple_return_set_retval (greturn *gs, tree retval)
 {
-  gimple_set_op (gs, 0, retval);
+  gs->op[0] = retval;
 }