mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-12 15:05:06 +00:00
79aa3417eb
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152997 91177308-0d34-0410-b5e6-96231b3b80d8
74 lines
1.7 KiB
C++
74 lines
1.7 KiB
C++
//===-- PTXParamManager.cpp - Manager for .param variables ----------------===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file implements the PTXParamManager class.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "PTXParamManager.h"
|
|
#include "PTX.h"
|
|
#include "llvm/ADT/StringExtras.h"
|
|
|
|
using namespace llvm;
|
|
|
|
PTXParamManager::PTXParamManager() {
|
|
}
|
|
|
|
unsigned PTXParamManager::addArgumentParam(unsigned Size) {
|
|
PTXParam Param;
|
|
Param.Type = PTX_PARAM_TYPE_ARGUMENT;
|
|
Param.Size = Size;
|
|
|
|
std::string Name;
|
|
Name = "__param_";
|
|
Name += utostr(ArgumentParams.size()+1);
|
|
Param.Name = Name;
|
|
|
|
unsigned Index = AllParams.size();
|
|
AllParams[Index] = Param;
|
|
ArgumentParams.push_back(Index);
|
|
|
|
return Index;
|
|
}
|
|
|
|
unsigned PTXParamManager::addReturnParam(unsigned Size) {
|
|
PTXParam Param;
|
|
Param.Type = PTX_PARAM_TYPE_RETURN;
|
|
Param.Size = Size;
|
|
|
|
std::string Name;
|
|
Name = "__ret_";
|
|
Name += utostr(ReturnParams.size()+1);
|
|
Param.Name = Name;
|
|
|
|
unsigned Index = AllParams.size();
|
|
AllParams[Index] = Param;
|
|
ReturnParams.push_back(Index);
|
|
|
|
return Index;
|
|
}
|
|
|
|
unsigned PTXParamManager::addLocalParam(unsigned Size) {
|
|
PTXParam Param;
|
|
Param.Type = PTX_PARAM_TYPE_LOCAL;
|
|
Param.Size = Size;
|
|
|
|
std::string Name;
|
|
Name = "__localparam_";
|
|
Name += utostr(LocalParams.size()+1);
|
|
Param.Name = Name;
|
|
|
|
unsigned Index = AllParams.size();
|
|
AllParams[Index] = Param;
|
|
LocalParams.push_back(Index);
|
|
|
|
return Index;
|
|
}
|
|
|