1193323Sed//===-- llvm/Target/TargetIntrinsicInfo.h - Instruction Info ----*- C++ -*-===//
2193323Sed//
3193323Sed//                     The LLVM Compiler Infrastructure
4193323Sed//
5193323Sed// This file is distributed under the University of Illinois Open Source
6193323Sed// License. See LICENSE.TXT for details.
7193323Sed//
8193323Sed//===----------------------------------------------------------------------===//
9193323Sed//
10193323Sed// This file describes the target intrinsic instructions to the code generator.
11193323Sed//
12193323Sed//===----------------------------------------------------------------------===//
13193323Sed
14193323Sed#ifndef LLVM_TARGET_TARGETINTRINSICINFO_H
15193323Sed#define LLVM_TARGET_TARGETINTRINSICINFO_H
16193323Sed
17245431Sdim#include "llvm/Support/Compiler.h"
18198953Srdivacky#include <string>
19198953Srdivacky
20193323Sednamespace llvm {
21193323Sed
22193323Sedclass Function;
23193323Sedclass Module;
24193323Sedclass Type;
25193323Sed
26193323Sed//---------------------------------------------------------------------------
27193323Sed///
28193323Sed/// TargetIntrinsicInfo - Interface to description of machine instruction set
29193323Sed///
30193323Sedclass TargetIntrinsicInfo {
31245431Sdim  TargetIntrinsicInfo(const TargetIntrinsicInfo &) LLVM_DELETED_FUNCTION;
32245431Sdim  void operator=(const TargetIntrinsicInfo &) LLVM_DELETED_FUNCTION;
33193323Sedpublic:
34198396Srdivacky  TargetIntrinsicInfo();
35193323Sed  virtual ~TargetIntrinsicInfo();
36193323Sed
37198396Srdivacky  /// Return the name of a target intrinsic, e.g. "llvm.bfin.ssync".
38198953Srdivacky  /// The Tys and numTys parameters are for intrinsics with overloaded types
39198953Srdivacky  /// (e.g., those using iAny or fAny). For a declaration for an overloaded
40198953Srdivacky  /// intrinsic, Tys should point to an array of numTys pointers to Type,
41198953Srdivacky  /// and must provide exactly one type for each overloaded type in the
42198953Srdivacky  /// intrinsic.
43226890Sdim  virtual std::string getName(unsigned IID, Type **Tys = 0,
44198953Srdivacky                              unsigned numTys = 0) const = 0;
45193323Sed
46198396Srdivacky  /// Look up target intrinsic by name. Return intrinsic ID or 0 for unknown
47198396Srdivacky  /// names.
48198396Srdivacky  virtual unsigned lookupName(const char *Name, unsigned Len) const =0;
49193323Sed
50198396Srdivacky  /// Return the target intrinsic ID of a function, or 0.
51198396Srdivacky  virtual unsigned getIntrinsicID(Function *F) const;
52198953Srdivacky
53198953Srdivacky  /// Returns true if the intrinsic can be overloaded.
54198953Srdivacky  virtual bool isOverloaded(unsigned IID) const = 0;
55198953Srdivacky
56198953Srdivacky  /// Create or insert an LLVM Function declaration for an intrinsic,
57198953Srdivacky  /// and return it. The Tys and numTys are for intrinsics with overloaded
58198953Srdivacky  /// types. See above for more information.
59226890Sdim  virtual Function *getDeclaration(Module *M, unsigned ID, Type **Tys = 0,
60198953Srdivacky                                   unsigned numTys = 0) const = 0;
61193323Sed};
62193323Sed
63193323Sed} // End llvm namespace
64193323Sed
65193323Sed#endif
66