From: Alex Lorenz Date: Wed, 12 Aug 2015 21:00:22 +0000 (+0000) Subject: MIR Serialization: Serialize the GOT pseudo source values. X-Git-Tag: studio-1.4~139 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d858f874fa8c5e3a48ef160c3f8682e2f5cf6bd7;p=platform%2Fupstream%2Fllvm.git MIR Serialization: Serialize the GOT pseudo source values. llvm-svn: 244809 --- diff --git a/llvm/lib/CodeGen/MIRParser/MILexer.cpp b/llvm/lib/CodeGen/MIRParser/MILexer.cpp index 8a6a1ff..950181b 100644 --- a/llvm/lib/CodeGen/MIRParser/MILexer.cpp +++ b/llvm/lib/CodeGen/MIRParser/MILexer.cpp @@ -202,6 +202,7 @@ static MIToken::TokenKind getIdentifierKind(StringRef Identifier) { .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); diff --git a/llvm/lib/CodeGen/MIRParser/MILexer.h b/llvm/lib/CodeGen/MIRParser/MILexer.h index 2c7a32c..beb38d0 100644 --- a/llvm/lib/CodeGen/MIRParser/MILexer.h +++ b/llvm/lib/CodeGen/MIRParser/MILexer.h @@ -71,6 +71,7 @@ struct MIToken { kw_invariant, kw_align, kw_stack, + kw_got, kw_constant_pool, kw_liveout, diff --git a/llvm/lib/CodeGen/MIRParser/MIParser.cpp b/llvm/lib/CodeGen/MIRParser/MIParser.cpp index 47a9eaf..6dae29a 100644 --- a/llvm/lib/CodeGen/MIRParser/MIParser.cpp +++ b/llvm/lib/CodeGen/MIRParser/MIParser.cpp @@ -1124,6 +1124,9 @@ bool MIParser::parseMemoryPseudoSourceValue(const PseudoSourceValue *&PSV) { 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::parseMemoryPseudoSourceValue(const PseudoSourceValue *&PSV) { } 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; diff --git a/llvm/lib/CodeGen/MIRPrinter.cpp b/llvm/lib/CodeGen/MIRPrinter.cpp index 019383c..83e7b3e 100644 --- a/llvm/lib/CodeGen/MIRPrinter.cpp +++ b/llvm/lib/CodeGen/MIRPrinter.cpp @@ -713,6 +713,9 @@ void MIPrinter::print(const MachineMemOperand &Op) { case PseudoSourceValue::Stack: OS << "stack"; break; + case PseudoSourceValue::GOT: + OS << "got"; + break; case PseudoSourceValue::ConstantPool: OS << "constant-pool"; break; diff --git a/llvm/test/CodeGen/MIR/X86/memory-operands.mir b/llvm/test/CodeGen/MIR/X86/memory-operands.mir index 289a5f6..c95d6d4 100644 --- a/llvm/test/CodeGen/MIR/X86/memory-operands.mir +++ b/llvm/test/CodeGen/MIR/X86/memory-operands.mir @@ -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' +...