Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AArch64: Add extraRegister to OMRMemoryReference #4225

Merged
merged 1 commit into from
Nov 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions compiler/aarch64/codegen/ARM64Instruction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,14 +273,14 @@ void TR::ARM64MemSrc1Instruction::assignRegisters(TR_RegisterKinds kindToBeAssig
if (getDependencyConditions())
getDependencyConditions()->assignPostConditionRegisters(this, kindToBeAssigned, cg());

sourceVirtual->block();
mref->assignRegisters(this, cg());
sourceVirtual->unblock();

mref->blockRegisters();
setSource1Register(machine->assignOneRegister(this, sourceVirtual));
mref->unblockRegisters();

sourceVirtual->block();
mref->assignRegisters(this, cg());
sourceVirtual->unblock();

if (getDependencyConditions())
getDependencyConditions()->assignPreConditionRegisters(this->getPrev(), kindToBeAssigned, cg());
}
Expand Down
17 changes: 16 additions & 1 deletion compiler/aarch64/codegen/OMRMemoryReference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ static void loadRelocatableConstant(TR::Node *node,
}
else
{
cg->addSnippet(mr->setUnresolvedSnippet(new (cg->trHeapMemory()) TR::UnresolvedDataSnippet(cg, node, ref, node->getOpCode().isStore(), false)));
mr->setUnresolvedSnippet(new (cg->trHeapMemory()) TR::UnresolvedDataSnippet(cg, node, ref, node->getOpCode().isStore(), false));
cg->addSnippet(mr->getUnresolvedSnippet());
}
}
else
Expand All @@ -105,6 +106,7 @@ OMR::ARM64::MemoryReference::MemoryReference(
_baseNode(NULL),
_indexRegister(NULL),
_indexNode(NULL),
_extraRegister(NULL),
_unresolvedSnippet(NULL),
_flag(0),
_length(0),
Expand All @@ -123,6 +125,7 @@ OMR::ARM64::MemoryReference::MemoryReference(
_baseNode(NULL),
_indexRegister(ir),
_indexNode(NULL),
_extraRegister(NULL),
_unresolvedSnippet(NULL),
_flag(0),
_length(0),
Expand All @@ -141,6 +144,7 @@ OMR::ARM64::MemoryReference::MemoryReference(
_baseNode(NULL),
_indexRegister(NULL),
_indexNode(NULL),
_extraRegister(NULL),
_unresolvedSnippet(NULL),
_flag(0),
_length(0),
Expand All @@ -159,6 +163,7 @@ OMR::ARM64::MemoryReference::MemoryReference(
_baseNode(NULL),
_indexRegister(NULL),
_indexNode(NULL),
_extraRegister(NULL),
_unresolvedSnippet(NULL),
_flag(0),
_length(len),
Expand Down Expand Up @@ -223,6 +228,7 @@ OMR::ARM64::MemoryReference::MemoryReference(
_baseNode(NULL),
_indexRegister(NULL),
_indexNode(NULL),
_extraRegister(NULL),
_unresolvedSnippet(NULL),
_flag(0),
_length(len),
Expand Down Expand Up @@ -375,6 +381,11 @@ void OMR::ARM64::MemoryReference::decNodeReferenceCounts(TR::CodeGenerator *cg)
else
cg->stopUsingRegister(_indexRegister);
}

if (_extraRegister != NULL)
{
cg->stopUsingRegister(_extraRegister);
}
}


Expand Down Expand Up @@ -600,6 +611,10 @@ void OMR::ARM64::MemoryReference::incRegisterTotalUseCounts(TR::CodeGenerator *
{
_indexRegister->incTotalUseCount();
}
if (_extraRegister != NULL)
{
_extraRegister->incTotalUseCount();
}
}


Expand Down
31 changes: 30 additions & 1 deletion compiler/aarch64/codegen/OMRMemoryReference.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ class OMR_EXTENSIBLE MemoryReference : public OMR::MemoryReference
TR::UnresolvedDataSnippet *_unresolvedSnippet;
TR::SymbolReference *_symbolReference;

// Any downstream project can use this extra register to associate an additional
// register to a memory reference that can be used for project-specific purposes.
// This register is in addition to the base and index registers and isn't directly
// part of the addressing expression in the memory reference.
// An example of what this could be used for is to help synthesize unresolved data
// reference addresses at runtime.
TR::Register *_extraRegister;

uint8_t _flag;
uint8_t _length;
uint8_t _scale;
Expand Down Expand Up @@ -185,6 +193,18 @@ class OMR_EXTENSIBLE MemoryReference : public OMR::MemoryReference
*/
TR::Node *setIndexNode(TR::Node *in) {return (_indexNode = in);}

/**
* @brief Gets extra register
* @return extra register
*/
TR::Register *getExtraRegister() {return _extraRegister;}
/**
* @brief Sets extra register
* @param[in] er : extra register
* @return extra register
*/
TR::Register *setExtraRegister(TR::Register *er) {return (_extraRegister = er);}

/**
* @brief Gets length
* @return length
Expand Down Expand Up @@ -254,7 +274,8 @@ class OMR_EXTENSIBLE MemoryReference : public OMR::MemoryReference
bool refsRegister(TR::Register *reg)
{
return (reg == _baseRegister ||
reg == _indexRegister);
reg == _indexRegister ||
reg == _extraRegister);
}

/**
Expand All @@ -270,6 +291,10 @@ class OMR_EXTENSIBLE MemoryReference : public OMR::MemoryReference
{
_indexRegister->block();
}
if (_extraRegister != NULL)
{
_extraRegister->block();
}
}

/**
Expand All @@ -285,6 +310,10 @@ class OMR_EXTENSIBLE MemoryReference : public OMR::MemoryReference
{
_indexRegister->unblock();
}
if (_extraRegister != NULL)
{
_extraRegister->unblock();
}
}

/**
Expand Down