]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/llvm/lib/Target/R600/AMDILIntrinsicInfo.cpp
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / contrib / llvm / lib / Target / R600 / AMDILIntrinsicInfo.cpp
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
27 AMDGPUIntrinsicInfo::AMDGPUIntrinsicInfo(TargetMachine *tm) 
28   : TargetIntrinsicInfo() {
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   }
43   assert(IntrID < AMDGPUIntrinsic::num_AMDGPU_intrinsics
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
59     = (AMDGPUIntrinsic::ID)Intrinsic::not_intrinsic;
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 
69 AMDGPUIntrinsicInfo::isOverloaded(unsigned id) const  {
70   // Overload Table
71 #define GET_INTRINSIC_OVERLOAD_TABLE
72 #include "AMDGPUGenIntrinsics.inc"
73 #undef GET_INTRINSIC_OVERLOAD_TABLE
74 }
75
76 Function*
77 AMDGPUIntrinsicInfo::getDeclaration(Module *M, unsigned IntrID,
78     Type **Tys,
79     unsigned numTys) const  {
80   llvm_unreachable("Not implemented");
81 }