This is the mail archive of the 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: Help with mode switching (create_pre_exit)


> I'm fighting with mode switching (to be more precise with
> create_pre_exit function) trying to make it work for MPX. I saw
> create_pre_exit had some stability issues  before and now I'm facing
> similar issues trying to have it working when bound register is
> returned by function in addition to GPR.
> The more I look into create_pre_exit code, the more I think it makes
> some assumptions which are wrong. Also it is very sensitive to the
> code structure and simple changes in exit block crashes pre-exit block
> creation. And in some cases it seems to me function does not fail by
> accident.


> create_pre_exit code assumes value is returned in a single register dx
> which is wrong from the beginning. Then it does not realize set to dx
> and ax are copy of returned value, finally reaches the end of BB and
> splits there. It does not crash assuming it is a case with EH where
> there are no return value copy in exit block.
> If we exchange ax and dx usages then create_pre_exit will fail. If we
> have value returned on more registers and thus will have more usages
> then create_pre_exit will fail.

This should be fixed in [1].

> There is an additional hard reg used for returned value and now
> returned value is stored in non subsequent registers. I think that to
> successfully cover all cases here, function_value target hook should
> be used to determine returned hard regs, rather than use the last
> 'use' insn to determine required hard regs. Does it sound reasonable?
> Am I missing something here?

You should add BND register REGNO(s) used to return bounds to
ix86_function_value_regno_p. These additional registers will be
detected as valid mult-register outputs in create_pre_exit, and this
will bypass the picky assert. Please also see patch at [2].



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