[llvm-dev] Clang for the PlayStation 2

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Thu Sep 6 12:00:59 PDT 2018


Hi again,

On Thu, 6 Sep 2018 at 17:55, Dan Ravensloft <dan.ravensloft at gmail.com> wrote:
> If so, would you mind pointing me to a function which performs this, or otherwise give a high-level description of how this is done?

I just did a very quick experiment where I made lowerFP_TO_SINT and
lowerFP_TO_SINT_STORE return SDValue() (which is the marker for "I
don't want to handle this"). It looks like someone was enthusiastic
enough to think this operation did actually deserve inlining (by
TargetLowering::expandFP_TO_SINT) so instead of a libcall it produces
a bunch of weird operations implementing that. I assume they're right,
but haven't checked.

To make it production-quality you'd want to predicate the changes I
made on Subtarget->isSingleFloat() I think (probably in combination
with the actual types, since f32 -> i32 ought to still be OK with the
existing code). The main annoyance there is that lowerFP_TO_SINT_STORE
is static rather than a member of MipsISelLowering so it doesn't have
access to Subtarget. Personally, I'd just make it a member function to
fix that.

Cheers.

Tim.


More information about the llvm-dev mailing list