diff options
author | Alex Lorenz <arphaman@gmail.com> | 2015-08-20 00:20:03 +0000 |
---|---|---|
committer | Alex Lorenz <arphaman@gmail.com> | 2015-08-20 00:20:03 +0000 |
commit | 36efd3883dacd6e34c2e4895035d67f842e090b9 (patch) | |
tree | c15d43e234f14bbb4088065031aa64f3dcc459c9 /llvm/lib/CodeGen | |
parent | 0d009645a1023aef1ec139bab61f2ea1b406c8ad (diff) | |
download | bcm5719-llvm-36efd3883dacd6e34c2e4895035d67f842e090b9.tar.gz bcm5719-llvm-36efd3883dacd6e34c2e4895035d67f842e090b9.zip |
MIR Serialization: Use the global value syntax for global value memory operands.
This commit modifies the serialization syntax so that the global IR values in
machine memory operands use the global value '@<name>' syntax instead of the
current '%ir.<name>' syntax.
The unnamed global IR values are handled by this commit as well, as the
existing global value parsing method can parse the unnamed globals already.
llvm-svn: 245527
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/MIRParser/MIParser.cpp | 15 | ||||
-rw-r--r-- | llvm/lib/CodeGen/MIRPrinter.cpp | 5 |
2 files changed, 15 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/MIRParser/MIParser.cpp b/llvm/lib/CodeGen/MIRParser/MIParser.cpp index 3260249d95b..d706f04eccc 100644 --- a/llvm/lib/CodeGen/MIRParser/MIParser.cpp +++ b/llvm/lib/CodeGen/MIRParser/MIParser.cpp @@ -1531,9 +1531,6 @@ bool MIParser::parseIRValue(const Value *&V) { switch (Token.kind()) { case MIToken::NamedIRValue: { V = MF.getFunction()->getValueSymbolTable().lookup(Token.stringValue()); - if (!V) - V = MF.getFunction()->getParent()->getValueSymbolTable().lookup( - Token.stringValue()); break; } case MIToken::IRValue: { @@ -1543,6 +1540,14 @@ bool MIParser::parseIRValue(const Value *&V) { V = getIRValue(SlotNumber); break; } + case MIToken::NamedGlobalValue: + case MIToken::GlobalValue: { + GlobalValue *GV = nullptr; + if (parseGlobalValue(GV)) + return true; + V = GV; + break; + } default: llvm_unreachable("The current token should be an IR block reference"); } @@ -1646,7 +1651,9 @@ bool MIParser::parseMachinePointerInfo(MachinePointerInfo &Dest) { Dest = MachinePointerInfo(PSV, Offset); return false; } - if (Token.isNot(MIToken::NamedIRValue) && Token.isNot(MIToken::IRValue)) + if (Token.isNot(MIToken::NamedIRValue) && Token.isNot(MIToken::IRValue) && + Token.isNot(MIToken::GlobalValue) && + Token.isNot(MIToken::NamedGlobalValue)) return error("expected an IR value reference"); const Value *V = nullptr; if (parseIRValue(V)) diff --git a/llvm/lib/CodeGen/MIRPrinter.cpp b/llvm/lib/CodeGen/MIRPrinter.cpp index 1be845f8b89..4b4d7b4f25c 100644 --- a/llvm/lib/CodeGen/MIRPrinter.cpp +++ b/llvm/lib/CodeGen/MIRPrinter.cpp @@ -608,7 +608,10 @@ void MIPrinter::printIRBlockReference(const BasicBlock &BB) { } void MIPrinter::printIRValueReference(const Value &V) { - // TODO: Global values should use the '@' syntax. + if (isa<GlobalValue>(V)) { + V.printAsOperand(OS, /*PrintType=*/false, MST); + return; + } OS << "%ir."; if (V.hasName()) { printLLVMNameWithoutPrefix(OS, V.getName()); |