• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: llvm-tblgen -gen-intrinsic-impl -I %p/../../include %s | FileCheck %s
2
3// Get the minimum blurb necessary to process ...
4include "llvm/CodeGen/ValueTypes.td"
5include "llvm/CodeGen/SDNodeProperties.td"
6
7class LLVMType<ValueType vt> {
8  ValueType VT = vt;
9  int isAny = 0;
10}
11
12def llvm_i32_ty        : LLVMType<i32>;
13
14class IntrinsicProperty<bit is_default = 0> {
15  bit IsDefault = is_default;
16}
17
18def IntrNoMem : IntrinsicProperty;
19def IntrHasSideEffects : IntrinsicProperty;
20
21class Intrinsic<list<LLVMType> ret_types,
22                list<LLVMType> param_types = [],
23                list<IntrinsicProperty> intr_properties = [],
24                string name = "",
25                list<SDNodeProperty> sd_properties = [],
26                bit disable_default_attributes = 0> : SDPatternOperator {
27  string LLVMName = name;
28  string TargetPrefix = "";
29  list<LLVMType> RetTypes = ret_types;
30  list<LLVMType> ParamTypes = param_types;
31  list<IntrinsicProperty> IntrProperties = intr_properties;
32  let Properties = sd_properties;
33  bit DisableDefaultAttributes = 1;
34
35
36  bit isTarget = 0;
37  bit DisableDefaultAttributes = disable_default_attributes;
38}
39
40// ... this intrinsic.
41def int_random_gen   : Intrinsic<[llvm_i32_ty], [], [IntrNoMem, IntrHasSideEffects]>;
42
43// CHECK: 1, // llvm.random.gen
44// CHECK: case 1:
45// CHECK-NEXT: Atts[] = {Attribute::NoUnwind}
46