diff options
author | Matthias Braun <matze@braunis.de> | 2016-06-08 00:47:07 +0000 |
---|---|---|
committer | Matthias Braun <matze@braunis.de> | 2016-06-08 00:47:07 +0000 |
commit | 3ef7df9cdfdfc302f557e6f170546e47afe7b8f8 (patch) | |
tree | d50e0172b5e8b7ba543829c4e166bd8376b0dba3 | |
parent | b202ad6518438f2ce1e0241ab9df81b5706e5e4e (diff) | |
download | bcm5719-llvm-3ef7df9cdfdfc302f557e6f170546e47afe7b8f8.tar.gz bcm5719-llvm-3ef7df9cdfdfc302f557e6f170546e47afe7b8f8.zip |
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).
llvm-svn: 272082
-rw-r--r-- | llvm/lib/CodeGen/MIRParser/MIParser.cpp | 11 | ||||
-rw-r--r-- | llvm/test/CodeGen/MIR/X86/memory-operands.mir | 23 |
2 files changed, 28 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/MIRParser/MIParser.cpp b/llvm/lib/CodeGen/MIRParser/MIParser.cpp index 41454dd9d66..158502ce353 100644 --- a/llvm/lib/CodeGen/MIRParser/MIParser.cpp +++ b/llvm/lib/CodeGen/MIRParser/MIParser.cpp @@ -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; diff --git a/llvm/test/CodeGen/MIR/X86/memory-operands.mir b/llvm/test/CodeGen/MIR/X86/memory-operands.mir index 0cf74ddbe70..38846933b93 100644 --- a/llvm/test/CodeGen/MIR/X86/memory-operands.mir +++ b/llvm/test/CodeGen/MIR/X86/memory-operands.mir @@ -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 + +... |