summaryrefslogtreecommitdiff
path: root/lib/Target/AMDIL/AMDILDeviceInfo.cpp
blob: 89b8312c294228bf6ca7033f9444499016f4fc91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//===-- AMDILDeviceInfo.cpp - TODO: Add brief description -------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//==-----------------------------------------------------------------------===//
#include "AMDILDevices.h"
#include "AMDILSubtarget.h"

using namespace llvm;
namespace llvm {
    AMDILDevice*
getDeviceFromName(const std::string &deviceName, AMDILSubtarget *ptr, bool is64bit, bool is64on32bit)
{
    if (deviceName.c_str()[2] == '7') {
        switch (deviceName.c_str()[3]) {
            case '1':
                return new AMDIL710Device(ptr);
            case '7':
                return new AMDIL770Device(ptr);
            default:
                return new AMDIL7XXDevice(ptr);
        };
    } else if (deviceName == "cypress") {
#if DEBUG
      assert(!is64bit && "This device does not support 64bit pointers!");
      assert(!is64on32bit && "This device does not support 64bit"
          " on 32bit pointers!");
#endif
        return new AMDILCypressDevice(ptr);
    } else if (deviceName == "juniper") {
#if DEBUG
      assert(!is64bit && "This device does not support 64bit pointers!");
      assert(!is64on32bit && "This device does not support 64bit"
          " on 32bit pointers!");
#endif
        return new AMDILEvergreenDevice(ptr);
    } else if (deviceName == "redwood") {
#if DEBUG
      assert(!is64bit && "This device does not support 64bit pointers!");
      assert(!is64on32bit && "This device does not support 64bit"
          " on 32bit pointers!");
#endif
      return new AMDILRedwoodDevice(ptr);
    } else if (deviceName == "cedar") {
#if DEBUG
      assert(!is64bit && "This device does not support 64bit pointers!");
      assert(!is64on32bit && "This device does not support 64bit"
          " on 32bit pointers!");
#endif
        return new AMDILCedarDevice(ptr);
    } else if (deviceName == "barts"
      || deviceName == "turks") {
#if DEBUG
      assert(!is64bit && "This device does not support 64bit pointers!");
      assert(!is64on32bit && "This device does not support 64bit"
          " on 32bit pointers!");
#endif
        return new AMDILNIDevice(ptr);
    } else if (deviceName == "cayman") {
#if DEBUG
      assert(!is64bit && "This device does not support 64bit pointers!");
      assert(!is64on32bit && "This device does not support 64bit"
          " on 32bit pointers!");
#endif
        return new AMDILCaymanDevice(ptr);
    } else if (deviceName == "caicos") {
#if DEBUG
      assert(!is64bit && "This device does not support 64bit pointers!");
      assert(!is64on32bit && "This device does not support 64bit"
          " on 32bit pointers!");
#endif
        return new AMDILNIDevice(ptr);
    } else if (deviceName == "SI") {
        return new AMDILSIDevice(ptr);
    } else {
#if DEBUG
      assert(!is64bit && "This device does not support 64bit pointers!");
      assert(!is64on32bit && "This device does not support 64bit"
          " on 32bit pointers!");
#endif
        return new AMDIL7XXDevice(ptr);
    }
}
}