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

Re: fake/abnormal/eh edge question


On 08/25/2015 12:39 PM, Steve Ellcey  wrote:
I have a question about FAKE, EH, and ABNORMAL edges.  I am not sure I
understand all the implications of each type of edge from the description
in cfg-flags.def.

I am trying to implement dynamic stack alignment for MIPS and I have code
that does the following:

	prologue
		copy incoming $sp to $12 (temp reg)
		align $sp
		copy $sp to $fp (after alignment so that $fp is also aligned)
	entry block
		copy $12 to virtual reg (DRAP) for accessing args and for
		restoring $sp

	exit block
		copy virtual reg (DRAP) back to $12
	epilogue
		copy $12 to $sp to restore stack pointer
	

This works fine as long as there as a path from the entry block to the
exit block but in some cases (like gcc.dg/cleanup-8.c) we have a function
that always calls abort (a non-returning function) and so there is no
path from entry to exit and the exit block and epilogue get removed and
the copy of $sp to $12 also gets removed because GCC sees no uses of $12.

I want to preserve the copy of $sp to $12 and I also want to preserve the
.cfi psuedo-ops (and code) in the exit block and epilogue in order for
exception handling to work correctly.  One way I thought of doing this
is to create an edge from the entry block to the exit block but I am
unsure of all the implications of creating a fake/eh/abnormal edge to
do this and which I would want to use.
Presumably it's the RTL DCE pass that's eliminating this stuff?

Do you have the FRAME_RELATED bit set of those insns?

But what I don't understand is why preserving the code is useful if it can't be reached. Maybe there's something about the dwarf2 unwinding that I simply don't understand -- I've managed to avoid learning about it for years.

jeff


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