41aa3ed5314589de5246ce4fdb982afabe014394
[oota-llvm.git] / include / llvm / Intrinsics.h
1 //===-- llvm/Instrinsics.h - LLVM Intrinsic Function Handling ---*- C++ -*-===//
2 // 
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
7 // 
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines a set of enums which allow processing of intrinsic
11 // functions.  Values of these enum types are returned by
12 // Function::getIntrinsicID.
13 //
14 //===----------------------------------------------------------------------===//
15
16 #ifndef LLVM_INTRINSICS_H
17 #define LLVM_INTRINSICS_H
18
19 namespace llvm {
20
21 /// Intrinsic Namespace - This namespace contains an enum with a value for
22 /// every intrinsic/builtin function known by LLVM.  These enum values are
23 /// returned by Function::getIntrinsicID().
24 ///
25 namespace Intrinsic {
26   enum ID {
27     not_intrinsic = 0,   // Must be zero
28
29     // Varargs handling intrinsics...
30     vastart,        // Used to implement the va_start macro in C
31     vaend,          // Used to implement the va_end macro in C
32     vacopy,         // Used to implement the va_copy macro in C
33
34     // Code generator intrinsics...
35     returnaddress,  // Yields the return address of a dynamic call frame
36     frameaddress,   // Yields the frame address of a dynamic call frame
37
38     // Standard libc functions...
39     memcpy,         // Copy non-overlapping memory blocks
40     memmove,        // Copy potentially overlapping memory blocks
41     memset,         // Fill memory with a byte value
42
43     // Setjmp/Longjmp intrinsics...
44     setjmp,         // Used to represent a setjmp call in C
45     longjmp,        // Used to represent a longjmp call in C
46     sigsetjmp,      // Used to represent a sigsetjmp call in C
47     siglongjmp,     // Used to represent a siglongjmp call in C
48
49     // Debugging intrinsics...
50     dbg_stoppoint,    // Represents source lines and breakpointable places
51     dbg_region_start, // Start of a region
52     dbg_region_end,   // End of a region
53     dbg_func_start,   // Start of a function
54     dbg_declare,      // Declare a local object
55
56
57     // Standard libm functions...
58     
59
60     // Input/Output intrinsics
61     readport,
62     writeport,
63     readio,
64     writeio,
65
66     //===------------------------------------------------------------------===//
67     // This section defines intrinsic functions used to represent Alpha
68     // instructions...
69     //
70     alpha_ctlz,     // CTLZ (count leading zero): counts the number of leading
71                     // zeros in the given ulong value
72
73     alpha_cttz,     // CTTZ (count trailing zero): counts the number of trailing
74                     // zeros in the given ulong value 
75
76     alpha_ctpop,    // CTPOP (count population): counts the number of ones in
77                     // the given ulong value 
78
79     alpha_umulh,    // UMULH (unsigned multiply quadword high): Takes two 64-bit
80                     // (ulong) values, and returns the upper 64 bits of their
81                     // 128 bit product as a ulong
82
83     alpha_vecop,    // A generic vector operation. This function is used to
84                     // represent various Alpha vector/multimedia instructions.
85                     // It takes 4 parameters:
86                     //  - the first two are 2 ulong vectors
87                     //  - the third (uint) is the size (in bytes) of each 
88                     //    vector element. Thus a value of 1 means that the two
89                     //    input vectors consist of 8 bytes
90                     //  - the fourth (uint) is the operation to be performed on
91                     //    the vectors. Its possible values are defined in the
92                     //    enumeration AlphaVecOps.
93
94     alpha_pup,      // A pack/unpack operation. This function is used to
95                     // represent Alpha pack/unpack operations. 
96                     // It takes 3 parameters:
97                     //  - the first is an ulong to pack/unpack
98                     //  - the second (uint) is the size of each component
99                     //    Valid values are 2 (word) or 4 (longword)
100                     //  - the third (uint) is the operation to be performed.
101                     //    Possible values defined in the enumeration 
102                     //    AlphaPupOps
103
104     alpha_bytezap,  // This intrinsic function takes two parameters: a ulong 
105                     // (64-bit) value and a ubyte value, and returns a ulong.
106                     // Each bit in the ubyte corresponds to a byte in the 
107                     // ulong. If the bit is 0, the byte in the output equals
108                     // the corresponding byte in the input, else the byte in
109                     // the output is zero.
110
111     alpha_bytemanip,// This intrinsic function represents all Alpha byte
112                     // manipulation instructions. It takes 3 parameters:
113                     //  - The first two are ulong inputs to operate on
114                     //  - The third (uint) is the operation to perform. 
115                     //    Possible values defined in the enumeration
116                     //    AlphaByteManipOps
117
118     alpha_dfpbop,   // This intrinsic function represents Alpha instructions
119                     // that operate on two doubles and return a double. The
120                     // first two parameters are the two double values to
121                     // operate on, and the third is a uint that specifies the
122                     // operation to perform. Its possible values are defined in
123                     // the enumeration AlphaFloatingBinaryOps
124
125     alpha_dfpuop,   // This intrinsic function represents operation on a single
126                     // double precision floating point value. The first 
127                     // paramters is the value and the second is the operation.
128                     // The possible values for the operations are defined in the
129                     // enumeration AlphaFloatingUnaryOps
130
131     alpha_unordered,// This intrinsic function tests if two double precision
132                     // floating point values are unordered. It has two
133                     // parameters: the two values to be tested. It return a
134                     // boolean true if the two are unordered, else false.
135
136     alpha_uqtodfp,  // A generic function that converts a ulong to a double.
137                     // How the conversion is performed is specified by the
138                     // second parameter, the possible values for which are
139                     // defined in the AlphaUqToDfpOps enumeration
140
141     alpha_uqtosfp,  // A generic function that converts a ulong to a float.
142                     // How the conversion is performed is specified by the
143                     // second parameter, the possible values for which are
144                     // defined in the AlphaUqToSfpOps enumeration
145
146     alpha_dfptosq,  // A generic function that converts double to a long.
147                     // How the conversion is performed is specified by the
148                     // second parameter, the possible values for which are
149                     // defined in the AlphaDfpToSqOps enumeration
150
151     alpha_sfptosq,  // A generic function that converts a float to a long.
152                     // How the conversion is performed is specified by the
153                     // second parameter, the possible values for which are
154                     // defined in the AlphaSfpToSq enumeration
155   };
156
157 } // End Intrinsic namespace
158
159 } // End llvm namespace
160
161 #endif