This is an archive of the discontinued LLVM Phabricator instance.

[mips] Fix expansion of memory operation if destination register is not a GPR.
ClosedPublic

Authored by matheusalmeida on Jun 17 2014, 4:46 AM.

Details

Summary

The assembler tries to reuse the destination register for memory operations whenever
it can but it's not possible to do so if the destination register is not a GPR.

Example:

ldc1 $f0, sym

should expand to:

lui $at, %hi(sym)
ldc1 $f0, %lo(sym)($at)

It's entirely wrong to expand to:

lui $f0, %hi(sym)
ldc1 $f0, %lo(sym)($f0)

Diff Detail

Event Timeline

matheusalmeida retitled this revision from to [mips] Fix expansion of memory operation if destination register is not a GPR..
matheusalmeida updated this object.
matheusalmeida edited the test plan for this revision. (Show Details)
dsanders updated this object.Jun 18 2014, 3:28 AM
dsanders accepted this revision.Jun 18 2014, 3:38 AM
dsanders edited edge metadata.

LGTM with some minor changes to the comments

lib/Target/Mips/AsmParser/MipsAsmParser.cpp
1125

'These are the some types' is strange english. I think you intended 'These are some of the types'

1128–1130

Does %hi/%lo take an immediate?

If not, then '((offset >> 16) & 0xffff)' or 'offset_hi16' might be better

1146

True since there is no destination register on a store but 'must not clobber the source register' would be a bit clearer.

This revision is now accepted and ready to land.Jun 18 2014, 3:38 AM
matheusalmeida edited edge metadata.

Fix grammar.