// Go over the arguments and find the related patch locations
const uint32_t argNum = fn.argNum();
for (uint32_t argID = 0u; argID < argNum; ++argID) {
- const ir::FunctionArgument &arg = fn.getInput(argID);
+ const ir::FunctionArgument &arg = fn.getArg(argID);
// For pointers and values, we have nothing to do. We just push the values
if (arg.type == ir::FunctionArgument::GLOBAL_POINTER ||
arg.type == ir::FunctionArgument::CONSTANT_POINTER ||
kernel->argNum = fn.argNum();
kernel->args = GBE_NEW_ARRAY(KernelArgument, kernel->argNum);
for (uint32_t argID = 0; argID < kernel->argNum; ++argID) {
- const auto &arg = fn.getInput(argID);
+ const auto &arg = fn.getArg(argID);
switch (arg.type) {
case ir::FunctionArgument::VALUE:
case ir::FunctionArgument::STRUCTURE:
bool Context::isScalarReg(const ir::Register ®) const {
GBE_ASSERT(fn.getProfile() == ir::Profile::PROFILE_OCL);
- if (fn.getInput(reg) != NULL) return true;
+ if (fn.getArg(reg) != NULL) return true;
if (fn.getPushLocation(reg) != NULL) return true;
if (reg == ir::ocl::groupid0 ||
reg == ir::ocl::groupid1 ||
uint32_t GenContext::createGenReg(ir::Register reg, uint32_t grfOffset) {
using namespace ir;
if (fn.isSpecialReg(reg) == true) return grfOffset; // already done
- if (fn.getInput(reg) != NULL) return grfOffset; // already done
+ if (fn.getArg(reg) != NULL) return grfOffset; // already done
if (fn.getPushLocation(reg) != NULL) return grfOffset; // already done
GBE_ASSERT(this->isScalarReg(reg) == false);
const RegisterData regData = fn.getRegisterData(reg);
// Allocate all (non-structure) argument parameters
const uint32_t argNum = fn.argNum();
for (uint32_t argID = 0; argID < argNum; ++argID) {
- const FunctionArgument &arg = fn.getInput(argID);
+ const FunctionArgument &arg = fn.getArg(argID);
GBE_ASSERT(arg.type == FunctionArgument::GLOBAL_POINTER ||
arg.type == FunctionArgument::CONSTANT_POINTER ||
arg.type == FunctionArgument::VALUE ||
// Load the function arguments
const uint32_t argNum = fn.argNum();
for (uint32_t argID = 0; argID < argNum; ++argID) {
- const ir::FunctionArgument &arg = fn.getInput(argID);
+ const ir::FunctionArgument &arg = fn.getArg(argID);
const ir::Register reg = arg.reg;
const int32_t offset = kernel->getCurbeOffset(GBE_CURBE_KERNEL_ARGUMENT, argID);
// XXX add support for these items
out << "## " << fn.argNum() << " input register"
<< plural(fn.argNum()) << " ##" << std::endl;
for (uint32_t i = 0; i < fn.argNum(); ++i) {
- const FunctionArgument &input = fn.getInput(i);
+ const FunctionArgument &input = fn.getArg(i);
out << "decl_input.";
switch (input.type) {
case FunctionArgument::GLOBAL_POINTER: out << "global"; break;
/*! Fast allocation / deallocation of instructions */
DECL_POOL(Instruction, insnPool);
/*! Get input argument */
- INLINE const FunctionArgument &getInput(uint32_t ID) const {
+ INLINE const FunctionArgument &getArg(uint32_t ID) const {
GBE_ASSERT(ID < argNum() && args[ID] != NULL);
return *args[ID];
}
- INLINE FunctionArgument &getInput(uint32_t ID) {
+ INLINE FunctionArgument &getArg(uint32_t ID) {
GBE_ASSERT(ID < argNum() && args[ID] != NULL);
return *args[ID];
}
/*! Get input argument from the register (linear research). Return NULL if
* this is not an input argument
*/
- INLINE const FunctionArgument *getInput(const Register ®) const {
+ INLINE const FunctionArgument *getArg(const Register ®) const {
for (auto it = args.begin(); it != args.end(); ++it)
if ((*it)->reg == reg) return *it;
return NULL;
INLINE uint64_t getOffsetFromImm(const Immediate &imm) {
switch (imm.type) {
+ // bit-cast these ones
case TYPE_DOUBLE:
case TYPE_FLOAT:
case TYPE_S64:
case TYPE_U32:
case TYPE_U16:
case TYPE_U8: return imm.data.u64;
+ // sign extend these ones
case TYPE_S32: return int64_t(imm.data.s32);
case TYPE_S16: return int64_t(imm.data.s16);
case TYPE_S8: return int64_t(imm.data.s8);
// replace
const uint32_t argNum = fn->argNum();
for (uint32_t argID = 0; argID < argNum; ++argID) {
- FunctionArgument &arg = fn->getInput(argID);
+ FunctionArgument &arg = fn->getArg(argID);
if (arg.type != FunctionArgument::STRUCTURE) continue;
this->lower(argID);
}
bool FunctionArgumentLowerer::matchLoadAddImm(uint32_t argID)
{
- const FunctionArgument &arg = fn->getInput(argID);
+ const FunctionArgument &arg = fn->getArg(argID);
LoadAddImmSeq tmpSeq;
// Inspect all uses of the function argument pointer
ArgUse FunctionArgumentLowerer::getArgUse(uint32_t argID)
{
- FunctionArgument &arg = fn->getInput(argID);
+ FunctionArgument &arg = fn->getArg(argID);
// case 1 - we may store something to the structure argument
set<const Instruction*> visited;
if (fn.isEntryBlock(bb) == false) return;
// Is it a function input?
- const FunctionArgument *arg = fn.getInput(reg);
+ const FunctionArgument *arg = fn.getArg(reg);
const PushLocation *pushed = fn.getPushLocation(reg);
// Is it a pushed register?
// Insert all the values that are not overwritten in the block and alive at
// the end of it
for (uint32_t argID = 0; argID < argNum; ++argID) {
- const FunctionArgument &arg = fn.getInput(argID);
+ const FunctionArgument &arg = fn.getArg(argID);
const Register reg = arg.reg;
// Do not transfer dead values
if (info.inLiveOut(reg) == false) continue;
// Function arguments are also value definitions
const uint32_t argNum = fn.argNum();
for (uint32_t argID = 0; argID < argNum; ++argID) {
- const FunctionArgument &arg = fn.getInput(argID);
+ const FunctionArgument &arg = fn.getArg(argID);
ValueDef *valueDef = this->newValueDef(&arg);
defName.insert(std::make_pair(*valueDef, valueDef));
duGraph.insert(std::make_pair(*valueDef, duEmpty));