1 //===-- AMDILDeviceInfo.cpp - AMDILDeviceInfo class -----------------------===//
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 //==-----------------------------------------------------------------------===//
10 // Function that creates DeviceInfo from a device name and other information.
12 //==-----------------------------------------------------------------------===//
13 #include "AMDILDevices.h"
14 #include "AMDILSubtarget.h"
18 namespace AMDILDeviceInfo {
20 getDeviceFromName(const std::string &deviceName, AMDILSubtarget *ptr, bool is64bit, bool is64on32bit)
22 if (deviceName.c_str()[2] == '7') {
23 switch (deviceName.c_str()[3]) {
25 return new AMDIL710Device(ptr);
27 return new AMDIL770Device(ptr);
29 return new AMDIL7XXDevice(ptr);
31 } else if (deviceName == "cypress") {
33 assert(!is64bit && "This device does not support 64bit pointers!");
34 assert(!is64on32bit && "This device does not support 64bit"
35 " on 32bit pointers!");
37 return new AMDILCypressDevice(ptr);
38 } else if (deviceName == "juniper") {
40 assert(!is64bit && "This device does not support 64bit pointers!");
41 assert(!is64on32bit && "This device does not support 64bit"
42 " on 32bit pointers!");
44 return new AMDILEvergreenDevice(ptr);
45 } else if (deviceName == "redwood") {
47 assert(!is64bit && "This device does not support 64bit pointers!");
48 assert(!is64on32bit && "This device does not support 64bit"
49 " on 32bit pointers!");
51 return new AMDILRedwoodDevice(ptr);
52 } else if (deviceName == "cedar") {
54 assert(!is64bit && "This device does not support 64bit pointers!");
55 assert(!is64on32bit && "This device does not support 64bit"
56 " on 32bit pointers!");
58 return new AMDILCedarDevice(ptr);
59 } else if (deviceName == "barts"
60 || deviceName == "turks") {
62 assert(!is64bit && "This device does not support 64bit pointers!");
63 assert(!is64on32bit && "This device does not support 64bit"
64 " on 32bit pointers!");
66 return new AMDILNIDevice(ptr);
67 } else if (deviceName == "cayman") {
69 assert(!is64bit && "This device does not support 64bit pointers!");
70 assert(!is64on32bit && "This device does not support 64bit"
71 " on 32bit pointers!");
73 return new AMDILCaymanDevice(ptr);
74 } else if (deviceName == "caicos") {
76 assert(!is64bit && "This device does not support 64bit pointers!");
77 assert(!is64on32bit && "This device does not support 64bit"
78 " on 32bit pointers!");
80 return new AMDILNIDevice(ptr);
81 } else if (deviceName == "SI") {
82 return new AMDILSIDevice(ptr);
85 assert(!is64bit && "This device does not support 64bit pointers!");
86 assert(!is64on32bit && "This device does not support 64bit"
87 " on 32bit pointers!");
89 return new AMDIL7XXDevice(ptr);
92 } // End namespace AMDILDeviceInfo
93 } // End namespace llvm