Squelch unused variable warning in SIRegisterInfo.cpp.
[oota-llvm.git] / lib / Target / AMDGPU / AMDGPUIntrinsicInfo.cpp
1 //===- AMDGPUIntrinsicInfo.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 "AMDGPUIntrinsicInfo.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
27 AMDGPUIntrinsicInfo::AMDGPUIntrinsicInfo()
28     : TargetIntrinsicInfo() {}
29
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
36   };
37
38   if (IntrID < Intrinsic::num_intrinsics) {
39     return nullptr;
40   }
41   assert(IntrID < AMDGPUIntrinsic::num_AMDGPU_intrinsics &&
42          "Invalid intrinsic ID");
43
44   std::string Result(names[IntrID - Intrinsic::num_intrinsics]);
45   return Result;
46 }
47
48 unsigned AMDGPUIntrinsicInfo::lookupName(const char *Name,
49                                          unsigned Len) const {
50   if (!StringRef(Name, Len).startswith("llvm."))
51     return 0; // All intrinsics start with 'llvm.'
52
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);
59
60   if (IntrinsicID != (AMDGPUIntrinsic::ID)Intrinsic::not_intrinsic) {
61     return IntrinsicID;
62   }
63   return 0;
64 }
65
66 bool AMDGPUIntrinsicInfo::isOverloaded(unsigned id) const {
67 // Overload Table
68 #define GET_INTRINSIC_OVERLOAD_TABLE
69 #include "AMDGPUGenIntrinsics.inc"
70 #undef GET_INTRINSIC_OVERLOAD_TABLE
71 }
72
73 Function *AMDGPUIntrinsicInfo::getDeclaration(Module *M, unsigned IntrID,
74                                               Type **Tys,
75                                               unsigned numTys) const {
76   llvm_unreachable("Not implemented");
77 }