Merge branch 'gallium-userbuf'
[mesa.git] / src / gallium / drivers / radeon / AMDILDeviceInfo.cpp
1 //===-- AMDILDeviceInfo.cpp - AMDILDeviceInfo class -----------------------===//
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 // Function that creates DeviceInfo from a device name and other information.
11 //
12 //==-----------------------------------------------------------------------===//
13 #include "AMDILDevices.h"
14 #include "AMDILSubtarget.h"
15
16 using namespace llvm;
17 namespace llvm {
18 namespace AMDILDeviceInfo {
19 AMDILDevice*
20 getDeviceFromName(const std::string &deviceName, AMDILSubtarget *ptr, bool is64bit, bool is64on32bit)
21 {
22 if (deviceName.c_str()[2] == '7') {
23 switch (deviceName.c_str()[3]) {
24 case '1':
25 return new AMDIL710Device(ptr);
26 case '7':
27 return new AMDIL770Device(ptr);
28 default:
29 return new AMDIL7XXDevice(ptr);
30 };
31 } else if (deviceName == "cypress") {
32 #if DEBUG
33 assert(!is64bit && "This device does not support 64bit pointers!");
34 assert(!is64on32bit && "This device does not support 64bit"
35 " on 32bit pointers!");
36 #endif
37 return new AMDILCypressDevice(ptr);
38 } else if (deviceName == "juniper") {
39 #if DEBUG
40 assert(!is64bit && "This device does not support 64bit pointers!");
41 assert(!is64on32bit && "This device does not support 64bit"
42 " on 32bit pointers!");
43 #endif
44 return new AMDILEvergreenDevice(ptr);
45 } else if (deviceName == "redwood") {
46 #if DEBUG
47 assert(!is64bit && "This device does not support 64bit pointers!");
48 assert(!is64on32bit && "This device does not support 64bit"
49 " on 32bit pointers!");
50 #endif
51 return new AMDILRedwoodDevice(ptr);
52 } else if (deviceName == "cedar") {
53 #if DEBUG
54 assert(!is64bit && "This device does not support 64bit pointers!");
55 assert(!is64on32bit && "This device does not support 64bit"
56 " on 32bit pointers!");
57 #endif
58 return new AMDILCedarDevice(ptr);
59 } else if (deviceName == "barts"
60 || deviceName == "turks") {
61 #if DEBUG
62 assert(!is64bit && "This device does not support 64bit pointers!");
63 assert(!is64on32bit && "This device does not support 64bit"
64 " on 32bit pointers!");
65 #endif
66 return new AMDILNIDevice(ptr);
67 } else if (deviceName == "cayman") {
68 #if DEBUG
69 assert(!is64bit && "This device does not support 64bit pointers!");
70 assert(!is64on32bit && "This device does not support 64bit"
71 " on 32bit pointers!");
72 #endif
73 return new AMDILCaymanDevice(ptr);
74 } else if (deviceName == "caicos") {
75 #if DEBUG
76 assert(!is64bit && "This device does not support 64bit pointers!");
77 assert(!is64on32bit && "This device does not support 64bit"
78 " on 32bit pointers!");
79 #endif
80 return new AMDILNIDevice(ptr);
81 } else if (deviceName == "SI") {
82 return new AMDILSIDevice(ptr);
83 } else {
84 #if DEBUG
85 assert(!is64bit && "This device does not support 64bit pointers!");
86 assert(!is64on32bit && "This device does not support 64bit"
87 " on 32bit pointers!");
88 #endif
89 return new AMDIL7XXDevice(ptr);
90 }
91 }
92 } // End namespace AMDILDeviceInfo
93 } // End namespace llvm