OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [cp/] [expr.c] - Diff between revs 816 and 826

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 816 Rev 826
/* Convert language-specific tree expression to rtl instructions,
/* Convert language-specific tree expression to rtl instructions,
   for GNU compiler.
   for GNU compiler.
   Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
   Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
   2000, 2001, 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
   2000, 2001, 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
 
 
This file is part of GCC.
This file is part of GCC.
 
 
GCC is free software; you can redistribute it and/or modify
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
the Free Software Foundation; either version 3, or (at your option)
any later version.
any later version.
 
 
GCC is distributed in the hope that it will be useful,
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
GNU General Public License for more details.
 
 
You should have received a copy of the GNU General Public License
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.  */
<http://www.gnu.org/licenses/>.  */
 
 
 
 
#include "config.h"
#include "config.h"
#include "system.h"
#include "system.h"
#include "coretypes.h"
#include "coretypes.h"
#include "tm.h"
#include "tm.h"
#include "rtl.h"
#include "rtl.h"
#include "tree.h"
#include "tree.h"
#include "flags.h"
#include "flags.h"
#include "expr.h"
#include "expr.h"
#include "cp-tree.h"
#include "cp-tree.h"
#include "toplev.h"
#include "toplev.h"
#include "except.h"
#include "except.h"
#include "tm_p.h"
#include "tm_p.h"
 
 
/* Expand C++-specific constants.  Currently, this means PTRMEM_CST.  */
/* Expand C++-specific constants.  Currently, this means PTRMEM_CST.  */
 
 
tree
tree
cplus_expand_constant (tree cst)
cplus_expand_constant (tree cst)
{
{
  switch (TREE_CODE (cst))
  switch (TREE_CODE (cst))
    {
    {
    case PTRMEM_CST:
    case PTRMEM_CST:
      {
      {
        tree type = TREE_TYPE (cst);
        tree type = TREE_TYPE (cst);
        tree member;
        tree member;
 
 
        /* Find the member.  */
        /* Find the member.  */
        member = PTRMEM_CST_MEMBER (cst);
        member = PTRMEM_CST_MEMBER (cst);
 
 
        if (TREE_CODE (member) == FIELD_DECL)
        if (TREE_CODE (member) == FIELD_DECL)
          {
          {
            /* Find the offset for the field.  */
            /* Find the offset for the field.  */
            cst = byte_position (member);
            cst = byte_position (member);
            while (!same_type_p (DECL_CONTEXT (member),
            while (!same_type_p (DECL_CONTEXT (member),
                                 TYPE_PTRMEM_CLASS_TYPE (type)))
                                 TYPE_PTRMEM_CLASS_TYPE (type)))
              {
              {
                /* The MEMBER must have been nestled within an
                /* The MEMBER must have been nestled within an
                   anonymous aggregate contained in TYPE.  Find the
                   anonymous aggregate contained in TYPE.  Find the
                   anonymous aggregate.  */
                   anonymous aggregate.  */
                member = lookup_anon_field (TYPE_PTRMEM_CLASS_TYPE (type),
                member = lookup_anon_field (TYPE_PTRMEM_CLASS_TYPE (type),
                                            DECL_CONTEXT (member));
                                            DECL_CONTEXT (member));
                cst = size_binop (PLUS_EXPR, cst, byte_position (member));
                cst = size_binop (PLUS_EXPR, cst, byte_position (member));
              }
              }
            cst = fold (build_nop (type, cst));
            cst = fold (build_nop (type, cst));
          }
          }
        else
        else
          {
          {
            tree delta;
            tree delta;
            tree pfn;
            tree pfn;
 
 
            expand_ptrmemfunc_cst (cst, &delta, &pfn);
            expand_ptrmemfunc_cst (cst, &delta, &pfn);
            cst = build_ptrmemfunc1 (type, delta, pfn);
            cst = build_ptrmemfunc1 (type, delta, pfn);
          }
          }
      }
      }
      break;
      break;
 
 
    default:
    default:
      /* There's nothing to do.  */
      /* There's nothing to do.  */
      break;
      break;
    }
    }
 
 
  return cst;
  return cst;
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.