1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00
llvm-mirror/test/TableGen/intrin-side-effects.td
Momchil Velikov 2e592185f9 [TableGen] Do not set ReadNone attribute on intrinsics with side effects
If an intrinsic is defined without outputs, but having side effects,
it still can be removed completely from the program. This patch makes
TableGen not set Attribute::ReadNone for intrinsics which
are declared with IntrHasSideEffects.

Differential Revision: https://reviews.llvm.org/D64414

llvm-svn: 366312
2019-07-17 10:53:13 +00:00

40 lines
1.1 KiB
TableGen

// RUN: llvm-tblgen -gen-intrinsic-impl -I %p/../../include %s | FileCheck %s
// Get the minimum blurb necessary to process ...
include "llvm/CodeGen/ValueTypes.td"
include "llvm/CodeGen/SDNodeProperties.td"
class LLVMType<ValueType vt> {
ValueType VT = vt;
int isAny = 0;
}
def llvm_i32_ty : LLVMType<i32>;
class IntrinsicProperty;
def IntrNoMem : IntrinsicProperty;
def IntrHasSideEffects : IntrinsicProperty;
class Intrinsic<list<LLVMType> ret_types,
list<LLVMType> param_types = [],
list<IntrinsicProperty> intr_properties = [],
string name = "",
list<SDNodeProperty> sd_properties = []> : SDPatternOperator {
string LLVMName = name;
string TargetPrefix = "";
list<LLVMType> RetTypes = ret_types;
list<LLVMType> ParamTypes = param_types;
list<IntrinsicProperty> IntrProperties = intr_properties;
let Properties = sd_properties;
bit isTarget = 0;
}
// ... this intrinsic.
def int_random_gen : Intrinsic<[llvm_i32_ty], [], [IntrNoMem, IntrHasSideEffects]>;
// CHECK: 1, // llvm.random.gen
// CHECK: case 1:
// CHECK-NEXT: Atts[] = {Attribute::NoUnwind}