Skip to content

Commit

Permalink
Common TR:addDependency()
Browse files Browse the repository at this point in the history
This commit consolidates copies of `TR::addDependency()` used by
aarch64, arm and p and moves it to the common code.

Signed-off-by: Jan Vrany <jan.vrany@fit.cvut.cz>
  • Loading branch information
janvrany committed Dec 14, 2020
1 parent f2f2788 commit cd1f7f8
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 208 deletions.
69 changes: 0 additions & 69 deletions compiler/aarch64/codegen/OMRCodeGeneratorUtils.hpp

This file was deleted.

68 changes: 0 additions & 68 deletions compiler/arm/codegen/OMRCodeGeneratorUtils.hpp

This file was deleted.

44 changes: 43 additions & 1 deletion compiler/codegen/OMRCodeGeneratorUtils.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019, 2019 IBM Corp. and others
* Copyright (c) 2019, 2020 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 @@ -33,4 +33,46 @@
* depending upon how they are expected to be used.
*/


#include <stddef.h>
#include "codegen/CodeGenerator.hpp"
#include "codegen/RealRegister.hpp"
#include "codegen/Register.hpp"
#include "codegen/RegisterConstants.hpp"
#include "codegen/RegisterDependency.hpp"


namespace TR
{

/**
* @brief Creates a pre and post condition for the specified virtual and real register
*
* @param[in] dep : TR::RegisterDependencyConditions to add the dependencies to
* @param[in] vreg : the virtual register. If NULL then a new virtual register of kind rk will
* be allocated
* @param[in] rnum : the real register
* @param[in] rk : the kind of register to allocate if one must be allocated. Otherwise, this
* parameter is ignored.
* @param[in] cg : CodeGenerator object
*/
static inline void
addDependency(
TR::RegisterDependencyConditions *dep,
TR::Register *vreg,
TR::RealRegister::RegNum rnum,
TR_RegisterKinds rk,
TR::CodeGenerator *cg)
{
if (vreg == NULL)
{
vreg = cg->allocateRegister(rk);
vreg->setPlaceholderReg();
}
dep->addPreCondition(vreg, rnum);
dep->addPostCondition(vreg, rnum);
}

} // namespace TR

#endif
70 changes: 0 additions & 70 deletions compiler/p/codegen/OMRCodeGeneratorUtils.hpp

This file was deleted.

0 comments on commit cd1f7f8

Please sign in to comment.