public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* [Linux-ia64] run time code generation for IA-64
@ 2003-05-26 10:49 CH Gowri Kumar
  2003-05-27 18:17 ` David Mosberger
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: CH Gowri Kumar @ 2003-05-26 10:49 UTC (permalink / raw)
  To: linux-ia64

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1449 bytes --]

Hi all,
I have been writing macros for the runtime code generation for IA-64.
You can find the files in the attachment (ia64.tar.gz).

I am facing a serious problem while calling the functions from the 
runtime generated code. I am able to execute the function but while 
returning it is dumping core. I couldn't figure out what is the mistake I 
am doing.

This is what I am doing to generate a call statement:
I have a function named "Test_Function" which I am trying to call from the 
generated code. For that I am doing this:

IA64_FUNCTION* fp;
fp = (IA64_FUNCTION*)Test_Function;
target = fp->addr;

Generate code such that this target address is moved into register R15
and then to a branch register b6 and generate a call statment as:
br.call.sptk.many b0 =b6.

Also, I am storing the GP,RP etc. in R4,R5 (as they are preserved across
function calls).

The IA64_dumpcode function dumps the code which have generated at runtime 
and seems to be work properly.

Can anyone explain what is the mistake I am doing and the remedy?


The attachment contains all the relavent files:

bash$ make
gcc ia64_codegen.c test_call.c
bash$ ./a.out
.......

Thanks in advance.

Regards,
Gowri Kumar

PS: This being the first version, I haven't done anything towards 
exploiting parallelism. So, each instruction will effectively make a 
bundle with the other two slots as nops. Once I am assured of the 
correctness of macros, I will go for the scheduling.

[-- Attachment #2: Type: APPLICATION/x-gzip, Size: 18564 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Linux-ia64] run time code generation for IA-64
  2003-05-26 10:49 [Linux-ia64] run time code generation for IA-64 CH Gowri Kumar
@ 2003-05-27 18:17 ` David Mosberger
  2003-05-27 18:42 ` David Mosberger
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: David Mosberger @ 2003-05-27 18:17 UTC (permalink / raw)
  To: linux-ia64

>>>>> On Mon, 26 May 2003 16:07:30 +0530 (IST), CH Gowri Kumar <gkumar@csa.iisc.ernet.in> said:

  CH> Also, I am storing the GP,RP etc. in R4,R5 (as they are
  CH> preserved across function calls).

Where do you have R4 and R5 before using them?  Using local (stacked)
registers instead might be a better choice here.

	--david


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Linux-ia64] run time code generation for IA-64
  2003-05-26 10:49 [Linux-ia64] run time code generation for IA-64 CH Gowri Kumar
  2003-05-27 18:17 ` David Mosberger
@ 2003-05-27 18:42 ` David Mosberger
  2003-05-27 18:56 ` David Mosberger
  2003-05-27 18:59 ` CH Gowri Kumar
  3 siblings, 0 replies; 5+ messages in thread
From: David Mosberger @ 2003-05-27 18:42 UTC (permalink / raw)
  To: linux-ia64

>>>>> On Tue, 27 May 2003 11:17:47 -0700, David Mosberger <davidm@linux.hpl.hp.com> said:

>>>>> On Mon, 26 May 2003 16:07:30 +0530 (IST), CH Gowri Kumar <gkumar@csa.iisc.ernet.in> said:
  CH> Also, I am storing the GP,RP etc. in R4,R5 (as they are
  CH> preserved across function calls).

  David> Where do you have R4 and R5 before using them?  Using local
		      ^
		      |
		should be an "s"

Sorry about that.

	--david


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Linux-ia64] run time code generation for IA-64
  2003-05-26 10:49 [Linux-ia64] run time code generation for IA-64 CH Gowri Kumar
  2003-05-27 18:17 ` David Mosberger
  2003-05-27 18:42 ` David Mosberger
@ 2003-05-27 18:56 ` David Mosberger
  2003-05-27 18:59 ` CH Gowri Kumar
  3 siblings, 0 replies; 5+ messages in thread
From: David Mosberger @ 2003-05-27 18:56 UTC (permalink / raw)
  To: linux-ia64

>>>>> On Wed, 28 May 2003 00:17:42 +0530 (IST), CH Gowri Kumar <gkumar@csa.iisc.ernet.in> said:

  CH> Hi David,
  >> Where do you have R4 and R5 before using them?

  CH> Did you mean to say that I have to save R4 and R5 before using them?

Yes, of course: "preserved" means you have to save a register before
using it.  On the positive side, it's contents will get preserved
across calls.

  CH> Just wondering why isn't there a standard calling convention on IA-64.
  CH> Something of this sort(if at all to be saved):
  CH> rp has to be saved in loc0
  CH> sp has to be saved in loc1
  CH> gp has to be saved in loc2

That would needlessly constrain code optimization.  For example, on
ia64, it's almost never necessary to save sp.

	--david


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Linux-ia64] run time code generation for IA-64
  2003-05-26 10:49 [Linux-ia64] run time code generation for IA-64 CH Gowri Kumar
                   ` (2 preceding siblings ...)
  2003-05-27 18:56 ` David Mosberger
@ 2003-05-27 18:59 ` CH Gowri Kumar
  3 siblings, 0 replies; 5+ messages in thread
From: CH Gowri Kumar @ 2003-05-27 18:59 UTC (permalink / raw)
  To: linux-ia64

Hi David,
> Where do you have R4 and R5 before using them?  
Did you mean to say that I have to save R4 and R5 before using them?

>Using local (stacked)
>registers instead might be a better choice here.
This is what exactly I came up with finally and it seems to be working 
fine for now. 

Just wondering why isn't there a standard calling convention on IA-64. 
Something of this sort(if at all to be saved):
	rp has to be saved in loc0
	sp has to be saved in loc1
	gp has to be saved in loc2

(Or I didn't read the manuals properly?)

Regards,
Gowri Kumar





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-05-27 18:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-26 10:49 [Linux-ia64] run time code generation for IA-64 CH Gowri Kumar
2003-05-27 18:17 ` David Mosberger
2003-05-27 18:42 ` David Mosberger
2003-05-27 18:56 ` David Mosberger
2003-05-27 18:59 ` CH Gowri Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox