00001 //-*-c++-*- 00002 00003 /* 00004 * Copyright 2004, 2005, 2006 PathScale, Inc. All Rights Reserved. 00005 */ 00006 00007 // ==================================================================== 00008 // ==================================================================== 00009 // 00010 // Module: opt_project.cxx 00011 // $Revision: 1.1.1.1 $ 00012 // $Date: 2005/10/21 19:00:00 $ 00013 // $Author: marcel $ 00014 // $Source: /proj/osprey/CVS/open64/osprey1.0/be/opt/opt_project.cxx,v $ 00015 // 00016 // Revision history: 00017 // 26-MAR-97 rkennedy - Original Version 00018 // 00019 // ==================================================================== 00020 // 00021 // Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. 00022 // 00023 // This program is free software; you can redistribute it and/or modify 00024 // it under the terms of version 2 of the GNU General Public License as 00025 // published by the Free Software Foundation. 00026 // 00027 // This program is distributed in the hope that it would be useful, but 00028 // WITHOUT ANY WARRANTY; without even the implied warranty of 00029 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00030 // 00031 // Further, this software is distributed without any warranty that it 00032 // is free of the rightful claim of any third person regarding 00033 // infringement or the like. Any license provided herein, whether 00034 // implied or otherwise, applies only to this software file. Patent 00035 // licenses, if any, provided herein do not apply to combinations of 00036 // this program with other software, or any other product whatsoever. 00037 // 00038 // You should have received a copy of the GNU General Public License 00039 // along with this program; if not, write the Free Software Foundation, 00040 // Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 00041 // 00042 // Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, 00043 // Mountain View, CA 94043, or: 00044 // 00045 // http://www.sgi.com 00046 // 00047 // For further information regarding this notice, see: 00048 // 00049 // http://oss.sgi.com/projects/GenInfo/NoticeExplan 00050 // 00051 // ==================================================================== 00052 // 00053 // Description: 00054 // 00055 // Routines for special handling of operations that are "projectable" 00056 // in the sense of OPR_DIVREM. See opt_project.h for details. 00057 // 00058 // ==================================================================== 00059 // ==================================================================== 00060 00061 00062 #include "erglob.h" 00063 #include "opt_project.h" 00064 00065 // Given a CK_VAR coderep, find the RHS of a statement (if any) that 00066 // whose value ultimately gets stored to that variable through a 00067 // sequence of STID's whose LHS's are all EPRE_temp's that does not 00068 // pass through any phi. If no such sequence exists, we return NULL. 00069 STMTREP * 00070 Proj_defstmt(const CODEREP *const var, 00071 const OPT_STAB *const opt_stab) 00072 { 00073 const CODEREP *rhs = var; 00074 STMTREP *def; 00075 00076 do { 00077 // Because of copy-propagation and folding after SSAPRE, we can 00078 // see variables defined by chi assigned directly to EPRE 00079 // temporaries. In this case, this version of the EPRE temporary 00080 // cannot hold the result of a projectable operation. 00081 if (rhs->Is_flag_set(CF_DEF_BY_CHI) || 00082 rhs->Is_flag_set(CF_IS_ZERO_VERSION) ) 00083 { 00084 return NULL; 00085 } 00086 def = rhs->Defstmt(); 00087 if (def != NULL) { 00088 if (opt_stab->Aux_stab_entry(def->Lhs()->Aux_id())->EPRE_temp()) { 00089 rhs = def->Rhs(); 00090 } 00091 else { 00092 return NULL; 00093 } 00094 } 00095 } while ((def != NULL) && 00096 (rhs->Kind() == CK_VAR)); 00097 if ((def != NULL) && 00098 (rhs->Kind() == CK_OP)) { 00099 return def; 00100 } 00101 return NULL; 00102 }
1.5.6