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: using emit_library_call


The thing is, I want to put labels at certain points in the RTL and then
use these as arguments to the function being called (i e I'm sending the
function an address in the code). I can't see how I can output the labels
before generating the RTL since the labels are put in very specific places
that don't allow them to be written into the C source code (as far as I
can tell), e.g. *just* before the instruction storing a value into memory
in an assignment:

	x = y;

becomes:

			pass value of My_Label

			call function

			load y into reg

	My_Label:	store reg into x


*not*:

			pass value of My_Label

			call function

	My_Label:	load y into reg

			store reg into x



Can it be done?

Would you still recommend doing it at the tree level?


/Per

On Mon, 5 Aug 2002, Richard Henderson wrote:

> On Tue, Aug 06, 2002 at 03:20:54AM +0200, Per Fransson wrote:
> > I've tried using emit_library_call during rtl generation, like this:
> >
> >     emit_library_call (fn_rtx, 0,
> > 		       VOIDmode, 2,
> > 		       operand1_rtx, SImode,
> > 		       operand2_rtx, SImode
> > 		       );
> >
> > but it still doesn't work most of the time (more often *with*
> > optimization than without). Do I have to use start_sequence etc?
>
> If you don't use start_sequence, it will be put at the end of
> the rtl chain, i.e. at the end of the function so far.
>
> > What if I do this during the preparation of a call to another
> > function when some of the arguments for that function is already in place?
>
> Boom.  No can do.
>
> > or can it only be done at certain places (how can I tell?)?
>
> Only certain places.  In order to tell, you must understand
> the surrounding code.
>
> You really want to be doing whatever it is you are doing at the
> tree level, not the rtl level.  See tree-ssa-20020619-branch.
>
>
> r~
>


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