This is an archive of the discontinued LLVM Phabricator instance.

[Mips][CodeGen] Remove MachineFunction::setSubtarget. Change Mips to just copy the subtarget from the MachineFunction instead of recalculating it.
ClosedPublic

Authored by craig.topper on Apr 20 2019, 8:28 AM.

Details

Summary

The MachineFunction should have been created with the correct subtarget. As
long as there is no way to change it, MipsTargetMachine can just capture it
directly from the MachineFunction without calling getSubtargetImpl again.

While there, const correct the Subtarget pointer to avoid a const_cast.

I believe the Mips16Subtarget and NoMips16Subtarget members are never used, but
I'll leave there removal for a separate patch.

Event Timeline

craig.topper created this revision.Apr 20 2019, 8:28 AM
This revision is now accepted and ready to land.Apr 23 2019, 2:22 PM
This revision was automatically updated to reflect the committed changes.