MIR: Fix parsing of stack object references in MachineMemOperands

The MachineMemOperand parser lacked the code to handle %stack.X
references (%fixed-stack.X was working).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272082 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Matthias Braun 2016-06-08 00:47:07 +00:00
parent 44e9b3090f
commit 0f19dc2756
2 changed files with 28 additions and 6 deletions

View File

@ -1695,6 +1695,14 @@ bool MIParser::parseMemoryPseudoSourceValue(const PseudoSourceValue *&PSV) {
// The token was already consumed, so use return here instead of break.
return false;
}
case MIToken::StackObject: {
int FI;
if (parseStackFrameIndex(FI))
return true;
PSV = MF.getPSVManager().getFixedStack(FI);
// The token was already consumed, so use return here instead of break.
return false;
}
case MIToken::kw_call_entry: {
lex();
switch (Token.kind()) {
@ -1726,7 +1734,8 @@ bool MIParser::parseMemoryPseudoSourceValue(const PseudoSourceValue *&PSV) {
bool MIParser::parseMachinePointerInfo(MachinePointerInfo &Dest) {
if (Token.is(MIToken::kw_constant_pool) || Token.is(MIToken::kw_stack) ||
Token.is(MIToken::kw_got) || Token.is(MIToken::kw_jump_table) ||
Token.is(MIToken::FixedStackObject) || Token.is(MIToken::kw_call_entry)) {
Token.is(MIToken::FixedStackObject) || Token.is(MIToken::StackObject) ||
Token.is(MIToken::kw_call_entry)) {
const PseudoSourceValue *PSV = nullptr;
if (parseMemoryPseudoSourceValue(PSV))
return true;

View File

@ -187,9 +187,8 @@
ret i8* %0
}
define void @dummy() {
ret void
}
define void @dummy0() { ret void }
define void @dummy1() { ret void }
...
---
name: test
@ -512,12 +511,26 @@ body: |
...
---
# Test memory operand without associated value.
# CHECK-LABEL: name: dummy
# CHECK-LABEL: name: dummy0
# CHECK: %rax = MOV64rm undef %rax, 1, _, 0, _ :: (load 8)
name: dummy
name: dummy0
tracksRegLiveness: true
body: |
bb.0:
%rax = MOV64rm undef %rax, 1, _, 0, _ :: (load 8)
RETQ %rax
...
---
# Test parsing of stack references in machine memory operands.
# CHECK-LABEL: name: dummy1
# CHECK: %rax = MOV64rm %rsp, 1, _, 0, _ :: (load 8 from %stack.0)
name: dummy1
tracksRegLiveness: true
stack:
- { id: 0, size: 4, alignment: 4 }
body: |
bb.0:
%rax = MOV64rm %rsp, 1, _, 0, _ :: (load 8 from %stack.0)
RETQ %rax
...