diff options
| author | Tom Stellard <thomas.stellard@amd.com> | 2016-12-17 04:41:53 +0000 |
|---|---|---|
| committer | Tom Stellard <thomas.stellard@amd.com> | 2016-12-17 04:41:53 +0000 |
| commit | 7761abb64a03d7a4dda6d8cc0e25dfe0ab67ab14 (patch) | |
| tree | 976d3eb23856a9218ae2bc71bae0973b8d5dd235 | |
| parent | 63d2e2d8a8c83738885b63bfeedcad59a940460a (diff) | |
| download | bcm5719-llvm-7761abb64a03d7a4dda6d8cc0e25dfe0ab67ab14.tar.gz bcm5719-llvm-7761abb64a03d7a4dda6d8cc0e25dfe0ab67ab14.zip | |
Add custom type for PseudoSourceValue
Summary:
PseudoSourceValue can be used to attach a target specific value for "well behaved" side-effects lowered from target specific intrinsics.
This is useful whenever there is not an LLVM IR Value around when representing such "well behaved" side-effected operations in backends by attaching a MachineMemOperand with a custom PseudoSourceValue as this makes the scheduler not treating them as "GlobalMemoryObjects" which triggers a logic that makes the operation act like a barrier in the Schedule DAG.
This patch adds another Kind to the PseudoSourceValue object which is "TargetCustom". It indicates a type of PseudoSourceValue that has a target specific meaning (aka. LLVM shouldn't assume any specific usage for such a PSV).
It supports the possibility of having many different kinds of "TargetCustom" PseudoSourceValues.
We had a discussion about if this was valuable or not (in particular because there was a believe that PSV were going away sooner or later) but seems like they are not going anywhere and I think they are useful backend side.
It is not clear the interaction of this with MIRParser (do we need a target hook to parse these?) and I would like a comment from Alex about that :)
Reviewers: arphaman, hfinkel, arsenm
Subscribers: Eugene.Zelenko, llvm-commits
Patch By: Marcello Maggioni
Differential Revision: https://reviews.llvm.org/D13575
llvm-svn: 290037
| -rw-r--r-- | llvm/include/llvm/CodeGen/PseudoSourceValue.h | 6 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/MIRPrinter.cpp | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/llvm/include/llvm/CodeGen/PseudoSourceValue.h b/llvm/include/llvm/CodeGen/PseudoSourceValue.h index c3f6fde9fb3..681ccb4b997 100644 --- a/llvm/include/llvm/CodeGen/PseudoSourceValue.h +++ b/llvm/include/llvm/CodeGen/PseudoSourceValue.h @@ -42,7 +42,8 @@ public: ConstantPool, FixedStack, GlobalValueCallEntry, - ExternalSymbolCallEntry + ExternalSymbolCallEntry, + TargetCustom }; private: @@ -67,6 +68,9 @@ public: bool isGOT() const { return Kind == GOT; } bool isConstantPool() const { return Kind == ConstantPool; } bool isJumpTable() const { return Kind == JumpTable; } + unsigned getTargetCustom() const { + return (Kind >= TargetCustom) ? ((Kind+1) - TargetCustom) : 0; + } /// Test whether the memory pointed to by this PseudoSourceValue has a /// constant value. diff --git a/llvm/lib/CodeGen/MIRPrinter.cpp b/llvm/lib/CodeGen/MIRPrinter.cpp index ec9414b63c1..eb13d2d3ec0 100644 --- a/llvm/lib/CodeGen/MIRPrinter.cpp +++ b/llvm/lib/CodeGen/MIRPrinter.cpp @@ -960,6 +960,9 @@ void MIPrinter::print(const MachineMemOperand &Op) { printLLVMNameWithoutPrefix( OS, cast<ExternalSymbolPseudoSourceValue>(PVal)->getSymbol()); break; + case PseudoSourceValue::TargetCustom: + llvm_unreachable("TargetCustom pseudo source values are not supported"); + break; } } printOffset(Op.getOffset()); |

