/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/Target/AMDGPU/AMDGPUFrameLowering.cpp
Line | Count | Source |
1 | | //===----------------------- AMDGPUFrameLowering.cpp ----------------------===// |
2 | | // |
3 | | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | | // See https://llvm.org/LICENSE.txt for license information. |
5 | | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | | // |
7 | | //==-----------------------------------------------------------------------===// |
8 | | // |
9 | | // Interface to describe a layout of a stack frame on a AMDGPU target machine. |
10 | | // |
11 | | //===----------------------------------------------------------------------===// |
12 | | |
13 | | #include "AMDGPUFrameLowering.h" |
14 | | |
15 | | using namespace llvm; |
16 | | AMDGPUFrameLowering::AMDGPUFrameLowering(StackDirection D, unsigned StackAl, |
17 | | int LAO, unsigned TransAl) |
18 | 3.93k | : TargetFrameLowering(D, StackAl, LAO, TransAl) { } |
19 | | |
20 | 3.90k | AMDGPUFrameLowering::~AMDGPUFrameLowering() = default; |
21 | | |
22 | 14.0k | unsigned AMDGPUFrameLowering::getStackWidth(const MachineFunction &MF) const { |
23 | 14.0k | // XXX: Hardcoding to 1 for now. |
24 | 14.0k | // |
25 | 14.0k | // I think the StackWidth should stored as metadata associated with the |
26 | 14.0k | // MachineFunction. This metadata can either be added by a frontend, or |
27 | 14.0k | // calculated by a R600 specific LLVM IR pass. |
28 | 14.0k | // |
29 | 14.0k | // The StackWidth determines how stack objects are laid out in memory. |
30 | 14.0k | // For a vector stack variable, like: int4 stack[2], the data will be stored |
31 | 14.0k | // in the following ways depending on the StackWidth. |
32 | 14.0k | // |
33 | 14.0k | // StackWidth = 1: |
34 | 14.0k | // |
35 | 14.0k | // T0.X = stack[0].x |
36 | 14.0k | // T1.X = stack[0].y |
37 | 14.0k | // T2.X = stack[0].z |
38 | 14.0k | // T3.X = stack[0].w |
39 | 14.0k | // T4.X = stack[1].x |
40 | 14.0k | // T5.X = stack[1].y |
41 | 14.0k | // T6.X = stack[1].z |
42 | 14.0k | // T7.X = stack[1].w |
43 | 14.0k | // |
44 | 14.0k | // StackWidth = 2: |
45 | 14.0k | // |
46 | 14.0k | // T0.X = stack[0].x |
47 | 14.0k | // T0.Y = stack[0].y |
48 | 14.0k | // T1.X = stack[0].z |
49 | 14.0k | // T1.Y = stack[0].w |
50 | 14.0k | // T2.X = stack[1].x |
51 | 14.0k | // T2.Y = stack[1].y |
52 | 14.0k | // T3.X = stack[1].z |
53 | 14.0k | // T3.Y = stack[1].w |
54 | 14.0k | // |
55 | 14.0k | // StackWidth = 4: |
56 | 14.0k | // T0.X = stack[0].x |
57 | 14.0k | // T0.Y = stack[0].y |
58 | 14.0k | // T0.Z = stack[0].z |
59 | 14.0k | // T0.W = stack[0].w |
60 | 14.0k | // T1.X = stack[1].x |
61 | 14.0k | // T1.Y = stack[1].y |
62 | 14.0k | // T1.Z = stack[1].z |
63 | 14.0k | // T1.W = stack[1].w |
64 | 14.0k | return 1; |
65 | 14.0k | } |