Path: blob/master/runtime/compiler/optimizer/J9CFGSimplifier.hpp
6000 views
/*******************************************************************************1* Copyright (c) 2019, 2019 IBM Corp. and others2*3* This program and the accompanying materials are made available under4* the terms of the Eclipse Public License 2.0 which accompanies this5* distribution and is available at https://www.eclipse.org/legal/epl-2.0/6* or the Apache License, Version 2.0 which accompanies this distribution and7* is available at https://www.apache.org/licenses/LICENSE-2.0.8*9* This Source Code may also be made available under the following10* Secondary Licenses when the conditions for such availability set11* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU12* General Public License, version 2 with the GNU Classpath13* Exception [1] and GNU General Public License, version 2 with the14* OpenJDK Assembly Exception [2].15*16* [1] https://www.gnu.org/software/classpath/license.html17* [2] http://openjdk.java.net/legal/assembly-exception.html18*19* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception20*******************************************************************************/2122#ifndef J9_CFGSIMPLIFIER_INCL23#define J9_CFGSIMPLIFIER_INCL2425#include "optimizer/OMRCFGSimplifier.hpp"2627namespace J928{2930// Performs local common subexpression elimination within31// a basic block.32//3334class CFGSimplifier : public OMR::CFGSimplifier35{36public:3738CFGSimplifier(TR::OptimizationManager *manager) : OMR::CFGSimplifier(manager)39{}4041protected:42/**43* \brief44* This virtual function calls individual routines to try to match different `if` control flow structures45* for simplification.46*47* \parm needToDuplicateTree48* Boolean to indicate whether or not to duplicate node.49*50* \return Boolean that indicates whether tranformation is performed based on a matched pattern51*/52virtual bool simplifyIfPatterns(bool needToDuplicateTree);5354/**55* \brief56* This function tries to match an `ifacmpeq/ifacmpne` of NULL node with a throw of an NPE exception57* for the unresolved case and replace with a NULLCHK node58*59* \parm needToDuplicateTree60* Boolean to indicate whether or not to duplicate node.61*62* \return Boolean that indicates true if tranformation is performed based on a matched pattern.63*/64bool simplifyUnresolvedRequireNonNull(bool needToDuplicateTree);6566/**67* \brief68* This function tries to match an `ifacmpeq/ifacmpne` of NULL node with a throw of an NPE exception69* for the resolved case and replace with a NULLCHK node70*71* \parm needToDuplicateTree72* Boolean to indicate whether or not to duplicate node.73*74* \return Boolean that indicates true if tranformation is performed based on a matched pattern.75*/76bool simplifyResolvedRequireNonNull(bool needToDuplicateTree);7778};7980}8182#endif838485