diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2021-05-19 22:06:14 -0400 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2021-06-29 17:38:51 -0400 |
commit | 990278d026d680942c859be70836ad34a9a716f7 (patch) | |
tree | f6bdb4f0a9ad4dcf48dc1cf0d6751f9bd9d8c132 /llvm/lib/CodeGen/MachineFunction.cpp | |
parent | 49fa6abf7472022d7bf1fb05df3033a7bd1ff0de (diff) | |
download | llvm-990278d026d680942c859be70836ad34a9a716f7.zip llvm-990278d026d680942c859be70836ad34a9a716f7.tar.gz llvm-990278d026d680942c859be70836ad34a9a716f7.tar.bz2 |
CodeGen: Store LLT instead of uint64_t in MachineMemOperand
GlobalISel is relying on regular MachineMemOperands to track all of
the memory properties of accesses. Just the raw byte size is
insufficent to disambiguate all situations. For example, if we need to
split an unaligned extending load, we need to know the number of bits
in the original source value and can't infer it from the result
type. This is also a problem for extending vector loads.
This does decrease the maximum representable size from the full
uint64_t bytes to a maximum of 16-bits. No in tree testcases hit this,
other than places using UINT64_MAX for unknown sizes. This may be an
issue for G_MEMCPY and co., although they can just use unknown size
for large static sizes. This also has potential for backend abuse by
relying on the type when it really shouldn't be relevant after
selection.
This does not include the necessary MIR printer/parser changes to
represent this.
Diffstat (limited to 'llvm/lib/CodeGen/MachineFunction.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineFunction.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp index dff38f0..39feb92 100644 --- a/llvm/lib/CodeGen/MachineFunction.cpp +++ b/llvm/lib/CodeGen/MachineFunction.cpp @@ -438,6 +438,16 @@ MachineMemOperand *MachineFunction::getMachineMemOperand( } MachineMemOperand *MachineFunction::getMachineMemOperand( + MachinePointerInfo PtrInfo, MachineMemOperand::Flags f, LLT MemTy, + Align base_alignment, const AAMDNodes &AAInfo, const MDNode *Ranges, + SyncScope::ID SSID, AtomicOrdering Ordering, + AtomicOrdering FailureOrdering) { + return new (Allocator) + MachineMemOperand(PtrInfo, f, MemTy, base_alignment, AAInfo, Ranges, SSID, + Ordering, FailureOrdering); +} + +MachineMemOperand *MachineFunction::getMachineMemOperand( const MachineMemOperand *MMO, const MachinePointerInfo &PtrInfo, uint64_t Size) { return new (Allocator) MachineMemOperand(PtrInfo, MMO->getFlags(), Size, MMO->getBaseAlign(), @@ -445,9 +455,17 @@ MachineMemOperand *MachineFunction::getMachineMemOperand( MMO->getSuccessOrdering(), MMO->getFailureOrdering()); } +MachineMemOperand *MachineFunction::getMachineMemOperand( + const MachineMemOperand *MMO, const MachinePointerInfo &PtrInfo, LLT Ty) { + return new (Allocator) + MachineMemOperand(PtrInfo, MMO->getFlags(), Ty, MMO->getBaseAlign(), + AAMDNodes(), nullptr, MMO->getSyncScopeID(), + MMO->getSuccessOrdering(), MMO->getFailureOrdering()); +} + MachineMemOperand * MachineFunction::getMachineMemOperand(const MachineMemOperand *MMO, - int64_t Offset, uint64_t Size) { + int64_t Offset, LLT Ty) { const MachinePointerInfo &PtrInfo = MMO->getPointerInfo(); // If there is no pointer value, the offset isn't tracked so we need to adjust @@ -459,7 +477,7 @@ MachineFunction::getMachineMemOperand(const MachineMemOperand *MMO, // Do not preserve ranges, since we don't necessarily know what the high bits // are anymore. return new (Allocator) MachineMemOperand( - PtrInfo.getWithOffset(Offset), MMO->getFlags(), Size, Alignment, + PtrInfo.getWithOffset(Offset), MMO->getFlags(), Ty, Alignment, MMO->getAAInfo(), nullptr, MMO->getSyncScopeID(), MMO->getSuccessOrdering(), MMO->getFailureOrdering()); } |