[llvm] r287680 - Add IntrInaccessibleMemOnly property for intrinsics
Andrew Kaylor via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 22 11:16:04 PST 2016
Author: akaylor
Date: Tue Nov 22 13:16:04 2016
New Revision: 287680
URL: http://llvm.org/viewvc/llvm-project?rev=287680&view=rev
Log:
Add IntrInaccessibleMemOnly property for intrinsics
Differential Revision: https://reviews.llvm.org/D26485
Modified:
llvm/trunk/include/llvm/IR/Intrinsics.td
llvm/trunk/utils/TableGen/CodeGenIntrinsics.h
llvm/trunk/utils/TableGen/CodeGenTarget.cpp
llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp
Modified: llvm/trunk/include/llvm/IR/Intrinsics.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Intrinsics.td?rev=287680&r1=287679&r2=287680&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Intrinsics.td (original)
+++ llvm/trunk/include/llvm/IR/Intrinsics.td Tue Nov 22 13:16:04 2016
@@ -43,6 +43,15 @@ def IntrWriteMem : IntrinsicProperty;
// reads from and (possibly volatile) writes to memory, it has no side effects.
def IntrArgMemOnly : IntrinsicProperty;
+// IntrInaccessibleMemOnly -- This intrinsic only accesses memory that is not
+// accessible by the module being compiled. This is a weaker form of IntrNoMem.
+def IntrInaccessibleMemOnly : IntrinsicProperty;
+
+// IntrInaccessibleMemOrArgMemOnly -- This intrinsic only accesses memory that
+// its pointer-typed arguments point to or memory that is not accessible
+// by the module being compiled. This is a weaker form of IntrArgMemOnly.
+def IntrInaccessibleMemOrArgMemOnly : IntrinsicProperty;
+
// Commutative - This intrinsic is commutative: X op Y == Y op X.
def Commutative : IntrinsicProperty;
Modified: llvm/trunk/utils/TableGen/CodeGenIntrinsics.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenIntrinsics.h?rev=287680&r1=287679&r2=287680&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenIntrinsics.h (original)
+++ llvm/trunk/utils/TableGen/CodeGenIntrinsics.h Tue Nov 22 13:16:04 2016
@@ -62,15 +62,23 @@ struct CodeGenIntrinsic {
/// accesses that may be performed by the intrinsics. Analogous to
/// \c FunctionModRefBehaviour.
enum ModRefBits {
+ /// The intrinsic may access memory that is otherwise inaccessible via
+ /// LLVM IR.
+ MR_InaccessibleMem = 1,
+
+ /// The intrinsic may access memory through pointer arguments.
+ /// LLVM IR.
+ MR_ArgMem = 2,
+
/// The intrinsic may access memory anywhere, i.e. it is not restricted
/// to access through pointer arguments.
- MR_Anywhere = 1,
+ MR_Anywhere = 4 | MR_ArgMem | MR_InaccessibleMem,
/// The intrinsic may read memory.
- MR_Ref = 2,
+ MR_Ref = 8,
/// The intrinsic may write memory.
- MR_Mod = 4,
+ MR_Mod = 16,
/// The intrinsic may both read and write memory.
MR_ModRef = MR_Ref | MR_Mod,
@@ -80,11 +88,18 @@ struct CodeGenIntrinsic {
/// properties (IntrReadMem, IntrArgMemOnly, etc.).
enum ModRefBehavior {
NoMem = 0,
- ReadArgMem = MR_Ref,
+ ReadArgMem = MR_Ref | MR_ArgMem,
+ ReadInaccessibleMem = MR_Ref | MR_InaccessibleMem,
+ ReadInaccessibleMemOrArgMem = MR_Ref | MR_ArgMem | MR_InaccessibleMem,
ReadMem = MR_Ref | MR_Anywhere,
- WriteArgMem = MR_Mod,
+ WriteArgMem = MR_Mod | MR_ArgMem,
+ WriteInaccessibleMem = MR_Mod | MR_InaccessibleMem,
+ WriteInaccessibleMemOrArgMem = MR_Mod | MR_ArgMem | MR_InaccessibleMem,
WriteMem = MR_Mod | MR_Anywhere,
- ReadWriteArgMem = MR_ModRef,
+ ReadWriteArgMem = MR_ModRef | MR_ArgMem,
+ ReadWriteInaccessibleMem = MR_ModRef | MR_InaccessibleMem,
+ ReadWriteInaccessibleMemOrArgMem = MR_ModRef | MR_ArgMem |
+ MR_InaccessibleMem,
ReadWriteMem = MR_ModRef | MR_Anywhere,
};
ModRefBehavior ModRef;
Modified: llvm/trunk/utils/TableGen/CodeGenTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenTarget.cpp?rev=287680&r1=287679&r2=287680&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenTarget.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenTarget.cpp Tue Nov 22 13:16:04 2016
@@ -593,7 +593,12 @@ CodeGenIntrinsic::CodeGenIntrinsic(Recor
else if (Property->getName() == "IntrWriteMem")
ModRef = ModRefBehavior(ModRef & ~MR_Ref);
else if (Property->getName() == "IntrArgMemOnly")
- ModRef = ModRefBehavior(ModRef & ~MR_Anywhere);
+ ModRef = ModRefBehavior((ModRef & ~MR_Anywhere) | MR_ArgMem);
+ else if (Property->getName() == "IntrInaccessibleMemOnly")
+ ModRef = ModRefBehavior((ModRef & ~MR_Anywhere) | MR_InaccessibleMem);
+ else if (Property->getName() == "IntrInaccessibleMemOrArgMemOnly")
+ ModRef = ModRefBehavior((ModRef & ~MR_Anywhere) | MR_ArgMem |
+ MR_InaccessibleMem);
else if (Property->getName() == "Commutative")
isCommutative = true;
else if (Property->getName() == "Throws")
Modified: llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp?rev=287680&r1=287679&r2=287680&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp Tue Nov 22 13:16:04 2016
@@ -646,6 +646,18 @@ void IntrinsicEmitter::EmitAttributes(co
OS << ",";
OS << "Attribute::ReadOnly";
break;
+ case CodeGenIntrinsic::ReadInaccessibleMem:
+ if (addComma)
+ OS << ",";
+ OS << "Attribute::ReadOnly,";
+ OS << "Attribute::InaccessibleMemOnly";
+ break;
+ case CodeGenIntrinsic::ReadInaccessibleMemOrArgMem:
+ if (addComma)
+ OS << ",";
+ OS << "Attribute::ReadOnly,";
+ OS << "Attribute::InaccessibleMemOrArgMemOnly";
+ break;
case CodeGenIntrinsic::WriteArgMem:
if (addComma)
OS << ",";
@@ -657,11 +669,32 @@ void IntrinsicEmitter::EmitAttributes(co
OS << ",";
OS << "Attribute::WriteOnly";
break;
+ case CodeGenIntrinsic::WriteInaccessibleMem:
+ if (addComma)
+ OS << ",";
+ OS << "Attribute::WriteOnly,";
+ OS << "Attribute::InaccessibleMemOnly";
+ break;
+ case CodeGenIntrinsic::WriteInaccessibleMemOrArgMem:
+ if (addComma)
+ OS << ",";
+ OS << "Attribute::WriteOnly,";
+ OS << "Attribute::InaccessibleMemOrArgOnly";
+ break;
case CodeGenIntrinsic::ReadWriteArgMem:
if (addComma)
OS << ",";
OS << "Attribute::ArgMemOnly";
break;
+ case CodeGenIntrinsic::ReadWriteInaccessibleMem:
+ if (addComma)
+ OS << ",";
+ OS << "Attribute::InaccessibleMemOnly";
+ break;
+ case CodeGenIntrinsic::ReadWriteInaccessibleMemOrArgMem:
+ if (addComma)
+ OS << ",";
+ OS << "Attribute::InaccessibleMemOrArgMemOnly";
case CodeGenIntrinsic::ReadWriteMem:
break;
}
More information about the llvm-commits
mailing list