/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/llvm/lib/Target/AMDGPU/AMDGPUGenRegisterBankInfo.def
Line | Count | Source |
1 | | //===- AMDGPUGenRegisterBankInfo.def -----------------------------*- 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 | | /// \file |
10 | | /// This file defines all the static objects used by AMDGPURegisterBankInfo. |
11 | | /// \todo This should be generated by TableGen. |
12 | | //===----------------------------------------------------------------------===// |
13 | | |
14 | | namespace llvm { |
15 | | namespace AMDGPU { |
16 | | |
17 | | enum PartialMappingIdx { |
18 | | None = - 1, |
19 | | PM_SGPR32 = 0, |
20 | | PM_SGPR64 = 1, |
21 | | PM_VGPR32 = 2, |
22 | | PM_VGPR64 = 3 |
23 | | }; |
24 | | |
25 | | const RegisterBankInfo::PartialMapping PartMappings[] { |
26 | | // StartIdx, Length, RegBank |
27 | | {0, 32, SGPRRegBank}, |
28 | | {0, 64, SGPRRegBank}, |
29 | | {0, 32, VGPRRegBank}, |
30 | | {0, 64, VGPRRegBank} |
31 | | }; |
32 | | |
33 | | const RegisterBankInfo::ValueMapping ValMappings[] { |
34 | | // SGPR 32-bit |
35 | | {&PartMappings[0], 1}, |
36 | | // SGPR 64-bit |
37 | | {&PartMappings[1], 1}, |
38 | | // VGPR 32-bit |
39 | | {&PartMappings[2], 1}, |
40 | | // VGPR 64-bit |
41 | | {&PartMappings[3], 1} |
42 | | }; |
43 | | |
44 | | enum ValueMappingIdx { |
45 | | SGPRStartIdx = 0, |
46 | | VGPRStartIdx = 2 |
47 | | }; |
48 | | |
49 | | const RegisterBankInfo::ValueMapping *getValueMapping(unsigned BankID, |
50 | 246 | unsigned Size) { |
51 | 246 | assert(Size % 32 == 0); |
52 | 246 | unsigned Idx = BankID == AMDGPU::SGPRRegBankID ? SGPRStartIdx220 : VGPRStartIdx26 ; |
53 | 246 | Idx += (Size / 32) - 1; |
54 | 246 | return &ValMappings[Idx]; |
55 | 246 | } |
56 | | |
57 | | } // End AMDGPU namespace. |
58 | | } // End llvm namespace. |