[llvm] r244809 - MIR Serialization: Serialize the GOT pseudo source values.
Alex Lorenz via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 12 14:00:23 PDT 2015
Author: arphaman
Date: Wed Aug 12 16:00:22 2015
New Revision: 244809
URL: http://llvm.org/viewvc/llvm-project?rev=244809&view=rev
Log:
MIR Serialization: Serialize the GOT pseudo source values.
Modified:
llvm/trunk/lib/CodeGen/MIRParser/MILexer.cpp
llvm/trunk/lib/CodeGen/MIRParser/MILexer.h
llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp
llvm/trunk/lib/CodeGen/MIRPrinter.cpp
llvm/trunk/test/CodeGen/MIR/X86/memory-operands.mir
Modified: llvm/trunk/lib/CodeGen/MIRParser/MILexer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MIRParser/MILexer.cpp?rev=244809&r1=244808&r2=244809&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MIRParser/MILexer.cpp (original)
+++ llvm/trunk/lib/CodeGen/MIRParser/MILexer.cpp Wed Aug 12 16:00:22 2015
@@ -202,6 +202,7 @@ static MIToken::TokenKind getIdentifierK
.Case("invariant", MIToken::kw_invariant)
.Case("align", MIToken::kw_align)
.Case("stack", MIToken::kw_stack)
+ .Case("got", MIToken::kw_got)
.Case("constant-pool", MIToken::kw_constant_pool)
.Case("liveout", MIToken::kw_liveout)
.Default(MIToken::Identifier);
Modified: llvm/trunk/lib/CodeGen/MIRParser/MILexer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MIRParser/MILexer.h?rev=244809&r1=244808&r2=244809&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MIRParser/MILexer.h (original)
+++ llvm/trunk/lib/CodeGen/MIRParser/MILexer.h Wed Aug 12 16:00:22 2015
@@ -71,6 +71,7 @@ struct MIToken {
kw_invariant,
kw_align,
kw_stack,
+ kw_got,
kw_constant_pool,
kw_liveout,
Modified: llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp?rev=244809&r1=244808&r2=244809&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp (original)
+++ llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp Wed Aug 12 16:00:22 2015
@@ -1124,6 +1124,9 @@ bool MIParser::parseMemoryPseudoSourceVa
case MIToken::kw_stack:
PSV = MF.getPSVManager().getStack();
break;
+ case MIToken::kw_got:
+ PSV = MF.getPSVManager().getGOT();
+ break;
case MIToken::kw_constant_pool:
PSV = MF.getPSVManager().getConstantPool();
break;
@@ -1136,7 +1139,8 @@ bool MIParser::parseMemoryPseudoSourceVa
}
bool MIParser::parseMachinePointerInfo(MachinePointerInfo &Dest) {
- if (Token.is(MIToken::kw_constant_pool) || Token.is(MIToken::kw_stack)) {
+ if (Token.is(MIToken::kw_constant_pool) || Token.is(MIToken::kw_stack) ||
+ Token.is(MIToken::kw_got)) {
const PseudoSourceValue *PSV = nullptr;
if (parseMemoryPseudoSourceValue(PSV))
return true;
Modified: llvm/trunk/lib/CodeGen/MIRPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MIRPrinter.cpp?rev=244809&r1=244808&r2=244809&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MIRPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/MIRPrinter.cpp Wed Aug 12 16:00:22 2015
@@ -713,6 +713,9 @@ void MIPrinter::print(const MachineMemOp
case PseudoSourceValue::Stack:
OS << "stack";
break;
+ case PseudoSourceValue::GOT:
+ OS << "got";
+ break;
case PseudoSourceValue::ConstantPool:
OS << "constant-pool";
break;
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=244809&r1=244808&r2=244809&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/MIR/X86/memory-operands.mir (original)
+++ llvm/trunk/test/CodeGen/MIR/X86/memory-operands.mir Wed Aug 12 16:00:22 2015
@@ -75,6 +75,15 @@
attributes #0 = { readonly }
+ @G = external global i32
+
+ define i32 @got_psv() {
+ entry:
+ %a = load i32, i32* @G
+ %b = add i32 %a, 1
+ ret i32 %b
+ }
+
...
---
name: test
@@ -246,3 +255,17 @@ body:
- '%rsp = ADD64ri8 %rsp, 24, implicit-def dead %eflags'
- RETQ
...
+---
+name: got_psv
+tracksRegLiveness: true
+body:
+ - id: 0
+ name: entry
+ instructions:
+# CHECK: name: got_psv
+# CHECK: %rax = MOV64rm %rip, 1, _, @G, _ :: (load 8 from got)
+ - '%rax = MOV64rm %rip, 1, _, @G, _ :: (load 8 from got)'
+ - '%eax = MOV32rm killed %rax, 1, _, 0, _'
+ - '%eax = INC32r killed %eax, implicit-def dead %eflags'
+ - 'RETQ %eax'
+...
More information about the llvm-commits
mailing list