This is an archive of the discontinued LLVM Phabricator instance.

[mips] Handle transparent unions correctly.
ClosedPublic

Authored by dsanders on Jan 14 2015, 2:27 AM.

Details

Summary

This fixes MultiSource/Applications/lemon on big-endian N32 by correcting the
handling of the argument to wait(). glibc defines it as a transparent union of
void* and int*. Such unions are passed according to the rules of the first
member so the argument must be passed as if it were a void* (sign extended from
i32 to i64) and not as a union (shifted to the upper bits of an i64).

wait() already behaves correctly on big-endian O32 and N64 since the union is
already the same size as an argument slot.

Diff Detail

Event Timeline

dsanders updated this revision to Diff 18143.Jan 14 2015, 2:27 AM
dsanders retitled this revision from to [mips] Handle transparent unions correctly..
dsanders updated this object.
dsanders edited the test plan for this revision. (Show Details)
dsanders added a reviewer: atanasyan.
dsanders added a subscriber: Unknown Object (MLST).
atanasyan accepted this revision.Jan 14 2015, 2:56 AM
atanasyan edited edge metadata.

LGTM (with a nit).

lib/CodeGen/TargetInfo.cpp
5706

I would move this call to the first line of the MipsABIInfo::classifyArgumentType function to be sure that all subsequent actions deal with updated Ty.

This revision is now accepted and ready to land.Jan 14 2015, 2:56 AM
dsanders closed this revision.Jan 14 2015, 4:01 AM