[LLVMdev] Troubling promotion of return value to Integer ...

Alireza.Moshtaghi at microchip.com Alireza.Moshtaghi at microchip.com
Thu May 15 12:10:44 PDT 2008


>If you are using a non-C ABI, then you may not need to do the promotion
at all. However, if you do need to do the ....

Our port is for C language, however, on an 8-bit platform priorities
shift a little bit.

Really the natural size of int must be 8 bit, however, 8 bit is too
small for most calculations so we have to choose 16, but there is no
16-bit register available. And that is where the whole problem starts
because promoting the return of char to int becomes too expensive; so we
don't want to do it.

 

Being able to turn the promotion off is going to solve our problem, but
currently there is no hook for that in target specific classes. 

 

Ali.

 

________________________________

From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu]
On Behalf Of Evan Cheng
Sent: Thursday, May 15, 2008 11:11 AM
To: LLVM Developers Mailing List
Subject: Re: [LLVMdev] Troubling promotion of return value to Integer
...

 

 

On May 14, 2008, at 10:43 AM, Alireza.Moshtaghi at microchip.com wrote:





In this thread I'm trying to merge two email threads into one, because
both discuss the same problem that's troubling us and I would like to
reach a conclusion on what would be the best approach.

To minimize the size of this thread I only mention the subject of the
other two threads:

(1)    [LLVMdev] Integer promotion of return node operand
(initiated by Sachin)

(2)    [LLVMdev] trouble with 32-bit promotion of return value
(initiated by myself)

 

To summarize:

Evan has replied to thread (1) and suggested to add a calling convention
and check for it in visitRet

Dan replied to thread (2) and suggested to add a new field to the
TargetLowering class, and then let each target specify the minimum
integer type to promote return types to

 

Either way, I think we all agree that the root of the problem is the
FIXME in SelectionDAGLowering::visitRet()

 

But what is the preferred method?

 

Both. :-)

 

If you are using a non-C ABI, then you may not need to do the promotion
at all. However, if you do need to do the promotion, you need to know
the type of "int". It's not entirely clear to me what is the best way to
accomplish. To me, I don't think TargetLowering is the right place to
add the hook. How about TargetData.h ? There is a getIntPtrType(),
perhaps we need a getIntType()?

 

Evan





 

Thanks

Ali

_______________________________________________
LLVM Developers mailing list
LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080515/e443bf31/attachment.html>


More information about the llvm-dev mailing list