TargetIntrinsicInfo.h revision 193323
1//===-- llvm/Target/TargetIntrinsicInfo.h - Instruction Info ----*- C++ -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file describes the target intrinsic instructions to the code generator.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_TARGET_TARGETINTRINSICINFO_H
15#define LLVM_TARGET_TARGETINTRINSICINFO_H
16
17namespace llvm {
18
19class Function;
20class Module;
21class Type;
22
23//---------------------------------------------------------------------------
24///
25/// TargetIntrinsicInfo - Interface to description of machine instruction set
26///
27class TargetIntrinsicInfo {
28
29  const char **Intrinsics;               // Raw array to allow static init'n
30  unsigned NumIntrinsics;                // Number of entries in the desc array
31
32  TargetIntrinsicInfo(const TargetIntrinsicInfo &);  // DO NOT IMPLEMENT
33  void operator=(const TargetIntrinsicInfo &);   // DO NOT IMPLEMENT
34public:
35  TargetIntrinsicInfo(const char **desc, unsigned num);
36  virtual ~TargetIntrinsicInfo();
37
38  unsigned getNumIntrinsics() const { return NumIntrinsics; }
39
40  virtual Function *getDeclaration(Module *M, const char *BuiltinName) const {
41    return 0;
42  }
43
44  // Returns the Function declaration for intrinsic BuiltinName.  If the
45  // intrinsic can be overloaded, uses Tys to return the correct function.
46  virtual Function *getDeclaration(Module *M, const char *BuiltinName,
47                                   const Type **Tys, unsigned numTys) const {
48    return 0;
49  }
50
51  // Returns true if the Builtin can be overloaded.
52  virtual bool isOverloaded(Module *M, const char *BuiltinName) const {
53    return false;
54  }
55
56  virtual unsigned getIntrinsicID(Function *F) const { return 0; }
57};
58
59} // End llvm namespace
60
61#endif
62