Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:36

0001 //===-- llvm/Target/TargetIntrinsicInfo.h - Instruction Info ----*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // This file describes the target intrinsic instructions to the code generator.
0010 //
0011 //===----------------------------------------------------------------------===//
0012 
0013 #ifndef LLVM_TARGET_TARGETINTRINSICINFO_H
0014 #define LLVM_TARGET_TARGETINTRINSICINFO_H
0015 
0016 #include "llvm/ADT/StringRef.h"
0017 #include <string>
0018 
0019 namespace llvm {
0020 
0021 class Function;
0022 class Module;
0023 class Type;
0024 
0025 //---------------------------------------------------------------------------
0026 ///
0027 /// TargetIntrinsicInfo - Interface to description of machine instruction set
0028 ///
0029 class TargetIntrinsicInfo {
0030   TargetIntrinsicInfo(const TargetIntrinsicInfo &) = delete;
0031   void operator=(const TargetIntrinsicInfo &) = delete;
0032 public:
0033   TargetIntrinsicInfo();
0034   virtual ~TargetIntrinsicInfo();
0035 
0036   /// Return the name of a target intrinsic, e.g. "llvm.bfin.ssync".
0037   /// The Tys and numTys parameters are for intrinsics with overloaded types
0038   /// (e.g., those using iAny or fAny). For a declaration for an overloaded
0039   /// intrinsic, Tys should point to an array of numTys pointers to Type,
0040   /// and must provide exactly one type for each overloaded type in the
0041   /// intrinsic.
0042   virtual std::string getName(unsigned IID, Type **Tys = nullptr,
0043                               unsigned numTys = 0) const = 0;
0044 
0045   /// Look up target intrinsic by name. Return intrinsic ID or 0 for unknown
0046   /// names.
0047   virtual unsigned lookupName(const char *Name, unsigned Len) const =0;
0048 
0049   unsigned lookupName(StringRef Name) const {
0050     return lookupName(Name.data(), Name.size());
0051   }
0052 
0053   /// Return the target intrinsic ID of a function, or 0.
0054   virtual unsigned getIntrinsicID(const Function *F) const;
0055 
0056   /// Returns true if the intrinsic can be overloaded.
0057   virtual bool isOverloaded(unsigned IID) const = 0;
0058 
0059   /// Create or insert an LLVM Function declaration for an intrinsic,
0060   /// and return it. The Tys and numTys are for intrinsics with overloaded
0061   /// types. See above for more information.
0062   virtual Function *getDeclaration(Module *M, unsigned ID, Type **Tys = nullptr,
0063                                    unsigned numTys = 0) const = 0;
0064 };
0065 
0066 } // End llvm namespace
0067 
0068 #endif