Page MenuHomePhabricator

[mips] Replace custom parsing logic for data directives by the `addAliasForDirective`
ClosedPublic

Authored by atanasyan on Jul 19 2018, 5:04 AM.

Details

Summary

The target independent AsmParser doesn't recognise .hword, .word, .dword which are required for Mips. Currently MipsAsmParser recognises these through dispatch to MipsAsmParser::parseDataDirective. This contains equivalent logic to AsmParser::parseDirectiveValue. This patch allows reuse of AsmParser::parseDirectiveValue by making use of addAliasForDirective to support .hword, .word and .dword.

Original patch provided by Alex Bradbury at D47001 was modified to fix handling of microMIPS symbols. The AsmParser::parseDirectiveValue calls either EmitIntValue or EmitValue. In this patch we override EmitIntValue in the MipsELFStreamer to clear a pending set of microMIPS symbols.

Diff Detail

Repository
rL LLVM

Event Timeline

atanasyan created this revision.Jul 19 2018, 5:04 AM
asb added a comment.Jul 19 2018, 5:19 AM

Could you add a test that shows .4byte and .long are now correctly handled too? e.g. by extending micromips-label-test.s

atanasyan updated this revision to Diff 156676.Jul 21 2018, 7:27 AM
  • Add more tests to check .2byte, .4byte, .8byte, .long, .hword directives.
asb accepted this revision.Jul 24 2018, 7:40 AM

Looks good to me.

This revision is now accepted and ready to land.Jul 24 2018, 7:40 AM
This revision was automatically updated to reflect the committed changes.

Thanks for review.