1 //===- AMDGPUIntrinsicInfo.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 "AMDGPUIntrinsicInfo.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()
28 : TargetIntrinsicInfo() {}
30 std::string AMDGPUIntrinsicInfo::getName(unsigned IntrID, Type **Tys,
31 unsigned numTys) const {
32 static const char *const names[] = {
33 #define GET_INTRINSIC_NAME_TABLE
34 #include "AMDGPUGenIntrinsics.inc"
35 #undef GET_INTRINSIC_NAME_TABLE
38 if (IntrID < Intrinsic::num_intrinsics) {
41 assert(IntrID < AMDGPUIntrinsic::num_AMDGPU_intrinsics &&
42 "Invalid intrinsic ID");
44 std::string Result(names[IntrID - Intrinsic::num_intrinsics]);
48 unsigned AMDGPUIntrinsicInfo::lookupName(const char *Name,
50 if (!StringRef(Name, Len).startswith("llvm."))
51 return 0; // All intrinsics start with 'llvm.'
53 #define GET_FUNCTION_RECOGNIZER
54 #include "AMDGPUGenIntrinsics.inc"
55 #undef GET_FUNCTION_RECOGNIZER
56 AMDGPUIntrinsic::ID IntrinsicID =
57 (AMDGPUIntrinsic::ID)Intrinsic::not_intrinsic;
58 IntrinsicID = getIntrinsicForGCCBuiltin("AMDGPU", Name);
60 if (IntrinsicID != (AMDGPUIntrinsic::ID)Intrinsic::not_intrinsic) {
66 bool AMDGPUIntrinsicInfo::isOverloaded(unsigned id) const {
68 #define GET_INTRINSIC_OVERLOAD_TABLE
69 #include "AMDGPUGenIntrinsics.inc"
70 #undef GET_INTRINSIC_OVERLOAD_TABLE
73 Function *AMDGPUIntrinsicInfo::getDeclaration(Module *M, unsigned IntrID,
75 unsigned numTys) const {
76 llvm_unreachable("Not implemented");