Line data Source code
1 : //===----------------------- AMDGPUFrameLowering.cpp ----------------------===//
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 : // Interface to describe a layout of a stack frame on a AMDGPU target machine.
11 : //
12 : //===----------------------------------------------------------------------===//
13 :
14 : #include "AMDGPUFrameLowering.h"
15 :
16 : using namespace llvm;
17 2783 : AMDGPUFrameLowering::AMDGPUFrameLowering(StackDirection D, unsigned StackAl,
18 : int LAO, unsigned TransAl)
19 2783 : : TargetFrameLowering(D, StackAl, LAO, TransAl) { }
20 :
21 : AMDGPUFrameLowering::~AMDGPUFrameLowering() = default;
22 :
23 11032 : unsigned AMDGPUFrameLowering::getStackWidth(const MachineFunction &MF) const {
24 : // XXX: Hardcoding to 1 for now.
25 : //
26 : // I think the StackWidth should stored as metadata associated with the
27 : // MachineFunction. This metadata can either be added by a frontend, or
28 : // calculated by a R600 specific LLVM IR pass.
29 : //
30 : // The StackWidth determines how stack objects are laid out in memory.
31 : // For a vector stack variable, like: int4 stack[2], the data will be stored
32 : // in the following ways depending on the StackWidth.
33 : //
34 : // StackWidth = 1:
35 : //
36 : // T0.X = stack[0].x
37 : // T1.X = stack[0].y
38 : // T2.X = stack[0].z
39 : // T3.X = stack[0].w
40 : // T4.X = stack[1].x
41 : // T5.X = stack[1].y
42 : // T6.X = stack[1].z
43 : // T7.X = stack[1].w
44 : //
45 : // StackWidth = 2:
46 : //
47 : // T0.X = stack[0].x
48 : // T0.Y = stack[0].y
49 : // T1.X = stack[0].z
50 : // T1.Y = stack[0].w
51 : // T2.X = stack[1].x
52 : // T2.Y = stack[1].y
53 : // T3.X = stack[1].z
54 : // T3.Y = stack[1].w
55 : //
56 : // StackWidth = 4:
57 : // T0.X = stack[0].x
58 : // T0.Y = stack[0].y
59 : // T0.Z = stack[0].z
60 : // T0.W = stack[0].w
61 : // T1.X = stack[1].x
62 : // T1.Y = stack[1].y
63 : // T1.Z = stack[1].z
64 : // T1.W = stack[1].w
65 11032 : return 1;
66 : }
|