mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 02:33:06 +01:00
d0124d17f9
Summary: This is patch is part of a series to introduce an Alignment type. See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html See this patch for the introduction of the type: https://reviews.llvm.org/D64790 Reviewers: courbet Subscribers: arsenm, dschuff, jyknight, sdardis, jvesely, nhaehnle, sbc100, jgravelle-google, hiraditya, aheejin, fedor.sergeev, jrtc27, atanasyan, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D69216 llvm-svn: 375398
66 lines
2.0 KiB
C++
66 lines
2.0 KiB
C++
//===----------------------- AMDGPUFrameLowering.cpp ----------------------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//==-----------------------------------------------------------------------===//
|
|
//
|
|
// Interface to describe a layout of a stack frame on a AMDGPU target machine.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "AMDGPUFrameLowering.h"
|
|
|
|
using namespace llvm;
|
|
AMDGPUFrameLowering::AMDGPUFrameLowering(StackDirection D, Align StackAl,
|
|
int LAO, Align TransAl)
|
|
: TargetFrameLowering(D, StackAl, LAO, TransAl) {}
|
|
|
|
AMDGPUFrameLowering::~AMDGPUFrameLowering() = default;
|
|
|
|
unsigned AMDGPUFrameLowering::getStackWidth(const MachineFunction &MF) const {
|
|
// XXX: Hardcoding to 1 for now.
|
|
//
|
|
// I think the StackWidth should stored as metadata associated with the
|
|
// MachineFunction. This metadata can either be added by a frontend, or
|
|
// calculated by a R600 specific LLVM IR pass.
|
|
//
|
|
// The StackWidth determines how stack objects are laid out in memory.
|
|
// For a vector stack variable, like: int4 stack[2], the data will be stored
|
|
// in the following ways depending on the StackWidth.
|
|
//
|
|
// StackWidth = 1:
|
|
//
|
|
// T0.X = stack[0].x
|
|
// T1.X = stack[0].y
|
|
// T2.X = stack[0].z
|
|
// T3.X = stack[0].w
|
|
// T4.X = stack[1].x
|
|
// T5.X = stack[1].y
|
|
// T6.X = stack[1].z
|
|
// T7.X = stack[1].w
|
|
//
|
|
// StackWidth = 2:
|
|
//
|
|
// T0.X = stack[0].x
|
|
// T0.Y = stack[0].y
|
|
// T1.X = stack[0].z
|
|
// T1.Y = stack[0].w
|
|
// T2.X = stack[1].x
|
|
// T2.Y = stack[1].y
|
|
// T3.X = stack[1].z
|
|
// T3.Y = stack[1].w
|
|
//
|
|
// StackWidth = 4:
|
|
// T0.X = stack[0].x
|
|
// T0.Y = stack[0].y
|
|
// T0.Z = stack[0].z
|
|
// T0.W = stack[0].w
|
|
// T1.X = stack[1].x
|
|
// T1.Y = stack[1].y
|
|
// T1.Z = stack[1].z
|
|
// T1.W = stack[1].w
|
|
return 1;
|
|
}
|