mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 04:02:41 +01:00
[TableGen] Add IntrNoMerge as intrinsic property
There is a function attribute 'nomerge' in addition to 'noduplicate' and 'convergent'. Both 'noduplicate' and 'convergent' have corresponding intrinsic properties. This patch adds an intrinsic property for the 'nomerge' attribute. Differential Revision: https://reviews.llvm.org/D96364
This commit is contained in:
parent
97dc903cfa
commit
1e0e652e78
@ -134,10 +134,14 @@ def IntrWillReturn : IntrinsicProperty<1>;
|
|||||||
// Parallels the cold attribute on LLVM IR functions.
|
// Parallels the cold attribute on LLVM IR functions.
|
||||||
def IntrCold : IntrinsicProperty;
|
def IntrCold : IntrinsicProperty;
|
||||||
|
|
||||||
// IntrNoduplicate - Calls to this intrinsic cannot be duplicated.
|
// IntrNoDuplicate - Calls to this intrinsic cannot be duplicated.
|
||||||
// Parallels the noduplicate attribute on LLVM IR functions.
|
// Parallels the noduplicate attribute on LLVM IR functions.
|
||||||
def IntrNoDuplicate : IntrinsicProperty;
|
def IntrNoDuplicate : IntrinsicProperty;
|
||||||
|
|
||||||
|
// IntrNoMerge - Calls to this intrinsic cannot be merged
|
||||||
|
// Parallels the nomerge attribute on LLVM IR functions.
|
||||||
|
def IntrNoMerge : IntrinsicProperty;
|
||||||
|
|
||||||
// IntrConvergent - Calls to this intrinsic are convergent and may not be made
|
// IntrConvergent - Calls to this intrinsic are convergent and may not be made
|
||||||
// control-dependent on any additional values.
|
// control-dependent on any additional values.
|
||||||
// Parallels the convergent attribute on LLVM IR functions.
|
// Parallels the convergent attribute on LLVM IR functions.
|
||||||
|
24
test/TableGen/intrin-properties.td
Normal file
24
test/TableGen/intrin-properties.td
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
// RUN: sed -e 's/<PROP>/ArgMemOnly/;s/<ATTR>/ArgMemOnly/' < %s > %t; llvm-tblgen -gen-intrinsic-impl -I %p/../../include %t | FileCheck %t
|
||||||
|
// RUN: sed -e 's/<PROP>/Cold/;s/<ATTR>/Cold/' < %s > %t; llvm-tblgen -gen-intrinsic-impl -I %p/../../include %t | FileCheck %t
|
||||||
|
// RUN: sed -e 's/<PROP>/Convergent/;s/<ATTR>/Convergent/' < %s > %t; llvm-tblgen -gen-intrinsic-impl -I %p/../../include %t | FileCheck %t
|
||||||
|
// RUN: sed -e 's/<PROP>/InaccessibleMemOnly/;s/<ATTR>/InaccessibleMemOnly/' < %s > %t; llvm-tblgen -gen-intrinsic-impl -I %p/../../include %t | FileCheck %t
|
||||||
|
// RUN: sed -e 's/<PROP>/InaccessibleMemOrArgMemOnly/;s/<ATTR>/InaccessibleMemOrArgMemOnly/' < %s > %t; llvm-tblgen -gen-intrinsic-impl -I %p/../../include %t | FileCheck %t
|
||||||
|
// RUN: sed -e 's/<PROP>/NoDuplicate/;s/<ATTR>/NoDuplicate/' < %s > %t; llvm-tblgen -gen-intrinsic-impl -I %p/../../include %t | FileCheck %t
|
||||||
|
// RUN: sed -e 's/<PROP>/NoFree/;s/<ATTR>/NoFree/' < %s > %t; llvm-tblgen -gen-intrinsic-impl -I %p/../../include %t | FileCheck %t
|
||||||
|
// RUN: sed -e 's/<PROP>/NoMem/;s/<ATTR>/ReadNone/' < %s > %t; llvm-tblgen -gen-intrinsic-impl -I %p/../../include %t | FileCheck %t
|
||||||
|
// RUN: sed -e 's/<PROP>/NoMerge/;s/<ATTR>/NoMerge/' < %s > %t; llvm-tblgen -gen-intrinsic-impl -I %p/../../include %t | FileCheck %t
|
||||||
|
// RUN: sed -e 's/<PROP>/NoReturn/;s/<ATTR>/NoReturn/' < %s > %t; llvm-tblgen -gen-intrinsic-impl -I %p/../../include %t | FileCheck %t
|
||||||
|
// RUN: sed -e 's/<PROP>/NoSync/;s/<ATTR>/NoSync/' < %s > %t; llvm-tblgen -gen-intrinsic-impl -I %p/../../include %t | FileCheck %t
|
||||||
|
// RUN: sed -e 's/<PROP>/ReadMem/;s/<ATTR>/ReadOnly/' < %s > %t; llvm-tblgen -gen-intrinsic-impl -I %p/../../include %t | FileCheck %t
|
||||||
|
// RUN: sed -e 's/<PROP>/Speculatable/;s/<ATTR>/Speculatable/' < %s > %t; llvm-tblgen -gen-intrinsic-impl -I %p/../../include %t | FileCheck %t
|
||||||
|
// RUN: sed -e 's/<PROP>/WillReturn/;s/<ATTR>/WillReturn/' < %s > %t; llvm-tblgen -gen-intrinsic-impl -I %p/../../include %t | FileCheck %t
|
||||||
|
// RUN: sed -e 's/<PROP>/WriteMem/;s/<ATTR>/WriteOnly/' < %s > %t; llvm-tblgen -gen-intrinsic-impl -I %p/../../include %t | FileCheck %t
|
||||||
|
|
||||||
|
include "llvm/IR/Intrinsics.td"
|
||||||
|
|
||||||
|
// CHECK: [[I:[0-9]+]], // llvm.tgtest.Intr<PROP>
|
||||||
|
// CHECK: case [[I]]:
|
||||||
|
// CHECK-NEXT: Atts[] = {{.*}}Attribute::<ATTR>
|
||||||
|
def int_tgtest_Intr<PROP>:
|
||||||
|
Intrinsic<[llvm_i32_ty], [llvm_ptr_ty], [Intr<PROP>]>;
|
||||||
|
|
@ -120,6 +120,9 @@ struct CodeGenIntrinsic {
|
|||||||
/// True if the intrinsic is marked as noduplicate.
|
/// True if the intrinsic is marked as noduplicate.
|
||||||
bool isNoDuplicate;
|
bool isNoDuplicate;
|
||||||
|
|
||||||
|
/// True if the intrinsic is marked as nomerge.
|
||||||
|
bool isNoMerge;
|
||||||
|
|
||||||
/// True if the intrinsic is no-return.
|
/// True if the intrinsic is no-return.
|
||||||
bool isNoReturn;
|
bool isNoReturn;
|
||||||
|
|
||||||
|
@ -656,6 +656,7 @@ CodeGenIntrinsic::CodeGenIntrinsic(Record *R,
|
|||||||
isWillReturn = false;
|
isWillReturn = false;
|
||||||
isCold = false;
|
isCold = false;
|
||||||
isNoDuplicate = false;
|
isNoDuplicate = false;
|
||||||
|
isNoMerge = false;
|
||||||
isConvergent = false;
|
isConvergent = false;
|
||||||
isSpeculatable = false;
|
isSpeculatable = false;
|
||||||
hasSideEffects = false;
|
hasSideEffects = false;
|
||||||
@ -845,6 +846,8 @@ void CodeGenIntrinsic::setProperty(Record *R) {
|
|||||||
canThrow = true;
|
canThrow = true;
|
||||||
else if (R->getName() == "IntrNoDuplicate")
|
else if (R->getName() == "IntrNoDuplicate")
|
||||||
isNoDuplicate = true;
|
isNoDuplicate = true;
|
||||||
|
else if (R->getName() == "IntrNoMerge")
|
||||||
|
isNoMerge = true;
|
||||||
else if (R->getName() == "IntrConvergent")
|
else if (R->getName() == "IntrConvergent")
|
||||||
isConvergent = true;
|
isConvergent = true;
|
||||||
else if (R->getName() == "IntrNoReturn")
|
else if (R->getName() == "IntrNoReturn")
|
||||||
|
@ -584,6 +584,9 @@ struct AttributeComparator {
|
|||||||
if (L->isNoDuplicate != R->isNoDuplicate)
|
if (L->isNoDuplicate != R->isNoDuplicate)
|
||||||
return R->isNoDuplicate;
|
return R->isNoDuplicate;
|
||||||
|
|
||||||
|
if (L->isNoMerge != R->isNoMerge)
|
||||||
|
return R->isNoMerge;
|
||||||
|
|
||||||
if (L->isNoReturn != R->isNoReturn)
|
if (L->isNoReturn != R->isNoReturn)
|
||||||
return R->isNoReturn;
|
return R->isNoReturn;
|
||||||
|
|
||||||
@ -739,7 +742,8 @@ void IntrinsicEmitter::EmitAttributes(const CodeGenIntrinsicTable &Ints,
|
|||||||
!intrinsic.hasSideEffects) ||
|
!intrinsic.hasSideEffects) ||
|
||||||
intrinsic.isNoReturn || intrinsic.isNoSync || intrinsic.isNoFree ||
|
intrinsic.isNoReturn || intrinsic.isNoSync || intrinsic.isNoFree ||
|
||||||
intrinsic.isWillReturn || intrinsic.isCold || intrinsic.isNoDuplicate ||
|
intrinsic.isWillReturn || intrinsic.isCold || intrinsic.isNoDuplicate ||
|
||||||
intrinsic.isConvergent || intrinsic.isSpeculatable) {
|
intrinsic.isNoMerge || intrinsic.isConvergent ||
|
||||||
|
intrinsic.isSpeculatable) {
|
||||||
OS << " const Attribute::AttrKind Atts[] = {";
|
OS << " const Attribute::AttrKind Atts[] = {";
|
||||||
ListSeparator LS(",");
|
ListSeparator LS(",");
|
||||||
if (!intrinsic.canThrow)
|
if (!intrinsic.canThrow)
|
||||||
@ -756,6 +760,8 @@ void IntrinsicEmitter::EmitAttributes(const CodeGenIntrinsicTable &Ints,
|
|||||||
OS << LS << "Attribute::Cold";
|
OS << LS << "Attribute::Cold";
|
||||||
if (intrinsic.isNoDuplicate)
|
if (intrinsic.isNoDuplicate)
|
||||||
OS << LS << "Attribute::NoDuplicate";
|
OS << LS << "Attribute::NoDuplicate";
|
||||||
|
if (intrinsic.isNoMerge)
|
||||||
|
OS << LS << "Attribute::NoMerge";
|
||||||
if (intrinsic.isConvergent)
|
if (intrinsic.isConvergent)
|
||||||
OS << LS << "Attribute::Convergent";
|
OS << LS << "Attribute::Convergent";
|
||||||
if (intrinsic.isSpeculatable)
|
if (intrinsic.isSpeculatable)
|
||||||
|
Loading…
Reference in New Issue
Block a user