This is an archive of the discontinued LLVM Phabricator instance.

[MIPS] Use Address::GetAddressClass() instead of elf flags to decide address space of an address
AcceptedPublic

Authored by bhushan on Sep 24 2015, 9:40 PM.

Details

Reviewers
clayborg
Summary

In MIPS, an application elf can contain mixed code (mips + micromips) i.e some functions in the application can be "micromips" and some functions can be MIPS-only (non-micromips).
Micromips functions has compressed addresses (bit #0 set) and MIPS functions has un-compressed addresses (bit #0 clear).
Such mixed-mode elf will have micromips specific bits set in its flags. That means "IsMicromips" will be true even for non-micromips address.

This patch fixes this by using Address::GetAddressClass() to decide which address space the address belongs to (instead of deciding this from elf's flags).

Diff Detail

Repository
rL LLVM

Event Timeline

bhushan updated this revision to Diff 35697.Sep 24 2015, 9:40 PM
bhushan retitled this revision from to [MIPS] Use Address::GetAddressClass() instead of elf flags to decide address space of an address.
bhushan updated this object.
bhushan added a reviewer: clayborg.
bhushan set the repository for this revision to rL LLVM.
clayborg accepted this revision.Oct 5 2015, 11:26 AM
clayborg edited edge metadata.

Back from vacation, sorry for the delay. Looks good.

This revision is now accepted and ready to land.Oct 5 2015, 11:26 AM

You should add a test for this. You might need a @skipIfNotMips decorator

Looks like patch was not committed.

Hi Eugene,

I did not commit this patch because @zturner had asked for a testcase for this change. But the test will require to build it for micromips target (-mmicromips option) and currently I don't have any micromips hardware available. I had tested this patch with simulator.

I can rebase and commit it if @clayborg and @zturner agrees.