1 //===- AMDILIntrinsicInfo.cpp - AMDGPU Intrinsic Information ------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //==-----------------------------------------------------------------------===//
11 /// \brief AMDGPU Implementation of the IntrinsicInfo class.
13 //===-----------------------------------------------------------------------===//
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"
23 #define GET_LLVM_INTRINSIC_FOR_GCC_BUILTIN
24 #include "AMDGPUGenIntrinsics.inc"
25 #undef GET_LLVM_INTRINSIC_FOR_GCC_BUILTIN
27 AMDGPUIntrinsicInfo::AMDGPUIntrinsicInfo(TargetMachine *tm)
28 : TargetIntrinsicInfo() {
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
40 if (IntrID < Intrinsic::num_intrinsics) {
43 assert(IntrID < AMDGPUIntrinsic::num_AMDGPU_intrinsics
44 && "Invalid intrinsic ID");
46 std::string Result(names[IntrID - Intrinsic::num_intrinsics]);
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.'
55 #define GET_FUNCTION_RECOGNIZER
56 #include "AMDGPUGenIntrinsics.inc"
57 #undef GET_FUNCTION_RECOGNIZER
58 AMDGPUIntrinsic::ID IntrinsicID
59 = (AMDGPUIntrinsic::ID)Intrinsic::not_intrinsic;
60 IntrinsicID = getIntrinsicForGCCBuiltin("AMDGPU", Name);
62 if (IntrinsicID != (AMDGPUIntrinsic::ID)Intrinsic::not_intrinsic) {
69 AMDGPUIntrinsicInfo::isOverloaded(unsigned id) const {
71 #define GET_INTRINSIC_OVERLOAD_TABLE
72 #include "AMDGPUGenIntrinsics.inc"
73 #undef GET_INTRINSIC_OVERLOAD_TABLE
77 AMDGPUIntrinsicInfo::getDeclaration(Module *M, unsigned IntrID,
79 unsigned numTys) const {
80 llvm_unreachable("Not implemented");