Live data from Hacker News

54-line if condition in gcc's reload.c

github.com

21–30 of 95 posts

Re: 54-line if condition in gcc's reload.c

#21

Why put logical operator at the start and not the end of each line? I.e., this style (used in this case) && (CONSTANT_P (SUBREG_REG (in)) || GET_CODE (SUBREG_REG (in)) == PLUS || strict_low || (((REG_P (SUBREG_REG (in)) versus this style: (CONSTANT_P (SUBREG_REG (in)) || GET_CODE (SUBREG_REG (in)) == PLUS || strict_low || (((REG_P (SUBREG_REG (in)) && I don't have a personal preference here, just looking for any prac…

I like the operator at the beginning because you can see the type of comparison at a glance, but most everyone I've talked to prefers them at the end. To each his own, I guess.

Re: 54-line if condition in gcc's reload.c

#22

Why put logical operator at the start and not the end of each line? I.e., this style (used in this case) && (CONSTANT_P (SUBREG_REG (in)) || GET_CODE (SUBREG_REG (in)) == PLUS || strict_low || (((REG_P (SUBREG_REG (in)) versus this style: (CONSTANT_P (SUBREG_REG (in)) || GET_CODE (SUBREG_REG (in)) == PLUS || strict_low || (((REG_P (SUBREG_REG (in)) && I don't have a personal preference here, just looking for any prac…

I used to use the latter, in both code and maths, but I have switched to the former. My main reason is that having the operators (logical and otherwise) at the start of the line means they're more likely to be in the same horizontal position, so it's easier to see which lines are continuations of the previous ones.

Re: 54-line if condition in gcc's reload.c

#23
post #2

Trivia: This code is older than many of the readers. https://github.com/mirrors/gcc/blame/7057506456ba18f080679b2...

I'm impressed that the blame log has survived intact. What SCM was originally used?

Probably Git? You know that's been around much longer than Github has, right.

Re: 54-line if condition in gcc's reload.c

#24
post #23

Earlier quoted context omitted.

I'm impressed that the blame log has survived intact. What SCM was originally used?

Probably Git? You know that's been around much longer than Github has, right.

Hasn't been around _that_ long. Wikipedia puts the release date in 2005.

Re: 54-line if condition in gcc's reload.c

#25

Why put logical operator at the start and not the end of each line? I.e., this style (used in this case) && (CONSTANT_P (SUBREG_REG (in)) || GET_CODE (SUBREG_REG (in)) == PLUS || strict_low || (((REG_P (SUBREG_REG (in)) versus this style: (CONSTANT_P (SUBREG_REG (in)) || GET_CODE (SUBREG_REG (in)) == PLUS || strict_low || (((REG_P (SUBREG_REG (in)) && I don't have a personal preference here, just looking for any prac…

One plus of the former is that you can add a new clause without needing to edit an existing line, makes for cleaner diffs during reviews and makes it such that you wouldn't show up as the last person who touched the existing line in git blame or any other source control equivalent.

Re: 54-line if condition in gcc's reload.c

#26
post #23

Earlier quoted context omitted.

I'm impressed that the blame log has survived intact. What SCM was originally used?

Probably Git? You know that's been around much longer than Github has, right.

Git was released in 2005. Git is only 3 years older than Github

Re: 54-line if condition in gcc's reload.c

#27
post #2

Trivia: This code is older than many of the readers. https://github.com/mirrors/gcc/blame/7057506456ba18f080679b2...

I'm impressed that the blame log has survived intact. What SCM was originally used?

When I started working on gcc 1.36 (company I was working for was designing Unix workstations and we were fixing the backend for MC680x0) we used RCS. But I'm not sure it was the original SCM, we didn't even have Internet access then :-) And we got gcc 1.35-36-37 "smuggled" to us on the 1/4" tape.

Re: 54-line if condition in gcc's reload.c

#28
post #2

Trivia: This code is older than many of the readers. https://github.com/mirrors/gcc/blame/7057506456ba18f080679b2...

I'm impressed that the blame log has survived intact. What SCM was originally used?

Probably RCS http://www.gnu.org/software/rcs/; It's a fact that it used CVS, then SVN at some point (see https://gcc.gnu.org/viewcvs/gcc/branches/CYGNUS/, a branch created by cvs2svn, a migration tool)

EDIT: Apparently all previous history was lost when they implemented CVS, circa 1997. We could always ask someone in the oldest maintainers file available (https://gcc.gnu.org/viewcvs/gcc/trunk/MAINTAINERS?revision=1...) and have the real answer.

Re: 54-line if condition in gcc's reload.c

#30
post #20

I was going to take a crack at breaking this apart into component functions, but I realized that I don't know where to draw the lines, or what to name the functions, without understanding the internals of this part (and probably other parts) of the compiler. And that's why this will be here forever.

Actually reload has been replaced by LRA for x86/x86_64 in GCC 4.8 and work is ongoing to bring LRA to other targets. So it shouldn't be forever.
Post reply on HN