C-Breeze
C Compiler Infrastructure

[ Project home page]

pointervalue.h

Go to the documentation of this file.
00001 // $Id: pointervalue.h,v 1.10 2003/08/07 23:14:31 pnav Exp $
00002 // ----------------------------------------------------------------------
00003 //
00004 //  C-Breeze
00005 //  C Compiler Framework
00006 // 
00007 //  Copyright (c) 2000 University of Texas at Austin
00008 // 
00009 //  Samuel Z. Guyer
00010 //  Daniel A. Jimenez
00011 //  Calvin Lin
00012 // 
00013 //  Permission is hereby granted, free of charge, to any person
00014 //  obtaining a copy of this software and associated documentation
00015 //  files (the "Software"), to deal in the Software without
00016 //  restriction, including without limitation the rights to use, copy,
00017 //  modify, merge, publish, distribute, sublicense, and/or sell copies
00018 //  of the Software, and to permit persons to whom the Software is
00019 //  furnished to do so, subject to the following conditions:
00020 //  
00021 //  The above copyright notice and this permission notice shall be
00022 //  included in all copies or substantial portions of the Software.
00023 //  
00024 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00025 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00026 //  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00027 //  NONINFRINGEMENT.  IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT
00028 //  AUSTIN BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
00029 //  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
00030 //  OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00031 //  THE SOFTWARE.
00032 //
00033 //  We acknowledge the C-to-C Translator from MIT Laboratory for
00034 //  Computer Science for inspiring parts of the C-Breeze design.
00035 //
00036 // ----------------------------------------------------------------------
00037 
00038 #ifndef CBZ_POINTERVALUE_H
00039 #define CBZ_POINTERVALUE_H
00040 
00041 #include "pointeroptions.h"
00042 #include "location.h"
00043 #include "memorymodel.h"
00044 #include "memoryblock.h"
00045 #include "ipanalysis.h"
00046 #include "handle.h"
00047 
00048 typedef pair< memoryBlock *, memoryUse * > pointer_use;
00049 typedef set< pointer_use > pointer_use_set;
00050 typedef pointer_use_set::iterator pointer_use_set_p;
00051 
00059 class pointerValue
00060 {
00061 public:
00062 
00063   static int count;
00064 
00065 public:
00066 
00072   memoryblock_set blocks;
00073 
00078   const constant * constant_value;
00079 
00084   bool is_address;
00085 
00090   bool is_a_use;
00091 
00097   memoryblock_set dereferenced;
00098 
00099 public:
00100 
00103   pointerValue();
00104 
00107   pointerValue(memoryBlock *mb, bool is_address = false);
00108 
00112   pointerValue(const pointerValue & other);
00113 
00117   ~pointerValue();
00118 
00121   inline void copy_pointers_from(const pointerValue & other) {
00122     blocks = other.blocks;
00123     is_address = other.is_address;
00124     dereferenced = other.dereferenced;
00125   }
00126 
00129   inline void initialize_pointers() {
00130     blocks.clear();
00131     is_address = false;
00132     dereferenced.clear();
00133   }
00134 
00137   inline void add_blocks_from(const pointerValue & other) {
00138     blocks.insert(other.blocks.begin(), other.blocks.end());
00139     is_address = other.is_address;
00140     dereferenced.insert(other.dereferenced.begin(),
00141                         other.dereferenced.end());
00142   }
00143 
00148   inline bool is_lvalue() { return ( ! is_address && ! blocks.empty()); }
00149 };
00150 
00151 typedef list< pointerValue > pointervalue_list;
00152 typedef pointervalue_list::iterator pointervalue_list_p;
00153 
00154 #endif // CBZ_POINTERVALUE_H

Generated on February 1, 2006
Back to the C-Breeze home page