Skip to content

Commit

Permalink
Deprecate blockIndex in Z
Browse files Browse the repository at this point in the history
Related to: #5293

Signed-off-by: Annabelle Huo <Annabelle.Huo@ibm.com>
  • Loading branch information
a7ehuo committed Apr 28, 2021
1 parent 901a96f commit 4969afa
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 46 deletions.
6 changes: 0 additions & 6 deletions compiler/z/codegen/OMRCodeGenerator.cpp
Expand Up @@ -590,9 +590,6 @@ OMR::Z::CodeGenerator::initialize()
_localF2ISpill = NULL;
_localD2LSpill = NULL;

_nextAvailableBlockIndex = -1;
_currentBlockIndex = -1;

if (comp->getOption(TR_TraceRA))
{
cg->setGPRegisterIterator(new (cg->trHeapMemory()) TR::RegisterIterator(cg->machine(), TR::RealRegister::FirstGPR, TR::RealRegister::LastAssignableGPR));
Expand Down Expand Up @@ -1051,8 +1048,6 @@ OMR::Z::CodeGenerator::beginInstructionSelection()
{
TR::Node * startNode = self()->comp()->getStartTree()->getNode();

self()->setCurrentBlockIndex(startNode->getBlock()->getNumber());

if (self()->comp()->getJittedMethodSymbol()->getLinkageConvention() == TR_Private)
{
TR::Instruction * cursor = NULL;
Expand Down Expand Up @@ -1809,7 +1804,6 @@ OMR::Z::CodeGenerator::doRegisterAssignment(TR_RegisterKinds kindsToAssign)
self()->comp()->setCurrentBlock(instructionCursor->getNode()->getBlock());

// Main register assignment procedure
self()->setCurrentBlockIndex(instructionCursor->getBlockIndex());
instructionCursor->assignRegisters(TR_GPR);

handleLoadWithRegRanges(instructionCursor, self());
Expand Down
14 changes: 1 addition & 13 deletions compiler/z/codegen/OMRCodeGenerator.hpp
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2020 IBM Corp. and others
* Copyright (c) 2000, 2021 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -407,18 +407,6 @@ class OMR_EXTENSIBLE CodeGenerator : public OMR::CodeGenerator
void setCurrentCheckNodeRegDeps(TR::RegisterDependencyConditions * daaDeps) {_currentBCDRegDeps = daaDeps;}
TR::RegisterDependencyConditions * getCurrentCheckNodeRegDeps() {return _currentBCDRegDeps;}

// TODO : Do we need these? And if so there has to be a better way of tracking this this than what we're doing here.
/** Active counter used to track control flow basic blocks generated at instruction selection. */
int32_t _nextAvailableBlockIndex;
/** The index of the current basic block (used and updated during instruction selection). */
int32_t _currentBlockIndex;

void setNextAvailableBlockIndex(int32_t blockIndex) { _nextAvailableBlockIndex = blockIndex; }
int32_t getNextAvailableBlockIndex(){ return _nextAvailableBlockIndex; }
void incNextAvailableBlockIndex() { _nextAvailableBlockIndex++; }

void setCurrentBlockIndex(int32_t blockIndex) { _currentBlockIndex = blockIndex; }
int32_t getCurrentBlockIndex() { return _currentBlockIndex; }
int32_t arrayInitMinimumNumberOfBytes() {return 16;}

bool directLoadAddressMatch(TR::Node *load1, TR::Node *load2, bool trace);
Expand Down
4 changes: 1 addition & 3 deletions compiler/z/codegen/OMRInstruction.cpp
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2020 IBM Corp. and others
* Copyright (c) 2000, 2021 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -166,7 +166,6 @@ OMR::Z::Instruction::initialize(TR::Instruction * precedingInstruction, bool ins
self()->initialize(cond);

TR::CodeGenerator * cg = OMR::Instruction::cg();
self()->setBlockIndex(cg->getCurrentBlockIndex());

if (cond)
{
Expand Down Expand Up @@ -699,7 +698,6 @@ OMR::Z::Instruction::assignRegisters(TR_RegisterKinds kindToBeAssigned)

outOfLineEXInstr->setPrev(self()->getPrev()); // Temporarily set Prev() instruction of snippet to Prev() of EX just in case we insert LR_move on assignRegisters()
self()->cg()->tracePreRAInstruction(outOfLineEXInstr);
self()->cg()->setCurrentBlockIndex(outOfLineEXInstr->getBlockIndex());
outOfLineEXInstr->assignRegisters(kindToBeAssigned);
TR::RegisterDependencyConditions *deps = outOfLineEXInstr->getDependencyConditions();
if (deps) // merge the dependency into the EX deps
Expand Down
5 changes: 0 additions & 5 deletions compiler/z/codegen/OMRInstruction.hpp
Expand Up @@ -83,10 +83,6 @@ class OMR_EXTENSIBLE Instruction : public OMR::Instruction

public:

// Basic Block Index Routines
int32_t getBlockIndex() { return _blockIndex; }
void setBlockIndex(int32_t i) { _blockIndex = i; }

// Register Dependency Routines
TR::RegisterDependencyConditions* getDependencyConditions() {return _conditions;}
TR::RegisterDependencyConditions* setDependencyConditions(TR::RegisterDependencyConditions *cond);
Expand Down Expand Up @@ -251,7 +247,6 @@ class OMR_EXTENSIBLE Instruction : public OMR::Instruction

private:

int32_t _blockIndex;
TR::RegisterDependencyConditions *_conditions;

enum // _flags
Expand Down
14 changes: 0 additions & 14 deletions compiler/z/codegen/OMRTreeEvaluator.cpp
Expand Up @@ -4239,7 +4239,6 @@ generateS390CompareBranch(TR::Node * node, TR::CodeGenerator * cg, TR::InstOpCod
tt = tt->getNextTreeTop(); // Effectively starts at blockEndTT, but this allows us to evaluate the last Exit block of canadidateLoadStoreConditionalBlock

cg->setCurrentEvaluationBlock(canadidateLoadStoreConditionalBlock);
cg->setCurrentBlockIndex(canadidateLoadStoreConditionalBlock->getNumber());
cg->setCurrentEvaluationTreeTop(tt);
cg->resetMethodModifiedByRA();

Expand Down Expand Up @@ -9504,7 +9503,6 @@ OMR::Z::TreeEvaluator::BBStartEvaluator(TR::Node * node, TR::CodeGenerator * cg)
{
TR::Instruction * firstInstr = NULL;
TR::Block * block = node->getBlock();
cg->setCurrentBlockIndex(block->getNumber());
TR::Compilation *comp = cg->comp();

bool generateFence = true;
Expand All @@ -9524,19 +9522,7 @@ OMR::Z::TreeEvaluator::BBStartEvaluator(TR::Node * node, TR::CodeGenerator * cg)
labelInstr = generateS390LabelInstruction(cg, TR::InstOpCode::LABEL, node, node->getLabel());
if (!firstInstr)
firstInstr = labelInstr;
// BB_Start has a label ==> We have an unique block number.
labelInstr->setBlockIndex(node->getBlock()->getNumber());
}
// BB_Start has a label ==> We have an unique block number.
// Decrement Next Available Block Index since we didn't need to use the one automatically
// assigned to the above TR::InstOpCode::LABEL.

//keeping proper track of block indexes by codegen, can comment out following
//cg->setNextAvailableBlockIndex(cg->getNextAvailableBlockIndex() - 1);
// Update current block index with BB_Start's block number.

//keeping proper track of block indexes by codegen, can comment out following
//cg->setCurrentBlockIndex(node->getBlock()->getNumber());
node->getLabel()->setInstruction(labelInstr);
}

Expand Down
6 changes: 1 addition & 5 deletions compiler/z/codegen/S390Instruction.hpp
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2020 IBM Corp. and others
* Copyright (c) 2000, 2021 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -467,7 +467,6 @@ class S390LabelInstruction : public TR::S390LabeledInstruction
{
if (op==TR::InstOpCode::LABEL)
sym->setInstruction(this);
cg->getNextAvailableBlockIndex();
}

S390LabelInstruction(TR::InstOpCode::Mnemonic op,
Expand All @@ -479,7 +478,6 @@ class S390LabelInstruction : public TR::S390LabeledInstruction
{
if (op==TR::InstOpCode::LABEL)
sym->setInstruction(this);
cg->getNextAvailableBlockIndex();
}

S390LabelInstruction(TR::InstOpCode::Mnemonic op,
Expand All @@ -491,7 +489,6 @@ class S390LabelInstruction : public TR::S390LabeledInstruction
{
if (op==TR::InstOpCode::LABEL)
sym->setInstruction(this);
cg->getNextAvailableBlockIndex();
}

S390LabelInstruction(TR::InstOpCode::Mnemonic op,
Expand All @@ -504,7 +501,6 @@ class S390LabelInstruction : public TR::S390LabeledInstruction
{
if (op==TR::InstOpCode::LABEL)
sym->setInstruction(this);
cg->getNextAvailableBlockIndex();
}

S390LabelInstruction(TR::InstOpCode::Mnemonic op,
Expand Down

0 comments on commit 4969afa

Please sign in to comment.