[llvm] r272082 - MIR: Fix parsing of stack object references in MachineMemOperands
Matthias Braun via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 7 17:47:07 PDT 2016
Author: matze
Date: Tue Jun 7 19:47:07 2016
New Revision: 272082
URL: http://llvm.org/viewvc/llvm-project?rev=272082&view=rev
Log:
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).
Modified:
llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp
llvm/trunk/test/CodeGen/MIR/X86/memory-operands.mir
Modified: llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp?rev=272082&r1=272081&r2=272082&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp (original)
+++ llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp Tue Jun 7 19:47:07 2016
@@ -1695,6 +1695,14 @@ bool MIParser::parseMemoryPseudoSourceVa
// 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::parseMemoryPseudoSourceVa
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;
Modified: llvm/trunk/test/CodeGen/MIR/X86/memory-operands.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/MIR/X86/memory-operands.mir?rev=272082&r1=272081&r2=272082&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/MIR/X86/memory-operands.mir (original)
+++ llvm/trunk/test/CodeGen/MIR/X86/memory-operands.mir Tue Jun 7 19:47:07 2016
@@ -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
+
+...
More information about the llvm-commits
mailing list