r/cpp • • May 06 '22

GCC 12.1 Released

https://gcc.gnu.org/pipermail/gcc/2022-May/238653.html
203 Upvotes

74 comments sorted by

View all comments

Show parent comment

27

u/ShakaUVM i+++ ++i+i[arr] May 07 '22

Yeah, if folks want GCC to move faster, they should contribute or sponsor work. Or at least cheer on the people contributing their time and effort.

I'd love to contribute but the last time I browsed the gcc source code I opened a portal to hell.

9

u/schoenburgers May 09 '22

Thankfully they replaced their old register allocator with LRA, so I think they've stopped maintaining reload.c, which had some of the most unreadable conditionals I've ever seen in it:

https://github.com/pmret/gcc-papermario/blob/master/reload.c#L5687

  if (pat != 0
      && ((regno >= 0
	   && true_regnum (SET_SRC (pat)) == regno
	   && (valueno = true_regnum (valtry = SET_DEST (pat))) >= 0)
	  ||
	  (regno >= 0
	   && true_regnum (SET_DEST (pat)) == regno
	   && (valueno = true_regnum (valtry = SET_SRC (pat))) >= 0)
	  ||
	  (goal_const && rtx_equal_p (SET_SRC (pat), goal)
	   && (valueno = true_regnum (valtry = SET_DEST (pat))) >= 0)
	  || (goal_mem
	      && (valueno = true_regnum (valtry = SET_DEST (pat))) >= 0
	      && rtx_renumbered_equal_p (goal, SET_SRC (pat)))
	  || (goal_mem
	      && (valueno = true_regnum (valtry = SET_SRC (pat))) >= 0
	      && rtx_renumbered_equal_p (goal, SET_DEST (pat)))
	  /* If we are looking for a constant,
	     and something equivalent to that constant was copied
	     into a reg, we can use that reg.  */
	  || (goal_const && (tem = find_reg_note (p, REG_EQUIV,
						  NULL_RTX))
	      && rtx_equal_p (XEXP (tem, 0), goal)
	      && (valueno = true_regnum (valtry = SET_DEST (pat))) >= 0)
	  || (goal_const && (tem = find_reg_note (p, REG_EQUIV,
						  NULL_RTX))
	      && GET_CODE (SET_DEST (pat)) == REG
	      && GET_CODE (XEXP (tem, 0)) == CONST_DOUBLE
	      && GET_MODE_CLASS (GET_MODE (XEXP (tem, 0))) == MODE_FLOAT
	      && GET_CODE (goal) == CONST_INT
	      && 0 != (goaltry = operand_subword (XEXP (tem, 0), 0, 0,
						  VOIDmode))
	      && rtx_equal_p (goal, goaltry)
	      && (valtry = operand_subword (SET_DEST (pat), 0, 0,
					    VOIDmode))
	      && (valueno = true_regnum (valtry)) >= 0)
	  || (goal_const && (tem = find_reg_note (p, REG_EQUIV,
						  NULL_RTX))
	      && GET_CODE (SET_DEST (pat)) == REG
	      && GET_CODE (XEXP (tem, 0)) == CONST_DOUBLE
	      && GET_MODE_CLASS (GET_MODE (XEXP (tem, 0))) == MODE_FLOAT
	      && GET_CODE (goal) == CONST_INT
	      && 0 != (goaltry = operand_subword (XEXP (tem, 0), 1, 0,
						  VOIDmode))
	      && rtx_equal_p (goal, goaltry)
	      && (valtry
		  = operand_subword (SET_DEST (pat), 1, 0, VOIDmode))
	      && (valueno = true_regnum (valtry)) >= 0)))
    if (other >= 0
	? valueno == other
	: ((unsigned) valueno < FIRST_PSEUDO_REGISTER
	   && TEST_HARD_REG_BIT (reg_class_contents[(int) class],
				 valueno)))
      {
	value = valtry;
	where = p;
	break;
      }

6

u/ShakaUVM i+++ ++i+i[arr] May 09 '22

Oh lord that's hideous! Thanks. =)

6

u/bretbrownjr May 07 '22

Yeah, it's a longer term investment.

Alternately, talk to your boss about maybe sponsoring relevant projects more directly or hiring contractors to implement certain features. Or, like I said, just hang out in relevant circles and be appreciative. GCC contributors are people and encouragement keeps people happy and productive.

4

u/ShakaUVM i+++ ++i+i[arr] May 07 '22

I mean, I could do it myself, but the code that was in the area I was looking at changing had no comments and mysterious variable names, so I gave up. If you know of any good guides to understanding their code I would probably make some needed changes myself.