Skip to content

Commit

Permalink
Add flag to disable loadaddr specialization in x86 MemoryReferences
Browse files Browse the repository at this point in the history
Presently in the x86 code generator, there is an optimization during
MemoryReference creation that always assumes that accesses to local
objects via a loadaddr should use the frame register, as opposed
to evaluating (or re-using) the register associated with the loadaddr
as the base register.

Add an environment variable `TR_useLoadAddrRegisterForLocalObjectMemRef`
to disable this optimization for diagnostic purposes.

Signed-off-by: Daryl Maier <maier@ca.ibm.com>
  • Loading branch information
0xdaryl committed Mar 18, 2021
1 parent 5839d6e commit 2b0dfe6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion compiler/x/codegen/OMRMemoryReference.cpp
Original file line number Diff line number Diff line change
@@ -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 @@ -189,7 +189,15 @@ OMR::X86::MemoryReference::MemoryReference(
// We can't do this when the access is unresolved.
//
TR::Node *base = rootLoadOrStore->getFirstChild();

// Use the register evaluated from the loadaddr as the base object
// in a memory reference rather than accessing directly from the
// stack.
//
static bool useLoadAddrRegisterForLocalObjectMemRef = feGetEnv("TR_useLoadAddrRegisterForLocalObjectMemRef") ? true : false;

if (!isUnresolved &&
!useLoadAddrRegisterForLocalObjectMemRef &&
base->getOpCodeValue() == TR::loadaddr &&
base->getSymbol()->isLocalObject())
{
Expand Down

0 comments on commit 2b0dfe6

Please sign in to comment.