[PATCH] D102870: [RFC] [WIP] CodeGen: Print/parse LLTs in MachineMemOperands
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 8 16:20:15 PDT 2021
arsenm updated this revision to Diff 350734.
arsenm edited the summary of this revision.
arsenm added a comment.
I completed the test updates, however the diff is at least 3x larger than the phabricator upload maximum size.
Should be able to drop the legacy parsing of the integer size soon in a follow on change
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D102870/new/
https://reviews.llvm.org/D102870
Files:
llvm/lib/CodeGen/MIRParser/MIParser.cpp
llvm/lib/CodeGen/MachineOperand.cpp
Index: llvm/lib/CodeGen/MachineOperand.cpp
===================================================================
--- llvm/lib/CodeGen/MachineOperand.cpp
+++ llvm/lib/CodeGen/MachineOperand.cpp
@@ -1113,10 +1113,10 @@
if (getFailureOrdering() != AtomicOrdering::NotAtomic)
OS << toIRString(getFailureOrdering()) << ' ';
- if (getSize() == MemoryLocation::UnknownSize)
- OS << "unknown-size";
+ if (getMemoryType().isValid())
+ OS << '(' << getMemoryType() << ')';
else
- OS << getSize();
+ OS << "unknown-size";
if (const Value *Val = getValue()) {
OS << ((isLoad() && isStore()) ? " on " : isLoad() ? " from " : " into ");
Index: llvm/lib/CodeGen/MIRParser/MIParser.cpp
===================================================================
--- llvm/lib/CodeGen/MIRParser/MIParser.cpp
+++ llvm/lib/CodeGen/MIRParser/MIParser.cpp
@@ -3047,18 +3047,34 @@
if (parseOptionalAtomicOrdering(FailureOrder))
return true;
+ LLT MemoryType;
if (Token.isNot(MIToken::IntegerLiteral) &&
- Token.isNot(MIToken::kw_unknown_size))
- return error("expected the size integer literal or 'unknown-size' after "
+ Token.isNot(MIToken::kw_unknown_size) &&
+ Token.isNot(MIToken::lparen))
+ return error("expected memory LLT, the size integer literal or 'unknown-size' after "
"memory operation");
- uint64_t Size;
+
+ uint64_t Size = MemoryLocation::UnknownSize;
if (Token.is(MIToken::IntegerLiteral)) {
if (getUint64(Size))
return true;
+
+ // Convert from bytes to bits for storage.
+ MemoryType = LLT::scalar(8 * Size);
+ lex();
} else if (Token.is(MIToken::kw_unknown_size)) {
Size = MemoryLocation::UnknownSize;
+ lex();
+ } else {
+ if (expectAndConsume(MIToken::lparen))
+ return true;
+ if (parseLowLevelType(Token.location(), MemoryType))
+ return true;
+ if (expectAndConsume(MIToken::rparen))
+ return true;
+
+ Size = MemoryType.getSizeInBytes();
}
- lex();
MachinePointerInfo Ptr = MachinePointerInfo();
if (Token.is(MIToken::Identifier)) {
@@ -3121,8 +3137,8 @@
}
if (expectAndConsume(MIToken::rparen))
return true;
- Dest = MF.getMachineMemOperand(Ptr, Flags, Size, Align(BaseAlignment), AAInfo,
- Range, SSID, Order, FailureOrder);
+ Dest = MF.getMachineMemOperand(Ptr, Flags, MemoryType, Align(BaseAlignment),
+ AAInfo, Range, SSID, Order, FailureOrder);
return false;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102870.350734.patch
Type: text/x-patch
Size: 2513 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210608/6c51397a/attachment.bin>
More information about the llvm-commits
mailing list