forked from eclipse-omr/omr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request eclipse-omr#1836 from 0dvictor/RCT
Introducing Recognized Call Transformer
- Loading branch information
Showing
9 changed files
with
164 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2017, 2017 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 | ||
* distribution and is available at http://eclipse.org/legal/epl-2.0 | ||
* or the Apache License, Version 2.0 which accompanies this distribution | ||
* and is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the | ||
* Eclipse Public License, v. 2.0 are satisfied: GNU General Public License, | ||
* version 2 with the GNU Classpath Exception [1] and GNU General Public | ||
* License, version 2 with the OpenJDK Assembly Exception [2]. | ||
* | ||
* [1] https://www.gnu.org/software/classpath/license.html | ||
* [2] http://openjdk.java.net/legal/assembly-exception.html | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
*******************************************************************************/ | ||
|
||
#include "optimizer/RecognizedCallTransformer.hpp" | ||
|
||
#include "il/Node.hpp" | ||
#include "il/Node_inlines.hpp" | ||
#include "il/TreeTop.hpp" | ||
#include "il/TreeTop_inlines.hpp" | ||
#include "infra/Checklist.hpp" // for NodeChecklist, etc | ||
#include "codegen/CodeGenerator.hpp" // for CodeGenerator | ||
|
||
TR::Optimization* OMR::RecognizedCallTransformer::create(TR::OptimizationManager *manager) | ||
{ | ||
return new (manager->allocator()) TR::RecognizedCallTransformer(manager); | ||
} | ||
|
||
int32_t OMR::RecognizedCallTransformer::perform() | ||
{ | ||
TR::NodeChecklist visited(comp()); | ||
for (auto treetop = comp()->getMethodSymbol()->getFirstTreeTop(); treetop != NULL; treetop = treetop->getNextTreeTop()) | ||
{ | ||
if (treetop->getNode()->getNumChildren() > 0) | ||
{ | ||
auto node = treetop->getNode()->getFirstChild(); | ||
if (node && node->getOpCode().isCall() && !visited.contains(node)) | ||
{ | ||
if (isInlineable(treetop) && | ||
performTransformation(comp(), "%s Transforming recognized call node [" POINTER_PRINTF_FORMAT "]\n", optDetailString(), node)) | ||
{ | ||
visited.add(node); | ||
transform(treetop); | ||
} | ||
} | ||
} | ||
} | ||
return 0; | ||
} | ||
|
||
const char* OMR::RecognizedCallTransformer::optDetailString() const throw() | ||
{ | ||
return "O^O RECOGNIZED CALL TRANSFORMER:"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2017, 2017 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 | ||
* distribution and is available at http://eclipse.org/legal/epl-2.0 | ||
* or the Apache License, Version 2.0 which accompanies this distribution | ||
* and is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the | ||
* Eclipse Public License, v. 2.0 are satisfied: GNU General Public License, | ||
* version 2 with the GNU Classpath Exception [1] and GNU General Public | ||
* License, version 2 with the OpenJDK Assembly Exception [2]. | ||
* | ||
* [1] https://www.gnu.org/software/classpath/license.html | ||
* [2] http://openjdk.java.net/legal/assembly-exception.html | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
*******************************************************************************/ | ||
|
||
#ifndef OMRRECOGNIZEDCALLTRANSFORMER_INCL | ||
#define OMRRECOGNIZEDCALLTRANSFORMER_INCL | ||
|
||
#include <stdint.h> // for int32_t, uint32_t, etc | ||
#include "il/Node.hpp" // for Node | ||
#include "optimizer/Optimization.hpp" // for Optimization | ||
#include "optimizer/OptimizationManager.hpp" // for OptimizationManager | ||
|
||
namespace OMR | ||
{ | ||
|
||
class RecognizedCallTransformer : public TR::Optimization | ||
{ | ||
public: | ||
|
||
RecognizedCallTransformer(TR::OptimizationManager* manager) | ||
: TR::Optimization(manager) | ||
{} | ||
static TR::Optimization* create(TR::OptimizationManager* manager); | ||
virtual int32_t perform(); | ||
virtual const char * optDetailString() const throw(); | ||
|
||
protected: | ||
|
||
virtual bool isInlineable(TR::TreeTop* treetop) { return false; } | ||
virtual void transform(TR::TreeTop* treetop) {} | ||
}; | ||
|
||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2017, 2017 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 | ||
* distribution and is available at http://eclipse.org/legal/epl-2.0 | ||
* or the Apache License, Version 2.0 which accompanies this distribution | ||
* and is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the | ||
* Eclipse Public License, v. 2.0 are satisfied: GNU General Public License, | ||
* version 2 with the GNU Classpath Exception [1] and GNU General Public | ||
* License, version 2 with the OpenJDK Assembly Exception [2]. | ||
* | ||
* [1] https://www.gnu.org/software/classpath/license.html | ||
* [2] http://openjdk.java.net/legal/assembly-exception.html | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
*******************************************************************************/ | ||
|
||
#ifndef TR_RECOGNIZEDCALLTRANSFORMER_INCL | ||
#define TR_RECOGNIZEDCALLTRANSFORMER_INCL | ||
|
||
#include "optimizer/OMRRecognizedCallTransformer.hpp" | ||
|
||
namespace TR { class OptimizationManager; } | ||
|
||
namespace TR | ||
{ | ||
|
||
class RecognizedCallTransformer : public OMR::RecognizedCallTransformer | ||
{ | ||
public: | ||
|
||
RecognizedCallTransformer(TR::OptimizationManager *manager) : | ||
OMR::RecognizedCallTransformer(manager) {} | ||
}; | ||
|
||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters