Path: blob/main/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUFrameLowering.cpp
35266 views
//===----------------------- AMDGPUFrameLowering.cpp ----------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//==-----------------------------------------------------------------------===//7//8// Interface to describe a layout of a stack frame on a AMDGPU target machine.9//10//===----------------------------------------------------------------------===//1112#include "AMDGPUFrameLowering.h"1314using namespace llvm;15AMDGPUFrameLowering::AMDGPUFrameLowering(StackDirection D, Align StackAl,16int LAO, Align TransAl)17: TargetFrameLowering(D, StackAl, LAO, TransAl) {}1819AMDGPUFrameLowering::~AMDGPUFrameLowering() = default;2021unsigned AMDGPUFrameLowering::getStackWidth(const MachineFunction &MF) const {22// XXX: Hardcoding to 1 for now.23//24// I think the StackWidth should be stored as metadata associated with the25// MachineFunction. This metadata can either be added by a frontend, or26// calculated by a R600 specific LLVM IR pass.27//28// The StackWidth determines how stack objects are laid out in memory.29// For a vector stack variable, like: int4 stack[2], the data will be stored30// in the following ways depending on the StackWidth.31//32// StackWidth = 1:33//34// T0.X = stack[0].x35// T1.X = stack[0].y36// T2.X = stack[0].z37// T3.X = stack[0].w38// T4.X = stack[1].x39// T5.X = stack[1].y40// T6.X = stack[1].z41// T7.X = stack[1].w42//43// StackWidth = 2:44//45// T0.X = stack[0].x46// T0.Y = stack[0].y47// T1.X = stack[0].z48// T1.Y = stack[0].w49// T2.X = stack[1].x50// T2.Y = stack[1].y51// T3.X = stack[1].z52// T3.Y = stack[1].w53//54// StackWidth = 4:55// T0.X = stack[0].x56// T0.Y = stack[0].y57// T0.Z = stack[0].z58// T0.W = stack[0].w59// T1.X = stack[1].x60// T1.Y = stack[1].y61// T1.Z = stack[1].z62// T1.W = stack[1].w63return 1;64}656667