This is an archive of the discontinued LLVM Phabricator instance.

[mips] Distinguish 'R', 'ZC', and 'm' inline assembly memory constraint.
ClosedPublic

Authored by dsanders on Mar 18 2015, 8:00 AM.

Details

Summary

Previous behaviour of 'R' and 'm' has been preserved for now. They will be
improved in subsequent commits.

The offset permitted by ZC varies according to the subtarget since it is
intended to match the restrictions of the pref, ll, and sc instructions.

The restrictions on these instructions are:

  • For microMIPS: 12-bit signed offset.
  • For Mips32r6/Mips64r6: 9-bit signed offset.
  • Otherwise: 16-bit signed offset.

Diff Detail

Event Timeline

dsanders updated this revision to Diff 22184.Mar 18 2015, 8:00 AM
dsanders retitled this revision from to [mips] Distinguish 'R', 'ZC', and 'm' inline assembly memory constraint..
dsanders updated this object.
dsanders edited the test plan for this revision. (Show Details)
dsanders added a reviewer: vkalintiris.
dsanders added a subscriber: Unknown Object (MLST).
vkalintiris edited edge metadata.Mar 23 2015, 5:57 AM

LGTM. I've noticed that we don't check for negative offsets in this patch, in D8435 and in D8440. That's fine with me, given that those tests would essentially test selectAddrFrameIndexOffset() and not the logic of the memory constraints, I just wanted to make sure that you're aware of that.

include/llvm/IR/InlineAsm.h
248–258

Out of curiosity, these constraints were missing when I applied the patch with arc patch D8414. Do you have any idea why?

lib/Target/Mips/MipsAsmPrinter.cpp
545–546

Given these asserts, it would be nice to assert also that OpNum + 1 a valid operand number in getOperand()

vkalintiris accepted this revision.Mar 23 2015, 6:00 AM
vkalintiris edited edge metadata.

Forgot to explicitly mark the revision as accepted in my previous comment.

This revision is now accepted and ready to land.Mar 23 2015, 6:00 AM
dsanders closed this revision.Mar 24 2015, 4:29 AM

LGTM. I've noticed that we don't check for negative offsets in this patch, in D8435 and in D8440. That's fine with me, given that those tests would essentially test selectAddrFrameIndexOffset() and not the logic of the memory constraints, I just wanted to make sure that you're aware of that.

I've added a test for -4 in the commit.

include/llvm/IR/InlineAsm.h
248–258

It's because they were gradually added by the various target-specific patches and not all of them have been committed yet.

lib/Target/Mips/MipsAsmPrinter.cpp
545–546

I've added this assert in the commit