Skip to content

Commit

Permalink
Migrate assocreg to the common codegen
Browse files Browse the repository at this point in the history
This pseudo-instruction is migrated to the common codegen. In addition
the Z codegen has been updated to use the new naming scheme used across
Power and AArch64 to use lowercase for these pseudo-instructions.
  • Loading branch information
fjeremic committed May 12, 2021
1 parent f2763d7 commit 8a1541b
Show file tree
Hide file tree
Showing 19 changed files with 40 additions and 41 deletions.
2 changes: 1 addition & 1 deletion compiler/aarch64/codegen/ARM64Debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ static const char *ARM64ExtendCodeNames[] =

static const char *opCodeToNameMap[] =
{
"assocreg",
"bad",
"cbzw",
"cbnzw",
Expand Down Expand Up @@ -751,7 +752,6 @@ static const char *opCodeToNameMap[] =
"dd",
"label",
"vgdnop",
"assocreg"
};

const char *
Expand Down
3 changes: 1 addition & 2 deletions compiler/aarch64/codegen/OMRInstOpCode.enum
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,5 @@
dd, // Define word
label, // Destination of a jump
vgdnop, // Virtual Guard NOP instruction
assocreg, // Associate real registers with Virtual registers.
ARM64LastOp = assocreg,
ARM64LastOp = vgdnop,
ARM64NumOpCodes = ARM64LastOp+1,
1 change: 1 addition & 0 deletions compiler/codegen/OMRInstOpCode.enum
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@
* definitions are permitted.
*/

assocreg, // Register Association
1 change: 0 additions & 1 deletion compiler/p/codegen/OMRInstOpCode.enum
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,6 @@
wrtbar, // Write barrier directive
proc, // Entry to the method
dd, // define word
assocreg, // Associate real registers with Virtual registers.
vgdnop, // Virtual Guard NOP instruction
probenop, // Probe NOP (for RI)
iflong, // compare and branch long
Expand Down
22 changes: 11 additions & 11 deletions compiler/p/codegen/OMRInstOpCodeProperties.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@
*/


{
/* .mnemonic = */ OMR::InstOpCode::assocreg,
/* .name = */ "assocreg",
/* .description = "Associate real registers with Virtual registers.", */
/* .prefix = */ 0x00000000,
/* .opcode = */ 0x00000000,
/* .format = */ FORMAT_NONE,
/* .minimumALS = */ OMR_PROCESSOR_PPC_UNKNOWN,
/* .properties = */ PPCOpProp_SyncSideEffectFree,
},

{
/* .mnemonic = */ OMR::InstOpCode::bad,
/* .name = */ "bad",
Expand Down Expand Up @@ -6257,17 +6268,6 @@
/* .properties = */ PPCOpProp_None,
},

{
/* .mnemonic = */ OMR::InstOpCode::assocreg,
/* .name = */ "assocreg",
/* .description = "Associate real registers with Virtual registers.", */
/* .prefix = */ 0x00000000,
/* .opcode = */ 0x00000000,
/* .format = */ FORMAT_NONE,
/* .minimumALS = */ OMR_PROCESSOR_PPC_UNKNOWN,
/* .properties = */ PPCOpProp_SyncSideEffectFree,
},

{
/* .mnemonic = */ OMR::InstOpCode::vgdnop,
/* .name = */ "vgdnop",
Expand Down
4 changes: 2 additions & 2 deletions compiler/p/codegen/OMRRegisterDependency.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ void OMR::Power::RegisterDependencyConditions::bookKeepingRegisterUses(TR::Instr
if (instr->getOpCodeValue() == TR::InstOpCode::assocreg)
return;

// Don't track associations or emit assocregs in outlined code
// Don't track associations or emit assocreg in outlined code
// Register assigner can save/restore associations across outlined sections properly, however no such mechanism exists for instruction selection
// so we don't want these associations to clobber the associations that were set in main line code, which are more important
// TODO: Fix this by saving/restoring the associations in swapInstructionListsWithCompilation()
Expand Down Expand Up @@ -570,7 +570,7 @@ void OMR::Power::RegisterDependencyConditions::bookKeepingRegisterUses(TR::Instr

if (numAssoc > 0)
{
// Emit an AssocRegs instruction to track the previous association
// Emit an assocreg instruction to track the previous association
assoc->setNumPostConditions(numAssoc, cg->trMemory());
generateDepInstruction(cg, TR::InstOpCode::assocreg, instr->getNode(), assoc, instr->getPrev());
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/p/codegen/OMRTreeEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4767,7 +4767,7 @@ TR::Register *OMR::Power::TreeEvaluator::BBEndEvaluator(TR::Node *node, TR::Code
numAssoc++;
}
}
// Emit an AssocRegs instruction to track the previous association
// Emit an assocreg instruction to track the previous association
if( numAssoc > 0 )
{
assoc->setNumPostConditions(numAssoc, cg->trMemory());
Expand Down
2 changes: 1 addition & 1 deletion compiler/p/codegen/PPCInstruction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ void TR::PPCDepInstruction::assignRegisters(TR_RegisterKinds kindToBeAssigned)
}
else
{
// Restore the register association using the ASSOCREGS instruction info
// Restore the register association using the assocreg instruction info
int i;
TR::RegisterDependencyConditions *assocreg = getDependencyConditions();
TR::RegisterDependency *assoc;
Expand Down
1 change: 1 addition & 0 deletions compiler/riscv/codegen/RVDebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

static const char *opCodeToNameMap[] =
{
"assocreg",
"bad",
/*
* RISC-V instructions
Expand Down
2 changes: 1 addition & 1 deletion compiler/z/codegen/InstOpCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ uint32_t
OMR::Z::InstOpCode::isAdmin()
{
return (_mnemonic == RET ||
_mnemonic == ASSOCREGS ||
_mnemonic == assocreg ||
_mnemonic == DEPEND ||
_mnemonic == FENCE ||
_mnemonic == PROC ||
Expand Down
1 change: 0 additions & 1 deletion compiler/z/codegen/OMRInstOpCode.enum
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

/* Pseudo Instructions */

ASSOCREGS, // Register Association
BAD, // Bad Opcode
BREAK, // Breakpoint (debugger)
DC, // DC
Expand Down
4 changes: 2 additions & 2 deletions compiler/z/codegen/OMRInstOpCodeProperties.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@


{
/* .mnemonic = */ OMR::InstOpCode::ASSOCREGS,
/* .name = */ "ASSOCREGS",
/* .mnemonic = */ OMR::InstOpCode::assocreg,
/* .name = */ "assocreg",
/* .description = */ "Register Association",
/* .opcode[0] = */ 0x00,
/* .opcode[1] = */ 0x00,
Expand Down
6 changes: 3 additions & 3 deletions compiler/z/codegen/OMRInstruction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,10 @@ OMR::Z::Instruction::initialize(TR::Instruction * precedingInstruction, bool ins

if (cond)
{
// Don't want to increment total use counts for ASSOCREGS instructions
// Don't want to increment total use counts for assocreg instructions
// because their register references will confuse the code that tries
// to determine when the first use of a register takes place
if (condFlag || self()->getOpCodeValue() != TR::InstOpCode::ASSOCREGS)
if (condFlag || self()->getOpCodeValue() != TR::InstOpCode::assocreg)
{
cond->bookKeepingRegisterUses(self(), cg);
if(cond->getPreConditions()) cond->getPreConditions()->incNumUses();
Expand Down Expand Up @@ -767,7 +767,7 @@ OMR::Z::Instruction::assignRegisters(TR_RegisterKinds kindToBeAssigned)
{
TR::Compilation *comp = self()->cg()->comp();

if (self()->getOpCodeValue() != TR::InstOpCode::ASSOCREGS)
if (self()->getOpCodeValue() != TR::InstOpCode::assocreg)
{
self()->assignRegistersAndDependencies(kindToBeAssigned);
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/z/codegen/OMRMachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4061,7 +4061,7 @@ OMR::Z::Machine::createRegisterAssociationDirective(TR::Instruction * cursor)
associations->addPostCondition(self()->getVirtualAssociatedWithReal(regNum), regNum);
}

TR::Instruction *cursor1 = new (self()->cg()->trHeapMemory(), TR_MemoryBase::S390Instruction) TR::Instruction(cursor, TR::InstOpCode::ASSOCREGS, associations, self()->cg());
TR::Instruction *cursor1 = new (self()->cg()->trHeapMemory(), TR_MemoryBase::S390Instruction) TR::Instruction(cursor, TR::InstOpCode::assocreg, associations, self()->cg());

if (cursor == self()->cg()->getAppendInstruction())
{
Expand Down
2 changes: 1 addition & 1 deletion compiler/z/codegen/OMRRegisterDependency.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ OMR::Z::RegisterDependencyConditions::usesRegister(TR::Register * r)
void
OMR::Z::RegisterDependencyConditions::bookKeepingRegisterUses(TR::Instruction * instr, TR::CodeGenerator * cg, int32_t oldPreCursor, int32_t oldPostCursor)
{
if (instr->getOpCodeValue() != TR::InstOpCode::ASSOCREGS)
if (instr->getOpCodeValue() != TR::InstOpCode::assocreg)
{
// We create a register association directive for each dependency

Expand Down
6 changes: 3 additions & 3 deletions compiler/z/codegen/OMRTreeEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2267,7 +2267,7 @@ tryGenerateCLCForComparison(TR::Node *node, TR::CodeGenerator *cg)
// ------------------------------
//
// [0x000003ff9e44be48] CLC Auto[<temp slot 57>] ?+0(3,GPR5), Shadow[<vft-symbol>] 0(&GPR_6161)
// [0x000003ff9e44c190] ASSOCREGS
// [0x000003ff9e44c190] assocreg
// [0x000003ff9e44bf88] BRC MASK3(0x6), Label L0175
//
// \\ gnu/testlet/java/text/DateFormat/Test.test(Lgnu/testlet/TestHarness;)V
Expand All @@ -2279,7 +2279,7 @@ tryGenerateCLCForComparison(TR::Node *node, TR::CodeGenerator *cg)
// \\ 354 JBinvokevirtual 52 gnu/testlet/java/text/DateFormat/Test.equals(Ljava/lang/Object;)Z
// \\ 19 JBifacmpeq 24
// 0x000003ffdf6cb13a 0000333e [0x000003ff9e44be48] d5 02 50 78 70 00 CLC Auto[<temp slot 57>] 120(3,GPR5), Shadow[<vft-symbol>] 0(GPR7)
// 0x000003ffdf6cb140 00003344 [0x000003ff9e44c190] ASSOCREGS
// 0x000003ffdf6cb140 00003344 [0x000003ff9e44c190] assocreg
// 0x000003ffdf6cb140 00003344 [0x000003ff9e44bf88] a7 64 12 fc BRC MASK3(0x6), Label L0175, labelTargetAddr=0x000003FFDF6CD738

bool operand1IsVFTSymbol = operand1->getOpCode().hasSymbolReference() && (operand1->getSymbolReference() == comp->getSymRefTab()->findVftSymbolRef());
Expand Down Expand Up @@ -9523,7 +9523,7 @@ OMR::Z::TreeEvaluator::BBEndEvaluator(TR::Node * node, TR::CodeGenerator * cg)
if (!nextTT || !nextTT->getNode()->getBlock()->isExtensionOfPreviousBlock())
{
if (cg->enableRegisterAssociations() &&
cg->getAppendInstruction()->getOpCodeValue() != TR::InstOpCode::ASSOCREGS)
cg->getAppendInstruction()->getOpCodeValue() != TR::InstOpCode::assocreg)
{
cg->machine()->createRegisterAssociationDirective(cg->getAppendInstruction());
}
Expand Down
8 changes: 4 additions & 4 deletions compiler/z/codegen/OpMemToMem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1527,7 +1527,7 @@ MemCmpVarLenMacroOp::generate(TR::Register* dstReg, TR::Register* srcReg, TR::Re
if(_startControlFlow==NULL)
{
_startControlFlow=cursorBefore->getNext();
if(_startControlFlow->getOpCodeValue() == TR::InstOpCode::ASSOCREGS) _startControlFlow=_startControlFlow->getNext();
if(_startControlFlow->getOpCodeValue() == TR::InstOpCode::assocreg) _startControlFlow=_startControlFlow->getNext();
}
if(_startControlFlow != _cursor)
{
Expand Down Expand Up @@ -1569,7 +1569,7 @@ MemCmpConstLenMacroOp::generate(TR::Register* dstReg, TR::Register* srcReg, TR::
if(_startControlFlow==NULL)
{
_startControlFlow=cursorBefore->getNext();
if(_startControlFlow->getOpCodeValue() == TR::InstOpCode::ASSOCREGS) _startControlFlow=_startControlFlow->getNext();
if(_startControlFlow->getOpCodeValue() == TR::InstOpCode::assocreg) _startControlFlow=_startControlFlow->getNext();
}
if(_startControlFlow != _cursor)
{
Expand Down Expand Up @@ -1663,7 +1663,7 @@ MemCmpVarLenSignMacroOp::generate(TR::Register* dstReg, TR::Register* srcReg, TR
if(_startControlFlow==NULL)
{
_startControlFlow=cursorBefore->getNext();
if(_startControlFlow->getOpCodeValue() == TR::InstOpCode::ASSOCREGS) _startControlFlow=_startControlFlow->getNext();
if(_startControlFlow->getOpCodeValue() == TR::InstOpCode::assocreg) _startControlFlow=_startControlFlow->getNext();
}
if(_startControlFlow != _cursor)
{
Expand Down Expand Up @@ -1712,7 +1712,7 @@ MemCmpConstLenSignMacroOp::generate(TR::Register* dstReg, TR::Register* srcReg,
if(_startControlFlow==NULL)
{
_startControlFlow=cursorBefore->getNext();
if(_startControlFlow->getOpCodeValue() == TR::InstOpCode::ASSOCREGS) _startControlFlow=_startControlFlow->getNext();
if(_startControlFlow->getOpCodeValue() == TR::InstOpCode::assocreg) _startControlFlow=_startControlFlow->getNext();
}
if(_startControlFlow != _cursor)
{
Expand Down
2 changes: 1 addition & 1 deletion compiler/z/codegen/OpMemToMem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class MemToMemMacroOp
if(_startControlFlow==NULL)
{
_startControlFlow=cursorBefore->getNext();
if(_startControlFlow->getOpCodeValue() == TR::InstOpCode::ASSOCREGS) _startControlFlow=_startControlFlow->getNext();
if(_startControlFlow->getOpCodeValue() == TR::InstOpCode::assocreg) _startControlFlow=_startControlFlow->getNext();
}
if(_startControlFlow != _cursor)
{
Expand Down
10 changes: 5 additions & 5 deletions compiler/z/codegen/S390Debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ TR_Debug::printz(TR::FILE *pOutFile, TR::Instruction * instr)
}

// dump the inst's pre deps
if (instr->getOpCodeValue() != TR::InstOpCode::ASSOCREGS && _comp->cg()->getCodeGeneratorPhase() <= TR::CodeGenPhase::BinaryEncodingPhase)
if (instr->getOpCodeValue() != TR::InstOpCode::assocreg && _comp->cg()->getCodeGeneratorPhase() <= TR::CodeGenPhase::BinaryEncodingPhase)
dumpDependencies(pOutFile, instr, true, false);

switch (instr->getKind())
Expand Down Expand Up @@ -352,10 +352,10 @@ TR_Debug::printz(TR::FILE *pOutFile, TR::Instruction * instr)
case TR::Instruction::IsNotExtended:
case TR::Instruction::IsE:
{
// ASSOCREGS piggy backs on a vanilla TR::Instruction
// if (instr->getOpCodeValue() == TR::InstOpCode::ASSOCREGS) break;
// assocreg piggy backs on a vanilla TR::Instruction
// if (instr->getOpCodeValue() == TR::InstOpCode::assocreg) break;

if ((instr->getOpCodeValue() == TR::InstOpCode::ASSOCREGS) && /*(debug("traceMsg90RA"))*/
if ((instr->getOpCodeValue() == TR::InstOpCode::assocreg) && /*(debug("traceMsg90RA"))*/
(_comp->getOption(TR_TraceRA)))
{
if (_comp->cg()->getCodeGeneratorPhase() < TR::CodeGenPhase::BinaryEncodingPhase)
Expand All @@ -371,7 +371,7 @@ TR_Debug::printz(TR::FILE *pOutFile, TR::Instruction * instr)
}

// dump the inst's post deps
if (instr->getOpCodeValue() != TR::InstOpCode::ASSOCREGS && _comp->cg()->getCodeGeneratorPhase() <= TR::CodeGenPhase::BinaryEncodingPhase)
if (instr->getOpCodeValue() != TR::InstOpCode::assocreg && _comp->cg()->getCodeGeneratorPhase() <= TR::CodeGenPhase::BinaryEncodingPhase)
dumpDependencies(pOutFile, instr, false, true);
}

Expand Down

0 comments on commit 8a1541b

Please sign in to comment.