[LLVMdev] trouble with 32-bit promotion of return value

Alireza.Moshtaghi at microchip.com Alireza.Moshtaghi at microchip.com
Tue May 13 11:54:50 PDT 2008


There is a FIXME part in SelectionDAGLowering::visitRet() that is giving
us trouble. And I would like to know how the community has planned for
addressing this problem.

The current implementation assumes that all C calling conventions
require the return value of integer types in the largest register class
(for most ports 32-bit). However, this is not the case for our port. We
have two register classes (8-bit and 16-bit) and we only return the
8-bit return values in the 8-bit register. The rest is returned in the
memory. But the current behavior of LLVM promotes the return value to 16
bits (largest register class that it can find in the target).

To me, such promotions are Target/ABI specific and should not happen in
the general llvm modules. The correct place (I think) is the target
specific part of the backend. It may also be taken care of in the target
specific modules of the front-end but I'm not sure... (I think it is
more of code generation issue rather than language issue)

Regards
Ali




More information about the llvm-dev mailing list