Skip to content

Commit

Permalink
Add ObjectFormat getter/setter to CodeGenerator
Browse files Browse the repository at this point in the history
`getObjectFormat()`/`setObjectFormat()` answers or sets the ObjectFormat installed
for this CodeGenerator.

Issue: #5569

Signed-off-by: Daryl Maier <maier@ca.ibm.com>
  • Loading branch information
0xdaryl committed Jan 10, 2021
1 parent b4aa3f0 commit 7f8b6c3
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
7 changes: 5 additions & 2 deletions compiler/codegen/OMRCodeGenerator.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 @@ -244,7 +244,8 @@ OMR::CodeGenerator::CodeGenerator(TR::Compilation *comp) :
_outOfLineColdPathNestedDepth(0),
_codeGenPhase(self()),
_symbolDataTypeMap(comp->allocator()),
_lmmdFailed(false)
_lmmdFailed(false),
_objectFormat(NULL)
{
}

Expand Down Expand Up @@ -281,6 +282,8 @@ OMR::CodeGenerator::initialize()
}

cg->setIsLeafMethod();

cg->createObjectFormat();
}

TR_StackMemory
Expand Down
30 changes: 29 additions & 1 deletion compiler/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 @@ -98,6 +98,7 @@ namespace TR { class Instruction; }
namespace TR { class LabelSymbol; }
namespace TR { class Linkage; }
namespace TR { class MemoryReference; }
namespace TR { class ObjectFormat; }
namespace TR { class RealRegister; }
namespace TR { class Recompilation; }
namespace TR { class Register; }
Expand Down Expand Up @@ -1445,6 +1446,27 @@ class OMR_EXTENSIBLE CodeGenerator
*/
void redoTrampolineReservationIfNecessary(TR::Instruction *callInstr, TR::SymbolReference *instructionSymRef);

/**
* @brief
* Create the object format for this compilation. If the code generator
* does not support the use of object formats then this function does nothing.
*/
void createObjectFormat() { return; }

/**
* @return TR::ObjectFormat created for this \c TR::CodeGenerator. If the value
* returned is NULL then ObjectFormats are not supported.
*/
TR::ObjectFormat *getObjectFormat() { return _objectFormat; }

protected:
/**
* @brief Sets an ObjectFormat. Available to \c TR::CodeGenerator classes only.
*/
void setObjectFormat(TR::ObjectFormat *of) { _objectFormat = of; }

public:

// --------------------------------------------------------------------------

bool constantAddressesCanChangeSize(TR::Node *node);
Expand Down Expand Up @@ -2017,6 +2039,12 @@ class OMR_EXTENSIBLE CodeGenerator
TR_Stack<TR::Node *> _stackOfArtificiallyInflatedNodes;

CS2::HashTable<TR::Symbol*, TR::DataType, TR::Allocator> _symbolDataTypeMap;

/**
* The binary object format to generate code for in this compilation
*/
TR::ObjectFormat *_objectFormat;

};

}
Expand Down

0 comments on commit 7f8b6c3

Please sign in to comment.