LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AMDILIntrinsicInfo.cpp
Go to the documentation of this file.
1 //===- AMDILIntrinsicInfo.cpp - AMDGPU Intrinsic Information ------*- 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 /// \file
11 /// \brief AMDGPU Implementation of the IntrinsicInfo class.
12 //
13 //===-----------------------------------------------------------------------===//
14 
15 #include "AMDILIntrinsicInfo.h"
16 #include "AMDGPUSubtarget.h"
17 #include "llvm/IR/DerivedTypes.h"
18 #include "llvm/IR/Intrinsics.h"
19 #include "llvm/IR/Module.h"
20 
21 using namespace llvm;
22 
23 #define GET_LLVM_INTRINSIC_FOR_GCC_BUILTIN
24 #include "AMDGPUGenIntrinsics.inc"
25 #undef GET_LLVM_INTRINSIC_FOR_GCC_BUILTIN
26 
29 }
30 
31 std::string
32 AMDGPUIntrinsicInfo::getName(unsigned int IntrID, Type **Tys,
33  unsigned int numTys) const {
34  static const char* const names[] = {
35 #define GET_INTRINSIC_NAME_TABLE
36 #include "AMDGPUGenIntrinsics.inc"
37 #undef GET_INTRINSIC_NAME_TABLE
38  };
39 
40  if (IntrID < Intrinsic::num_intrinsics) {
41  return 0;
42  }
44  && "Invalid intrinsic ID");
45 
46  std::string Result(names[IntrID - Intrinsic::num_intrinsics]);
47  return Result;
48 }
49 
50 unsigned int
51 AMDGPUIntrinsicInfo::lookupName(const char *Name, unsigned int Len) const {
52  if (!StringRef(Name, Len).startswith("llvm."))
53  return 0; // All intrinsics start with 'llvm.'
54 
55 #define GET_FUNCTION_RECOGNIZER
56 #include "AMDGPUGenIntrinsics.inc"
57 #undef GET_FUNCTION_RECOGNIZER
58  AMDGPUIntrinsic::ID IntrinsicID
60  IntrinsicID = getIntrinsicForGCCBuiltin("AMDGPU", Name);
61 
62  if (IntrinsicID != (AMDGPUIntrinsic::ID)Intrinsic::not_intrinsic) {
63  return IntrinsicID;
64  }
65  return 0;
66 }
67 
68 bool
70  // Overload Table
71 #define GET_INTRINSIC_OVERLOAD_TABLE
72 #include "AMDGPUGenIntrinsics.inc"
73 #undef GET_INTRINSIC_OVERLOAD_TABLE
74 }
75 
76 Function*
78  Type **Tys,
79  unsigned numTys) const {
80  llvm_unreachable("Not implemented");
81 }
std::string getName(unsigned int IntrId, Type **Tys=0, unsigned int numTys=0) const
AMDGPU specific subclass of TargetSubtarget.
The main container class for the LLVM Intermediate Representation.
Definition: Module.h:112
AMDGPUIntrinsicInfo(TargetMachine *tm)
#define llvm_unreachable(msg)
Function * getDeclaration(Module *M, unsigned int ID, Type **Tys=0, unsigned int numTys=0) const
ID getIntrinsicForGCCBuiltin(const char *Prefix, const char *BuiltinName)
Map a GCC builtin name to an intrinsic ID.
unsigned int lookupName(const char *Name, unsigned int Len) const
bool isOverloaded(unsigned int IID) const
Interface for the AMDGPU Implementation of the Intrinsic Info class.