- // Bit manipulation instrinsics.
- bswap_i16, // Byteswap 16 bits
- bswap_i32, // Byteswap 32 bits
- bswap_i64, // Byteswap 64 bits
- ctpop_i8, // Count population of sbyte
- ctpop_i16, // Count population of short
- ctpop_i32, // Count population of int
- ctpop_i64, // Count population of long
- ctlz_i8, // Count leading zeros of sbyte
- ctlz_i16, // Count leading zeros of short
- ctlz_i32, // Count leading zeros of int
- ctlz_i64, // Count leading zeros of long
- cttz_i8, // Count trailing zeros of sbyte
- cttz_i16, // Count trailing zeros of short
- cttz_i32, // Count trailing zeros of int
- cttz_i64, // Count trailing zeros of long
+ /// Intrinsic::getDeclaration(M, ID) - Create or insert an LLVM Function
+ /// declaration for an intrinsic, and return it.
+ ///
+ /// The Tys and numTys parameters are for intrinsics with overloaded types
+ /// (e.g., those using iAny, fAny, vAny, or iPTRAny). For a declaration for an
+ /// overloaded intrinsic, Tys should point to an array of numTys pointers to
+ /// Type, and must provide exactly one type for each overloaded type in the
+ /// intrinsic.
+ Function *getDeclaration(Module *M, ID id,
+ ArrayRef<Type*> Tys = ArrayRef<Type*>());
+
+ /// Map a GCC builtin name to an intrinsic ID.
+ ID getIntrinsicForGCCBuiltin(const char *Prefix, const char *BuiltinName);
+
+ /// IITDescriptor - This is a type descriptor which explains the type
+ /// requirements of an intrinsic. This is returned by
+ /// getIntrinsicInfoTableEntries.
+ struct IITDescriptor {
+ enum IITDescriptorKind {
+ Void, MMX, Metadata, Float, Double,
+ Integer, Vector, Pointer, Struct,
+ Argument, ExtendVecArgument, TruncVecArgument
+ } Kind;
+
+ union {
+ unsigned Integer_Width;
+ unsigned Float_Width;
+ unsigned Vector_Width;
+ unsigned Pointer_AddressSpace;
+ unsigned Struct_NumElements;
+ unsigned Argument_Info;
+ };
+
+ enum ArgKind {
+ AK_AnyInteger,
+ AK_AnyFloat,
+ AK_AnyVector,
+ AK_AnyPointer
+ };
+ unsigned getArgumentNumber() const {
+ assert(Kind == Argument);
+ return Argument_Info >> 2;
+ }
+ ArgKind getArgumentKind() const {
+ assert(Kind == Argument);
+ return (ArgKind)(Argument_Info&3);
+ }
+
+ static IITDescriptor get(IITDescriptorKind K, unsigned Field) {
+ IITDescriptor Result = { K, { Field } };
+ return Result;
+ }