diff -Nur nci/suif/suif2b/common/common_forwarders.h nci-latest/suif/suif2b/common/common_forwarders.h --- nci/suif/suif2b/common/common_forwarders.h Wed Feb 13 10:27:00 2002 +++ nci-latest/suif/suif2b/common/common_forwarders.h Wed Feb 13 10:26:40 2002 @@ -20,4 +20,6 @@ class IInteger; template class searchable_list; +#include "MString.h" // added by djp1 + #endif /* _COMMON_FORWARDERS_H_ */ diff -Nur nci/suif/suif2b/common/common_forwarders.h~ nci-latest/suif/suif2b/common/common_forwarders.h~ --- nci/suif/suif2b/common/common_forwarders.h~ Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/common/common_forwarders.h~ Wed Feb 13 10:25:57 2002 @@ -0,0 +1,23 @@ +#ifndef _COMMON_FORWARDERS_H_ +#define _COMMON_FORWARDERS_H_ + +#if defined(USE_STL) || defined(USE_STL_VECTOR) +#include +#define suif_vector vector +#else +template class suif_vector; +#endif + +#if defined(USE_STL) || defined(USE_STL_LIST) +#include +#else +template class suif_list; +#endif + +template class suif_hash_map; +template class suif_map; + +class IInteger; +template class searchable_list; + +#endif /* _COMMON_FORWARDERS_H_ */ diff -Nur nci/suif/suif2b/extratypes/Makefile nci-latest/suif/suif2b/extratypes/Makefile --- nci/suif/suif2b/extratypes/Makefile Mon Jul 31 21:22:04 2000 +++ nci-latest/suif/suif2b/extratypes/Makefile Wed Feb 13 10:26:07 2002 @@ -1,8 +1,11 @@ PACKAGES = ion tos string_enum bit_vector \ sgraph sgraph_algs \ iter_closure oosplay tree_bit_vector \ - gclist \ - lattice_utils + gclist \ + lattice_utils \ + extratypes \ + sgraph_dot + LIBS += -lcommon diff -Nur nci/suif/suif2b/extratypes/bit_vector/Makefile.deps nci-latest/suif/suif2b/extratypes/bit_vector/Makefile.deps --- nci/suif/suif2b/extratypes/bit_vector/Makefile.deps Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/bit_vector/Makefile.deps Wed Feb 13 10:26:07 2002 @@ -0,0 +1,42 @@ +# Dependencies for C files + +# Dependencies for C files + +CPP_TO_O_RULE = defined +C_TO_O_RULE = defined + +%.o: %.cpp %.cxx %.cc + -echo Can not build $*.o from $< without explicit dependency + -echo The Makefile.deps file was incorrectly generated + -echo All .o dependencies should be explicit in that file + +$(OBJDIR)/$(TARGET_LIB)/init.o: init.cpp bit_vector.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /sow/16/16/livshits/work/src/nci/include/common/MString.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h /sow/16/16/livshits/work/src/nci/include/common/simple_stack.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /sow/16/16/livshits/work/src/nci/include/common/i_integer.h /usr/include/stdio.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h /usr/include/bits/stdio_lim.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h /sow/16/16/livshits/work/src/nci/include/ion/ion.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/init.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) init.cpp + +$(OBJDIR)/$(TARGET_LIB)/bvector.o: bvector.cpp bvector.h bit_vector.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /sow/16/16/livshits/work/src/nci/include/common/MString.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h /sow/16/16/livshits/work/src/nci/include/common/simple_stack.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /sow/16/16/livshits/work/src/nci/include/common/i_integer.h /usr/include/stdio.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h /usr/include/bits/stdio_lim.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h /sow/16/16/livshits/work/src/nci/include/ion/ion.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/bvector.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) bvector.cpp + +$(OBJDIR)/$(TARGET_LIB)/standard_main.o: standard_main.cpp /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_forwarders.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_forwarders.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /sow/16/16/livshits/work/src/nci/include/common/common_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/MString.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h /sow/16/16/livshits/work/src/nci/include/common/simple_stack.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_messages.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_messages.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suif_env.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h /sow/16/16/livshits/work/src/nci/include/suifkernel/module_subsystem.h /sow/16/16/livshits/work/src/nci/include/suifkernel/token_stream.h /sow/16/16/livshits/work/src/nci/include/suifkernel/char_source.h /usr/include/g++-2/iostream.h /usr/include/g++-2/streambuf.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /sow/16/16/livshits/work/src/nci/include/suifpasses/suifpasses.h /sow/16/16/livshits/work/src/nci/include/suifpasses/standard_modules.h /sow/16/16/livshits/work/src/nci/include/suifkernel/module.h /sow/16/16/livshits/work/src/nci/include/suifpasses/passes.h /sow/16/16/livshits/work/src/nci/include/suifpasses/drivers.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/standard_main.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) standard_main.cpp + +$(OBJDIR)/$(TARGET_LIB)/cross_map.o: cross_map.cpp cross_map.h /sow/16/16/livshits/work/src/nci/include/common/machine_dependent.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h /sow/16/16/livshits/work/src/nci/include/common/common_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/suif_hash_map.h /sow/16/16/livshits/work/src/nci/include/common/suif_hash_fn.h /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/time.h /usr/include/endian.h /usr/include/bits/endian.h /usr/include/sys/select.h /usr/include/bits/select.h /usr/include/bits/sigset.h /usr/include/bits/time.h /usr/include/sys/sysmacros.h /usr/include/alloca.h /sow/16/16/livshits/work/src/nci/include/common/suif_vector.h /usr/include/g++-2/cstddef + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/cross_map.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) cross_map.cpp + +$(OBJDIR)/$(TARGET_LIB)/bit_vector.o: bit_vector.cpp /sow/16/16/livshits/work/src/nci/include/common/suif_copyright.h bit_vector.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /sow/16/16/livshits/work/src/nci/include/common/MString.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h /sow/16/16/livshits/work/src/nci/include/common/simple_stack.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /sow/16/16/livshits/work/src/nci/include/common/i_integer.h /usr/include/stdio.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h /usr/include/bits/stdio_lim.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h /sow/16/16/livshits/work/src/nci/include/ion/ion.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_messages.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_forwarders.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/common_forwarders.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_messages.h /usr/include/string.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/bit_vector.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) bit_vector.cpp + diff -Nur nci/suif/suif2b/extratypes/bit_vector/bit_vector.cpp nci-latest/suif/suif2b/extratypes/bit_vector/bit_vector.cpp --- nci/suif/suif2b/extratypes/bit_vector/bit_vector.cpp Wed Feb 13 10:27:00 2002 +++ nci-latest/suif/suif2b/extratypes/bit_vector/bit_vector.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* file "bit_vector.cpp" */ @@ -14,7 +15,7 @@ /* - This is the implementation of the suif_bit_vector class for sty, the + This is the implementation of the bit_vector class for sty, the first-level main library of the SUIF system. */ @@ -133,15 +134,20 @@ } +bool BitVector::_bit_vector_initialized = false; void BitVector::do_initialization(void) { + if(_bit_vector_initialized) return; _zero_block = new BitVectorBlock(0, false, 0); _ones_block = new BitVectorBlock(0, true, 0); + _bit_vector_initialized = true; } void BitVector::add_reference(BitVectorBlock *the_block) { + suif_assert_message(the_block, + ("Uninitialized block. require_DLL(\"bit_vector\")")); if (the_block->_reference_count != SIZE_T_MAX) ++(the_block->_reference_count); } @@ -308,7 +314,7 @@ _block = other._block; add_reference(_block); _has_count = other._has_count; - _count = other._has_count; + _count = other._count; } } @@ -456,6 +462,24 @@ } } +void BitVector::print_long(ion *the_ion) const + { + the_ion->printf("("); + if (get_infinity_bit()) { + the_ion->printf("^"); + } + bool first = true; + for (BitVectorIter iter(this); iter.is_valid(); iter.next()) { + size_t bit = iter.current(); + if (first) + first = false; + else + the_ion->printf(" ", bit); + the_ion->printf("%d", bit); + } + the_ion->printf(")"); + } + bool BitVector::is_equal_to(const BitVector &other) const { if (_block == other._block) @@ -1622,7 +1646,7 @@ if (get_infinity_bit()) { this_chunk = ~this_chunk; } { - for (BitVector::ChunkT this_chunk = get_chunk(chunk_num); + for (BitVector::ChunkT this_chunk = get_chunk(chunk_num); this_chunk != 0; this_chunk >>= (BITS_PER_CHAR)) { unsigned char c = this_chunk & ((1U << BITS_PER_CHAR)-1); count += byte_count_table[c]; diff -Nur nci/suif/suif2b/extratypes/bit_vector/bit_vector.cpp~ nci-latest/suif/suif2b/extratypes/bit_vector/bit_vector.cpp~ --- nci/suif/suif2b/extratypes/bit_vector/bit_vector.cpp~ Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/bit_vector/bit_vector.cpp~ Wed Feb 13 10:26:07 2002 @@ -0,0 +1,1775 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* file "bit_vector.cpp" */ + + +/* + Copyright (c) 1997-1999 Stanford University + + All rights reserved. + + This software is provided under the terms described in + the "suif_copyright.h" include file. +*/ + +#include + + +/* + This is the implementation of the bit_vector class for sty, the + first-level main library of the SUIF system. +*/ + + +// This is now defined in machine_dependent.h +#define SIZE_T_MAX ((sizeof(size_t) == sizeof(unsigned long)) ? ULONG_MAX : \ + UINT_MAX) + + +#include "bit_vector.h" +#include +#include + + +#define BITS_PER_WORD (sizeof(BitVector::ChunkT) * 8) +#define BITS_PER_CHAR 8 + +class BitVectorBlock + { + friend class BitVector; + +private: + BitVector::ChunkT *_data; + size_t _data_length; + size_t _data_space; + bool _infinity_bit_is_one; + size_t _num_significant_bits; + size_t _reference_count; + + BitVectorBlock(size_t init_data_space, + bool init_infinity_bit_is_one, + size_t init_num_significant_bits); + ~BitVectorBlock(void); + + void expand_data(size_t new_data_length); + void unpad(void); + BitVectorBlock(const BitVectorBlock &); + BitVectorBlock &operator=(const BitVectorBlock &); + }; + + +BitVectorBlock *BitVector::_zero_block; +BitVectorBlock *BitVector::_ones_block; + +BitVectorBlock::BitVectorBlock(size_t init_data_space, + bool init_infinity_bit_is_one, size_t init_num_significant_bits) + { + if (init_data_space == 0) + _data = NULL; + else + _data = new BitVector::ChunkT[init_data_space]; + _data_length = init_data_space; + _data_space = init_data_space; + _infinity_bit_is_one = init_infinity_bit_is_one; + _num_significant_bits = init_num_significant_bits; + _reference_count = 1; + } + +BitVectorBlock::~BitVectorBlock(void) + { + assert(_reference_count == 0); + if (_data != NULL) + delete[] _data; + } + +void BitVectorBlock::expand_data(size_t new_data_length) + { + suif_assert(new_data_length >= 0); + if (new_data_length <= _data_length) + return; + if (new_data_length > _data_space) + { + BitVector::ChunkT *new_data = new BitVector::ChunkT[new_data_length]; + for (size_t chunk_num = 0; chunk_num < _data_length; ++chunk_num) + new_data[chunk_num] = _data[chunk_num]; + if (_data != NULL) + delete[] _data; + _data = new_data; + _data_space = new_data_length; + } + BitVector::ChunkT mask = 0; + if (_infinity_bit_is_one) + mask = ~0; + for (size_t chunk_num = _data_length; chunk_num < new_data_length; + ++chunk_num) + { + _data[chunk_num] = mask; + } + _data_length = new_data_length; + } + +void BitVectorBlock::unpad(void) + { + BitVector::ChunkT mask = 0; + if (_infinity_bit_is_one) + mask = ~0; + while (_data_length > 0) + { + if (_data[_data_length - 1] != mask) + break; + --_data_length; + } + _num_significant_bits = _data_length * BITS_PER_WORD; + if (_data_length == 0) + return; + mask = ((BitVector::ChunkT)1) << (BITS_PER_WORD - 1); + BitVector::ChunkT test_block = _data[_data_length - 1]; + if (_infinity_bit_is_one) + test_block = ~test_block; + while ((mask & test_block) == 0) + { + mask >>= 1; + assert(mask != 0); + --_num_significant_bits; + } + } + + +bool BitVector::_bit_vector_initialized = false; + +void BitVector::do_initialization(void) + { + if(_bit_vector_initialized) return; + _zero_block = new BitVectorBlock(0, false, 0); + _ones_block = new BitVectorBlock(0, true, 0); + _bit_vector_initialized = true; + } + +void BitVector::add_reference(BitVectorBlock *the_block) + { + suif_assert_message(the_block, + ("Uninitialized block. require_DLL(\"bit_vector\")")); + if (the_block->_reference_count != SIZE_T_MAX) + ++(the_block->_reference_count); + } + +void BitVector::remove_reference(BitVectorBlock *the_block) + { + assert(the_block->_reference_count > 0); + if (the_block->_reference_count != SIZE_T_MAX) + { + --(the_block->_reference_count); + if (the_block->_reference_count == 0) + delete the_block; + } + } + +void BitVector::make_changable(void) + { + if (_block->_reference_count > 1) + { + BitVectorBlock *new_block = + new BitVectorBlock(_block->_data_length, + _block->_infinity_bit_is_one, + _block->_num_significant_bits); + for (size_t chunk_num = 0; chunk_num < _block->_data_length; + ++chunk_num) + { + new_block->_data[chunk_num] = _block->_data[chunk_num]; + } + remove_reference(_block); + _block = new_block; + } + _has_count = false; + } + +unsigned char BitVector::convert_from_hex(char hex_char) + { + if ((hex_char >= '0') && (hex_char <= '9')) + return hex_char - '0'; + else if ((hex_char >= 'a') && (hex_char <= 'f')) + return (hex_char - 'a') + 10; + else if ((hex_char >= 'A') && (hex_char <= 'F')) + return (hex_char - 'A') + 10; + else + return 16; + } + +BitVector::BitVector(void) : + _block(_zero_block), + _count(0), + _has_count(true) +{ + add_reference(_zero_block); +} + +BitVector::BitVector(const BitVector &other) : + _block(other._block), + _count(other._count), + _has_count(other._has_count) +{ + add_reference(_block); +} + +BitVector::~BitVector(void) + { + remove_reference(_block); + } + +bool BitVector::get_bit(size_t bit_num) const + { + suif_assert(bit_num >= 0); + size_t chunk_num = bit_num / (size_t)BITS_PER_WORD; + if (chunk_num >= _block->_data_length) + return _block->_infinity_bit_is_one; + BitVector::ChunkT mask = + ((BitVector::ChunkT)1) << (bit_num % (size_t)BITS_PER_WORD); + return (((_block->_data[chunk_num] & mask) == 0) ? false : true); + } + +bool BitVector::get_infinity_bit(void) const + { + return _block->_infinity_bit_is_one; + } + +size_t BitVector::num_significant_bits(void) const + { + return _block->_num_significant_bits; + } +size_t BitVector::get_chunk_count() const { + size_t chunk_count = + ((num_significant_bits() + (BITS_PER_WORD) - 1) / BITS_PER_WORD); + return(chunk_count); +} + +BitVector::ChunkT BitVector::get_chunk(size_t chunk_num) const + { + suif_assert(chunk_num >= 0); + if (chunk_num >= _block->_data_length) + { + return (_block->_infinity_bit_is_one ? ~(BitVector::ChunkT)0 : + (BitVector::ChunkT)0); + } + return _block->_data[chunk_num]; + } + +void BitVector::set_bit(size_t bit_num, bool new_value) + { + suif_assert(bit_num >= 0); + if ((bit_num >= _block->_num_significant_bits) && + (new_value == _block->_infinity_bit_is_one)) + { + return; + } + make_changable(); + size_t chunk_num = bit_num / (size_t)BITS_PER_WORD; + if (chunk_num >= _block->_data_length) + _block->expand_data(chunk_num + 1); + BitVector::ChunkT mask = + ((BitVector::ChunkT)1) << (bit_num % (size_t)BITS_PER_WORD); + if (new_value) + _block->_data[chunk_num] |= mask; + else + _block->_data[chunk_num] &= ~mask; + if (bit_num >= _block->_num_significant_bits) + _block->_num_significant_bits = bit_num + 1; + _block->unpad(); + } + +void BitVector::set_chunk(size_t chunk_num, BitVector::ChunkT new_chunk) + { + suif_assert(chunk_num >= 0); + make_changable(); + if (chunk_num >= _block->_data_length) + _block->expand_data(chunk_num + 1); + _block->_data[chunk_num] = new_chunk; + size_t bit_num = (chunk_num + 1) * (size_t)BITS_PER_WORD; + if (bit_num > _block->_num_significant_bits) + _block->_num_significant_bits = bit_num; + _block->unpad(); + } + +void BitVector::set_to_zero(void) + { + remove_reference(_block); + _block = _zero_block; + add_reference(_block); + _has_count = true; + _count = 0; + } + +void BitVector::set_to_ones(void) + { + _has_count = true; + _count = 0; + remove_reference(_block); + _block = _ones_block; + add_reference(_block); + } + +void BitVector::operator=(const BitVector &other) + { + if (_block != other._block) + { + remove_reference(_block); + _block = other._block; + add_reference(_block); + _has_count = other._has_count; + _count = other._has_count; + } + } + +String BitVector::to_string(void) const + { + static char *buffer = NULL; + static size_t buffer_size = 0; + + size_t new_size = written_length() + 1; + if (new_size > buffer_size) + { + if (buffer != NULL) + delete[] buffer; + buffer = new char[new_size]; + buffer_size = new_size; + } + write(buffer); + return String(buffer); + } + +void BitVector::from_string(String new_value) + { + read(new_value.c_str()); + } + +IInteger BitVector::to_i_integer(void) const + { + size_t length = _block->_data_length; + IInteger result = (_block->_infinity_bit_is_one ? -1 : 0); + for (size_t chunk_num = length; chunk_num > 0; --chunk_num) + { + result = ((result << BITS_PER_WORD) | + _block->_data[chunk_num - 1]); + } + return result; + } + +void BitVector::from_i_integer(IInteger new_value) + { + if (new_value < 0) + { + from_i_integer(~new_value); + *this = invert(); + return; + } + IInteger ii_hex_length = new_value.written_length(16); + if (!ii_hex_length.is_c_size_t()) + suif_error("out of memory address space"); + size_t hex_length = ii_hex_length.c_size_t(); + char *buffer = new char[hex_length + 3]; + buffer[0] = '0'; + buffer[1] = 'x'; + new_value.write(&(buffer[2]), 16); + read(buffer); + delete[] buffer; + } + +size_t BitVector::written_length(void) const + { + return 7 + (_block->_data_length * sizeof(BitVector::ChunkT) * 2); + } + +void BitVector::write(char *location) const + { + size_t length = _block->_data_length; + sprintf(location, "0x...%02x", + (_block->_infinity_bit_is_one ? 0xff : 0x00)); + char *position = &(location[7]); + for (size_t chunk_num = length; chunk_num > 0; --chunk_num) + { + sprintf(position, "%0*lx", (int)(sizeof(BitVector::ChunkT)) * 2, + _block->_data[chunk_num - 1]); + position += sizeof(BitVector::ChunkT) * 2; + } + } + +void BitVector::read(const char *location) + { + _has_count = false; + _count = 0; + const char *follow = location; + suif_assert((*follow == '0') && (follow[1] == 'x')); + follow += 2; + bool sign_extend = (*follow == '.'); + while (*follow == '.') + ++follow; + const char *end = follow; + while (*end != 0) + ++end; + suif_assert(end > follow); + remove_reference(_block); + size_t hex_digits_per_word = sizeof(BitVector::ChunkT) * 2; + bool infinity_is_one = + (sign_extend ? ((*follow > '7') || (*follow < '0')) : false); + size_t word_count = + ((end - follow) + hex_digits_per_word - 1) / hex_digits_per_word; + _block = new BitVectorBlock(word_count, infinity_is_one, word_count); + size_t word_num = word_count; + if (((end - follow) % hex_digits_per_word) > 0) + { + BitVector::ChunkT high_word = (infinity_is_one ? ~0lu : 0lu); + while (((end - follow) % hex_digits_per_word) > 0) + { + unsigned char new_half_byte = convert_from_hex(*follow); + suif_assert(new_half_byte != 16); + high_word = (high_word << 4) | new_half_byte; + ++follow; + } + --word_num; + _block->_data[word_num] = high_word; + } + while (follow < end) + { + BitVector::ChunkT this_word = 0; + for (size_t digit_num = 0; digit_num < hex_digits_per_word; + ++digit_num) + { + unsigned char new_half_byte = convert_from_hex(*follow); + suif_assert(new_half_byte != 16); + this_word = (this_word << 4) | new_half_byte; + ++follow; + } + --word_num; + _block->_data[word_num] = this_word; + } + assert(follow == end); + assert(word_num == 0); + _block->unpad(); + } + +void BitVector::print(FILE *fp) const + { + file_ion the_ion(fp); + print(&the_ion); + } + +void BitVector::print(ion *the_ion) const + { + size_t length = _block->_data_length; + the_ion->printf("0x...%02x", (_block->_infinity_bit_is_one ? 0xff : 0x00)); + for (size_t chunk_num = length; chunk_num > 0; --chunk_num) + { + the_ion->printf("%0*lx", (int)(sizeof(BitVector::ChunkT)) * 2, + _block->_data[chunk_num - 1]); + } + } + +void BitVector::print_long(ion *the_ion) const + { + the_ion->printf("("); + if (get_infinity_bit()) { + the_ion->printf("^"); + } + bool first = true; + for (BitVectorIter iter(this); iter.is_valid(); iter.next()) { + size_t bit = iter.current(); + if (first) + first = false; + else + the_ion->printf(" ", bit); + the_ion->printf("%d", bit); + } + the_ion->printf(")"); + } + +bool BitVector::is_equal_to(const BitVector &other) const + { + if (_block == other._block) + return true; + if (_block->_infinity_bit_is_one != other._block->_infinity_bit_is_one) + return false; + if (_block->_num_significant_bits != other._block->_num_significant_bits) + return false; + size_t length = _block->_data_length; + assert(length == other._block->_data_length); + for (size_t chunk_num = 0; chunk_num < length; ++chunk_num) + { + if (_block->_data[chunk_num] != other._block->_data[chunk_num]) + return false; + } + return true; + } + +bool BitVector::is_less_than(const BitVector &other) const + { + if (_block == other._block) + return false; + if (_block->_infinity_bit_is_one && (!other._block->_infinity_bit_is_one)) + return true; + if ((!_block->_infinity_bit_is_one) && other._block->_infinity_bit_is_one) + return false; + if (_block->_num_significant_bits > other._block->_num_significant_bits) + return _block->_infinity_bit_is_one; + if (_block->_num_significant_bits < other._block->_num_significant_bits) + return !(_block->_infinity_bit_is_one); + size_t length = _block->_data_length; + assert(length == other._block->_data_length); + size_t chunk_num = length; + while (chunk_num > 0) + { + --chunk_num; + if (_block->_data[chunk_num] > other._block->_data[chunk_num]) + return _block->_infinity_bit_is_one; + if (_block->_data[chunk_num] < other._block->_data[chunk_num]) + return !(_block->_infinity_bit_is_one); + } + return false; + } + +BitVector BitVector::invert(void) const + { + BitVector result(*this); + result.make_changable(); + size_t length = _block->_data_length; + for (size_t chunk_num = 0; chunk_num < length; ++chunk_num) + result._block->_data[chunk_num] = ~(_block->_data[chunk_num]); + result._block->_infinity_bit_is_one = !(_block->_infinity_bit_is_one); + return result; + } + +BitVector BitVector::operator^(const BitVector &other) const + { + BitVector result = *this; + result ^= other; + return result; + } + +BitVector BitVector::operator&(const BitVector &other) const + { + BitVector result = *this; + result &= other; + return result; + } + +BitVector BitVector::operator|(const BitVector &other) const + { + BitVector result = *this; + result |= other; + return result; + } + +BitVector BitVector::operator~(void) const + { + return invert(); + } + +BitVector BitVector::operator<<(size_t shift_amount) const + { + BitVector result = *this; + result <<= shift_amount; + return result; + } + +BitVector BitVector::operator>>(size_t shift_amount) const + { + BitVector result = *this; + result >>= shift_amount; + return result; + } + +bool BitVector::operator!(void) const + { + return ((_block->_data_length == 0) && (!_block->_infinity_bit_is_one)); + } + +void BitVector::operator^=(const BitVector &other) + { + make_changable(); + size_t length = _block->_data_length; + size_t other_length = other._block->_data_length; + size_t common_length = + ((other_length > length) ? length : other_length); + for (size_t chunk_num = 0; chunk_num < common_length; ++chunk_num) + _block->_data[chunk_num] ^= other._block->_data[chunk_num]; + if (other_length > length) + { + _block->expand_data(other_length); + if (_block->_infinity_bit_is_one) + { + for (size_t chunk_num = length; chunk_num < other_length; + ++chunk_num) + { + _block->_data[chunk_num] = ~(other._block->_data[chunk_num]); + } + } + else + { + for (size_t chunk_num = length; chunk_num < other_length; + ++chunk_num) + { + _block->_data[chunk_num] = other._block->_data[chunk_num]; + } + } + } + else + { + if (other._block->_infinity_bit_is_one) + { + for (size_t chunk_num = other_length; chunk_num < length; + ++chunk_num) + { + _block->_data[chunk_num] = ~(_block->_data[chunk_num]); + } + } + } + _block->_infinity_bit_is_one = + ((_block->_infinity_bit_is_one ? 1 : 0) ^ + (other._block->_infinity_bit_is_one ? 1 : 0) == 1); + if (other._block->_num_significant_bits > _block->_num_significant_bits) + _block->_num_significant_bits = other._block->_num_significant_bits; + _block->unpad(); + } + +void BitVector::operator&=(const BitVector &other) + { + make_changable(); + size_t length = _block->_data_length; + size_t other_length = other._block->_data_length; + size_t common_length = + ((other_length > length) ? length : other_length); + for (size_t chunk_num = 0; chunk_num < common_length; ++chunk_num) + _block->_data[chunk_num] &= other._block->_data[chunk_num]; + if (other_length > length) + { + if (_block->_infinity_bit_is_one) + { + _block->expand_data(other_length); + for (size_t chunk_num = length; chunk_num < other_length; + ++chunk_num) + { + _block->_data[chunk_num] = other._block->_data[chunk_num]; + } + _block->_num_significant_bits = + other._block->_num_significant_bits; + } + } + else if (other_length < length) + { + if (!other._block->_infinity_bit_is_one) + { + _block->_data_length = other_length; + _block->_num_significant_bits = + other._block->_num_significant_bits; + } + } + else + { + if (other._block->_num_significant_bits > + _block->_num_significant_bits) + { + _block->_num_significant_bits = + other._block->_num_significant_bits; + } + } + _block->_infinity_bit_is_one = + ((_block->_infinity_bit_is_one ? 1 : 0) & + (other._block->_infinity_bit_is_one ? 1 : 0) == 1); + _block->unpad(); + } + +void BitVector::operator|=(const BitVector &other) + { + make_changable(); + size_t length = _block->_data_length; + size_t other_length = other._block->_data_length; + size_t common_length = + ((other_length > length) ? length : other_length); + for (size_t chunk_num = 0; chunk_num < common_length; ++chunk_num) + _block->_data[chunk_num] |= other._block->_data[chunk_num]; + if (other_length > length) + { + if (!_block->_infinity_bit_is_one) + { + _block->expand_data(other_length); + for (size_t chunk_num = length; chunk_num < other_length; + ++chunk_num) + { + _block->_data[chunk_num] = other._block->_data[chunk_num]; + } + _block->_num_significant_bits = + other._block->_num_significant_bits; + } + } + else if (other_length < length) + { + if (other._block->_infinity_bit_is_one) + { + _block->_data_length = other_length; + _block->_num_significant_bits = + other._block->_num_significant_bits; + } + } + else + { + if (other._block->_num_significant_bits > + _block->_num_significant_bits) + { + _block->_num_significant_bits = + other._block->_num_significant_bits; + } + } + _block->_infinity_bit_is_one = + ((_block->_infinity_bit_is_one ? 1 : 0) | + (other._block->_infinity_bit_is_one ? 1 : 0) == 1); + _block->unpad(); + } + +void BitVector::operator>>=(size_t shift_amount) + { + if (shift_amount < 0) + { + (*this) <<= -shift_amount; + return; + } + if (_block->_num_significant_bits == 0) + return; + if (_block->_num_significant_bits <= shift_amount) + { + if (_block->_infinity_bit_is_one) + set_to_ones(); + else + set_to_zero(); + return; + } + make_changable(); + size_t orig_significant_bits = _block->_num_significant_bits; + size_t new_significant_bits = orig_significant_bits - shift_amount; + _block->_num_significant_bits = new_significant_bits; + size_t length = _block->_data_length; + size_t shift_div = shift_amount / BITS_PER_WORD; + size_t shift_mod = shift_amount % BITS_PER_WORD; + size_t new_length = + (new_significant_bits + (BITS_PER_WORD - 1)) / BITS_PER_WORD; + if (shift_amount % 8 == 0) + { + memmove((char *)(_block->_data), + ((char *)(_block->_data)) + (shift_amount / 8), + (new_significant_bits + 7) / 8); + size_t leftover_bytes_written = + ((((new_significant_bits + 7) / 8)) % sizeof(BitVector::ChunkT)); + if (leftover_bytes_written != 0) + { + if (_block->_infinity_bit_is_one) + { + _block->_data[new_length - 1] |= + ((~0ul) << (leftover_bytes_written * 8)); + } + else + { + _block->_data[new_length - 1] &= + ~((~0ul) << (leftover_bytes_written * 8)); + } + } + } + else + { + BitVector::ChunkT carry_bits = (_block->_data[shift_div] >> shift_mod); + for (size_t chunk_num = 0; chunk_num < new_length - 1; --chunk_num) + { + BitVector::ChunkT word_in = _block->_data[chunk_num + shift_div + 1]; + BitVector::ChunkT carry_out = (word_in >> shift_mod); + BitVector::ChunkT word_out = + ((word_in << (BITS_PER_WORD - shift_mod)) | carry_bits); + _block->_data[chunk_num] = word_out; + carry_bits = carry_out; + } + BitVector::ChunkT last_word_in; + if (new_length + shift_div < length) + last_word_in = _block->_data[new_length + shift_div]; + else + last_word_in = (_block->_infinity_bit_is_one ? ~0ul : 0ul); + _block->_data[new_length - 1] = + ((last_word_in << (BITS_PER_WORD - shift_mod)) | carry_bits); + } + _block->_data_length = new_length; + } + +void BitVector::operator<<=(size_t shift_amount) + { + if (shift_amount < 0) + { + (*this) >>= -shift_amount; + return; + } + if ((_block->_num_significant_bits == 0) && + (!_block->_infinity_bit_is_one)) + { + return; + } + make_changable(); + size_t orig_significant_bits = _block->_num_significant_bits; + size_t new_significant_bits = orig_significant_bits + shift_amount; + _block->_num_significant_bits = new_significant_bits; + size_t length = _block->_data_length; + size_t shift_div = shift_amount / BITS_PER_WORD; + size_t shift_mod = shift_amount % BITS_PER_WORD; + size_t new_length = + (new_significant_bits + (BITS_PER_WORD - 1)) / BITS_PER_WORD; + _block->expand_data(new_length); + if (shift_amount % 8 == 0) + { + memmove(((char *)(_block->_data)) + (shift_amount / 8), + (char *)(_block->_data), (orig_significant_bits + 7) / 8); + memset((char *)(_block->_data), 0, shift_amount / 8); + size_t leftover_bytes_written = + ((((new_significant_bits + 7) / 8)) % sizeof(BitVector::ChunkT)); + if (leftover_bytes_written != 0) + { + if (_block->_infinity_bit_is_one) + { + _block->_data[new_length - 1] |= + ((~0ul) << (leftover_bytes_written * 8)); + } + else + { + _block->_data[new_length - 1] &= + ~((~0ul) << (leftover_bytes_written * 8)); + } + } + } + else + { + BitVector::ChunkT carry_bits; + size_t start_chunk; + if (length + shift_div < new_length) + { + carry_bits = + ((_block->_infinity_bit_is_one ? ~0ul : 0ul) << shift_mod); + start_chunk = length; + } + else + { + carry_bits = (_block->_data[length - 1] << shift_mod); + start_chunk = length - 1; + } + for (size_t chunk_num = start_chunk; chunk_num > 0; --chunk_num) + { + BitVector::ChunkT word_in = _block->_data[chunk_num - 1]; + BitVector::ChunkT carry_out = (word_in << shift_mod); + BitVector::ChunkT word_out = + ((word_in >> (BITS_PER_WORD - shift_mod)) | carry_bits); + _block->_data[chunk_num + shift_div] = word_out; + carry_bits = carry_out; + } + _block->_data[shift_div] = carry_bits; + memset((char *)(_block->_data), 0, shift_div); + } + } + +bool BitVector::do_and_with_test(const BitVector &other) + { + bool result = false; + make_changable(); + size_t length = _block->_data_length; + size_t other_length = other._block->_data_length; + size_t common_length = + ((other_length > length) ? length : other_length); + for (size_t chunk_num = 0; chunk_num < common_length; ++chunk_num) + { + BitVector::ChunkT orig_chunk = _block->_data[chunk_num]; + BitVector::ChunkT new_chunk = orig_chunk & other._block->_data[chunk_num]; + _block->_data[chunk_num] = new_chunk; + if (orig_chunk != new_chunk) + result = true; + } + if (other_length > length) + { + if (_block->_infinity_bit_is_one) + { + _block->expand_data(other_length); + for (size_t chunk_num = length; chunk_num < other_length; + ++chunk_num) + { + _block->_data[chunk_num] = other._block->_data[chunk_num]; + } + _block->_num_significant_bits = + other._block->_num_significant_bits; + result = true; + } + } + else if (other_length < length) + { + if (!other._block->_infinity_bit_is_one) + { + _block->_data_length = other_length; + _block->_num_significant_bits = + other._block->_num_significant_bits; + result = true; + } + } + else + { + if (other._block->_num_significant_bits > + _block->_num_significant_bits) + { + _block->_num_significant_bits = + other._block->_num_significant_bits; + result = true; + } + } + if (_block->_infinity_bit_is_one && !(other._block->_infinity_bit_is_one)) + result = true; + _block->_infinity_bit_is_one = + ((_block->_infinity_bit_is_one ? 1 : 0) & + (other._block->_infinity_bit_is_one ? 1 : 0) == 1); + if (result) + _block->unpad(); + return result; + } + +bool BitVector::do_or_with_test(const BitVector &other) + { + bool result = false; + make_changable(); + size_t length = _block->_data_length; + size_t other_length = other._block->_data_length; + size_t common_length = + ((other_length > length) ? length : other_length); + for (size_t chunk_num = 0; chunk_num < common_length; ++chunk_num) + { + BitVector::ChunkT orig_chunk = _block->_data[chunk_num]; + BitVector::ChunkT new_chunk = orig_chunk | other._block->_data[chunk_num]; + _block->_data[chunk_num] = new_chunk; + if (orig_chunk != new_chunk) + result = true; + } + if (other_length > length) + { + if (!_block->_infinity_bit_is_one) + { + _block->expand_data(other_length); + for (size_t chunk_num = length; chunk_num < other_length; + ++chunk_num) + { + _block->_data[chunk_num] = other._block->_data[chunk_num]; + } + _block->_num_significant_bits = + other._block->_num_significant_bits; + result = true; + } + } + else if (other_length < length) + { + if (other._block->_infinity_bit_is_one) + { + _block->_data_length = other_length; + _block->_num_significant_bits = + other._block->_num_significant_bits; + result = true; + } + } + else + { + if (other._block->_num_significant_bits > + _block->_num_significant_bits) + { + _block->_num_significant_bits = + other._block->_num_significant_bits; + result = true; + } + } + if ((!(_block->_infinity_bit_is_one)) && + other._block->_infinity_bit_is_one) + { + result = true; + } + _block->_infinity_bit_is_one = + ((_block->_infinity_bit_is_one ? 1 : 0) | + (other._block->_infinity_bit_is_one ? 1 : 0) == 1); + if (result) + _block->unpad(); + return result; + } + +bool BitVector::do_subtract_with_test(const BitVector &other) + { + BitVector old(*this); + this->subtract(other); + return(old == *this); + } + +void BitVector::subtract(const BitVector &other) + { + BitVector old = ~other; + *this &= old; + return; + } + +BitVector BitVector::operator-(const BitVector &other) const + { + return((*this) & (~other)); + } + + + + + + +/* + * There are two pre-computed tables here, the byte_count_table and + * the one_bit_num_table. They can be generated by this little C + * program: + +-------------------------BEGIN-PROGRAM----------------------------- +static void print_bit_comment(int byte_value); + +extern int main(int argc, char *argv[]) + { + int counter; + + for (counter = 0; counter < 256; ++counter) + { + int count = 0; + unsigned int i; + + if ((counter != 0) && ((counter % 16) == 0)) + printf("\n"); + for (i = 0; i < 8; i++) { + if (counter & (1U << i)) count++; + } + printf(" %d", count); + if (counter < 255) + printf(", "); + else + printf(" "); + print_bit_comment(counter); + printf("\n"); + } + + for (counter = 0; counter < 256; ++counter) + { + int last_one_bit = 8; // when 0 + unsigned i; + + if ((counter != 0) && ((counter % 16) == 0)) + printf("\n"); + for (i = 0; i < 8; i++) { + if (counter & (1U << (i))) { + last_one_bit = (i); + break; + } + } + printf(" %d", last_one_bit); + printf(counter < 255 ? ", " : " " ); + print_bit_comment(counter); + printf("\n"); + } + + return 0; + } + +static void print_bit_comment(int byte_value) + { + unsigned i; + printf("/"); + printf("* "); + for (i = 0; i < 8; i++) { + printf("%d", (byte_value & (1U << (7-i))) ? 1 : 0); + } + printf(" *"); + printf("/"); + } + +--------------------------END-PROGRAM------------------------------ + */ + +/* This table maps from a byte to the number of ``one'' bits in that + * byte. */ +static unsigned char byte_count_table[256] = + { + 0, /* 00000000 */ + 1, /* 00000001 */ + 1, /* 00000010 */ + 2, /* 00000011 */ + 1, /* 00000100 */ + 2, /* 00000101 */ + 2, /* 00000110 */ + 3, /* 00000111 */ + 1, /* 00001000 */ + 2, /* 00001001 */ + 2, /* 00001010 */ + 3, /* 00001011 */ + 2, /* 00001100 */ + 3, /* 00001101 */ + 3, /* 00001110 */ + 4, /* 00001111 */ + + 1, /* 00010000 */ + 2, /* 00010001 */ + 2, /* 00010010 */ + 3, /* 00010011 */ + 2, /* 00010100 */ + 3, /* 00010101 */ + 3, /* 00010110 */ + 4, /* 00010111 */ + 2, /* 00011000 */ + 3, /* 00011001 */ + 3, /* 00011010 */ + 4, /* 00011011 */ + 3, /* 00011100 */ + 4, /* 00011101 */ + 4, /* 00011110 */ + 5, /* 00011111 */ + + 1, /* 00100000 */ + 2, /* 00100001 */ + 2, /* 00100010 */ + 3, /* 00100011 */ + 2, /* 00100100 */ + 3, /* 00100101 */ + 3, /* 00100110 */ + 4, /* 00100111 */ + 2, /* 00101000 */ + 3, /* 00101001 */ + 3, /* 00101010 */ + 4, /* 00101011 */ + 3, /* 00101100 */ + 4, /* 00101101 */ + 4, /* 00101110 */ + 5, /* 00101111 */ + + 2, /* 00110000 */ + 3, /* 00110001 */ + 3, /* 00110010 */ + 4, /* 00110011 */ + 3, /* 00110100 */ + 4, /* 00110101 */ + 4, /* 00110110 */ + 5, /* 00110111 */ + 3, /* 00111000 */ + 4, /* 00111001 */ + 4, /* 00111010 */ + 5, /* 00111011 */ + 4, /* 00111100 */ + 5, /* 00111101 */ + 5, /* 00111110 */ + 6, /* 00111111 */ + + 1, /* 01000000 */ + 2, /* 01000001 */ + 2, /* 01000010 */ + 3, /* 01000011 */ + 2, /* 01000100 */ + 3, /* 01000101 */ + 3, /* 01000110 */ + 4, /* 01000111 */ + 2, /* 01001000 */ + 3, /* 01001001 */ + 3, /* 01001010 */ + 4, /* 01001011 */ + 3, /* 01001100 */ + 4, /* 01001101 */ + 4, /* 01001110 */ + 5, /* 01001111 */ + + 2, /* 01010000 */ + 3, /* 01010001 */ + 3, /* 01010010 */ + 4, /* 01010011 */ + 3, /* 01010100 */ + 4, /* 01010101 */ + 4, /* 01010110 */ + 5, /* 01010111 */ + 3, /* 01011000 */ + 4, /* 01011001 */ + 4, /* 01011010 */ + 5, /* 01011011 */ + 4, /* 01011100 */ + 5, /* 01011101 */ + 5, /* 01011110 */ + 6, /* 01011111 */ + + 2, /* 01100000 */ + 3, /* 01100001 */ + 3, /* 01100010 */ + 4, /* 01100011 */ + 3, /* 01100100 */ + 4, /* 01100101 */ + 4, /* 01100110 */ + 5, /* 01100111 */ + 3, /* 01101000 */ + 4, /* 01101001 */ + 4, /* 01101010 */ + 5, /* 01101011 */ + 4, /* 01101100 */ + 5, /* 01101101 */ + 5, /* 01101110 */ + 6, /* 01101111 */ + + 3, /* 01110000 */ + 4, /* 01110001 */ + 4, /* 01110010 */ + 5, /* 01110011 */ + 4, /* 01110100 */ + 5, /* 01110101 */ + 5, /* 01110110 */ + 6, /* 01110111 */ + 4, /* 01111000 */ + 5, /* 01111001 */ + 5, /* 01111010 */ + 6, /* 01111011 */ + 5, /* 01111100 */ + 6, /* 01111101 */ + 6, /* 01111110 */ + 7, /* 01111111 */ + + 1, /* 10000000 */ + 2, /* 10000001 */ + 2, /* 10000010 */ + 3, /* 10000011 */ + 2, /* 10000100 */ + 3, /* 10000101 */ + 3, /* 10000110 */ + 4, /* 10000111 */ + 2, /* 10001000 */ + 3, /* 10001001 */ + 3, /* 10001010 */ + 4, /* 10001011 */ + 3, /* 10001100 */ + 4, /* 10001101 */ + 4, /* 10001110 */ + 5, /* 10001111 */ + + 2, /* 10010000 */ + 3, /* 10010001 */ + 3, /* 10010010 */ + 4, /* 10010011 */ + 3, /* 10010100 */ + 4, /* 10010101 */ + 4, /* 10010110 */ + 5, /* 10010111 */ + 3, /* 10011000 */ + 4, /* 10011001 */ + 4, /* 10011010 */ + 5, /* 10011011 */ + 4, /* 10011100 */ + 5, /* 10011101 */ + 5, /* 10011110 */ + 6, /* 10011111 */ + + 2, /* 10100000 */ + 3, /* 10100001 */ + 3, /* 10100010 */ + 4, /* 10100011 */ + 3, /* 10100100 */ + 4, /* 10100101 */ + 4, /* 10100110 */ + 5, /* 10100111 */ + 3, /* 10101000 */ + 4, /* 10101001 */ + 4, /* 10101010 */ + 5, /* 10101011 */ + 4, /* 10101100 */ + 5, /* 10101101 */ + 5, /* 10101110 */ + 6, /* 10101111 */ + + 3, /* 10110000 */ + 4, /* 10110001 */ + 4, /* 10110010 */ + 5, /* 10110011 */ + 4, /* 10110100 */ + 5, /* 10110101 */ + 5, /* 10110110 */ + 6, /* 10110111 */ + 4, /* 10111000 */ + 5, /* 10111001 */ + 5, /* 10111010 */ + 6, /* 10111011 */ + 5, /* 10111100 */ + 6, /* 10111101 */ + 6, /* 10111110 */ + 7, /* 10111111 */ + + 2, /* 11000000 */ + 3, /* 11000001 */ + 3, /* 11000010 */ + 4, /* 11000011 */ + 3, /* 11000100 */ + 4, /* 11000101 */ + 4, /* 11000110 */ + 5, /* 11000111 */ + 3, /* 11001000 */ + 4, /* 11001001 */ + 4, /* 11001010 */ + 5, /* 11001011 */ + 4, /* 11001100 */ + 5, /* 11001101 */ + 5, /* 11001110 */ + 6, /* 11001111 */ + + 3, /* 11010000 */ + 4, /* 11010001 */ + 4, /* 11010010 */ + 5, /* 11010011 */ + 4, /* 11010100 */ + 5, /* 11010101 */ + 5, /* 11010110 */ + 6, /* 11010111 */ + 4, /* 11011000 */ + 5, /* 11011001 */ + 5, /* 11011010 */ + 6, /* 11011011 */ + 5, /* 11011100 */ + 6, /* 11011101 */ + 6, /* 11011110 */ + 7, /* 11011111 */ + + 3, /* 11100000 */ + 4, /* 11100001 */ + 4, /* 11100010 */ + 5, /* 11100011 */ + 4, /* 11100100 */ + 5, /* 11100101 */ + 5, /* 11100110 */ + 6, /* 11100111 */ + 4, /* 11101000 */ + 5, /* 11101001 */ + 5, /* 11101010 */ + 6, /* 11101011 */ + 5, /* 11101100 */ + 6, /* 11101101 */ + 6, /* 11101110 */ + 7, /* 11101111 */ + + 4, /* 11110000 */ + 5, /* 11110001 */ + 5, /* 11110010 */ + 6, /* 11110011 */ + 5, /* 11110100 */ + 6, /* 11110101 */ + 6, /* 11110110 */ + 7, /* 11110111 */ + 5, /* 11111000 */ + 6, /* 11111001 */ + 6, /* 11111010 */ + 7, /* 11111011 */ + 6, /* 11111100 */ + 7, /* 11111101 */ + 7, /* 11111110 */ + 8 /* 11111111 */ + }; +static unsigned char first_one_bit[256] = + { + 8, /* 00000000 */ + 0, /* 00000001 */ + 1, /* 00000010 */ + 0, /* 00000011 */ + 2, /* 00000100 */ + 0, /* 00000101 */ + 1, /* 00000110 */ + 0, /* 00000111 */ + 3, /* 00001000 */ + 0, /* 00001001 */ + 1, /* 00001010 */ + 0, /* 00001011 */ + 2, /* 00001100 */ + 0, /* 00001101 */ + 1, /* 00001110 */ + 0, /* 00001111 */ + + 4, /* 00010000 */ + 0, /* 00010001 */ + 1, /* 00010010 */ + 0, /* 00010011 */ + 2, /* 00010100 */ + 0, /* 00010101 */ + 1, /* 00010110 */ + 0, /* 00010111 */ + 3, /* 00011000 */ + 0, /* 00011001 */ + 1, /* 00011010 */ + 0, /* 00011011 */ + 2, /* 00011100 */ + 0, /* 00011101 */ + 1, /* 00011110 */ + 0, /* 00011111 */ + + 5, /* 00100000 */ + 0, /* 00100001 */ + 1, /* 00100010 */ + 0, /* 00100011 */ + 2, /* 00100100 */ + 0, /* 00100101 */ + 1, /* 00100110 */ + 0, /* 00100111 */ + 3, /* 00101000 */ + 0, /* 00101001 */ + 1, /* 00101010 */ + 0, /* 00101011 */ + 2, /* 00101100 */ + 0, /* 00101101 */ + 1, /* 00101110 */ + 0, /* 00101111 */ + + 4, /* 00110000 */ + 0, /* 00110001 */ + 1, /* 00110010 */ + 0, /* 00110011 */ + 2, /* 00110100 */ + 0, /* 00110101 */ + 1, /* 00110110 */ + 0, /* 00110111 */ + 3, /* 00111000 */ + 0, /* 00111001 */ + 1, /* 00111010 */ + 0, /* 00111011 */ + 2, /* 00111100 */ + 0, /* 00111101 */ + 1, /* 00111110 */ + 0, /* 00111111 */ + + 6, /* 01000000 */ + 0, /* 01000001 */ + 1, /* 01000010 */ + 0, /* 01000011 */ + 2, /* 01000100 */ + 0, /* 01000101 */ + 1, /* 01000110 */ + 0, /* 01000111 */ + 3, /* 01001000 */ + 0, /* 01001001 */ + 1, /* 01001010 */ + 0, /* 01001011 */ + 2, /* 01001100 */ + 0, /* 01001101 */ + 1, /* 01001110 */ + 0, /* 01001111 */ + + 4, /* 01010000 */ + 0, /* 01010001 */ + 1, /* 01010010 */ + 0, /* 01010011 */ + 2, /* 01010100 */ + 0, /* 01010101 */ + 1, /* 01010110 */ + 0, /* 01010111 */ + 3, /* 01011000 */ + 0, /* 01011001 */ + 1, /* 01011010 */ + 0, /* 01011011 */ + 2, /* 01011100 */ + 0, /* 01011101 */ + 1, /* 01011110 */ + 0, /* 01011111 */ + + 5, /* 01100000 */ + 0, /* 01100001 */ + 1, /* 01100010 */ + 0, /* 01100011 */ + 2, /* 01100100 */ + 0, /* 01100101 */ + 1, /* 01100110 */ + 0, /* 01100111 */ + 3, /* 01101000 */ + 0, /* 01101001 */ + 1, /* 01101010 */ + 0, /* 01101011 */ + 2, /* 01101100 */ + 0, /* 01101101 */ + 1, /* 01101110 */ + 0, /* 01101111 */ + + 4, /* 01110000 */ + 0, /* 01110001 */ + 1, /* 01110010 */ + 0, /* 01110011 */ + 2, /* 01110100 */ + 0, /* 01110101 */ + 1, /* 01110110 */ + 0, /* 01110111 */ + 3, /* 01111000 */ + 0, /* 01111001 */ + 1, /* 01111010 */ + 0, /* 01111011 */ + 2, /* 01111100 */ + 0, /* 01111101 */ + 1, /* 01111110 */ + 0, /* 01111111 */ + + 7, /* 10000000 */ + 0, /* 10000001 */ + 1, /* 10000010 */ + 0, /* 10000011 */ + 2, /* 10000100 */ + 0, /* 10000101 */ + 1, /* 10000110 */ + 0, /* 10000111 */ + 3, /* 10001000 */ + 0, /* 10001001 */ + 1, /* 10001010 */ + 0, /* 10001011 */ + 2, /* 10001100 */ + 0, /* 10001101 */ + 1, /* 10001110 */ + 0, /* 10001111 */ + + 4, /* 10010000 */ + 0, /* 10010001 */ + 1, /* 10010010 */ + 0, /* 10010011 */ + 2, /* 10010100 */ + 0, /* 10010101 */ + 1, /* 10010110 */ + 0, /* 10010111 */ + 3, /* 10011000 */ + 0, /* 10011001 */ + 1, /* 10011010 */ + 0, /* 10011011 */ + 2, /* 10011100 */ + 0, /* 10011101 */ + 1, /* 10011110 */ + 0, /* 10011111 */ + + 5, /* 10100000 */ + 0, /* 10100001 */ + 1, /* 10100010 */ + 0, /* 10100011 */ + 2, /* 10100100 */ + 0, /* 10100101 */ + 1, /* 10100110 */ + 0, /* 10100111 */ + 3, /* 10101000 */ + 0, /* 10101001 */ + 1, /* 10101010 */ + 0, /* 10101011 */ + 2, /* 10101100 */ + 0, /* 10101101 */ + 1, /* 10101110 */ + 0, /* 10101111 */ + + 4, /* 10110000 */ + 0, /* 10110001 */ + 1, /* 10110010 */ + 0, /* 10110011 */ + 2, /* 10110100 */ + 0, /* 10110101 */ + 1, /* 10110110 */ + 0, /* 10110111 */ + 3, /* 10111000 */ + 0, /* 10111001 */ + 1, /* 10111010 */ + 0, /* 10111011 */ + 2, /* 10111100 */ + 0, /* 10111101 */ + 1, /* 10111110 */ + 0, /* 10111111 */ + + 6, /* 11000000 */ + 0, /* 11000001 */ + 1, /* 11000010 */ + 0, /* 11000011 */ + 2, /* 11000100 */ + 0, /* 11000101 */ + 1, /* 11000110 */ + 0, /* 11000111 */ + 3, /* 11001000 */ + 0, /* 11001001 */ + 1, /* 11001010 */ + 0, /* 11001011 */ + 2, /* 11001100 */ + 0, /* 11001101 */ + 1, /* 11001110 */ + 0, /* 11001111 */ + + 4, /* 11010000 */ + 0, /* 11010001 */ + 1, /* 11010010 */ + 0, /* 11010011 */ + 2, /* 11010100 */ + 0, /* 11010101 */ + 1, /* 11010110 */ + 0, /* 11010111 */ + 3, /* 11011000 */ + 0, /* 11011001 */ + 1, /* 11011010 */ + 0, /* 11011011 */ + 2, /* 11011100 */ + 0, /* 11011101 */ + 1, /* 11011110 */ + 0, /* 11011111 */ + + 5, /* 11100000 */ + 0, /* 11100001 */ + 1, /* 11100010 */ + 0, /* 11100011 */ + 2, /* 11100100 */ + 0, /* 11100101 */ + 1, /* 11100110 */ + 0, /* 11100111 */ + 3, /* 11101000 */ + 0, /* 11101001 */ + 1, /* 11101010 */ + 0, /* 11101011 */ + 2, /* 11101100 */ + 0, /* 11101101 */ + 1, /* 11101110 */ + 0, /* 11101111 */ + + 4, /* 11110000 */ + 0, /* 11110001 */ + 1, /* 11110010 */ + 0, /* 11110011 */ + 2, /* 11110100 */ + 0, /* 11110101 */ + 1, /* 11110110 */ + 0, /* 11110111 */ + 3, /* 11111000 */ + 0, /* 11111001 */ + 1, /* 11111010 */ + 0, /* 11111011 */ + 2, /* 11111100 */ + 0, /* 11111101 */ + 1, /* 11111110 */ + 0 /* 11111111 */ + }; + + + +size_t BitVector::count() const { + if (_has_count) return _count; + + size_t chunk_count = get_chunk_count(); + size_t count = 0; + for (size_t chunk_num = 0; chunk_num < chunk_count; ++chunk_num) + { + BitVector::ChunkT this_chunk = get_chunk(chunk_num); + // invert this if sign bit is 0 + if (get_infinity_bit()) { this_chunk = ~this_chunk; } + + { + for (BitVector::ChunkT this_chunk = get_chunk(chunk_num); + this_chunk != 0; this_chunk >>= (BITS_PER_CHAR)) { + unsigned char c = this_chunk & ((1U << BITS_PER_CHAR)-1); + count += byte_count_table[c]; + } + } + } + ((BitVector *)this)->_count = count; + ((BitVector *)this)->_has_count = true; + return(count); +} + + + + + +BitVectorIter::BitVectorIter(const BitVector *bv): + _done(false), + _current_bit(0), + _remaining_byte(0), + _bv(bv) +{ + first(); +} + +BitVectorIter::BitVectorIter(const BitVectorIter &other) : + _done(other._done), + _current_bit(other._current_bit), + _remaining_byte(other._remaining_byte), + _bv(other._bv) +{} + +BitVectorIter &BitVectorIter::operator=(const BitVectorIter &other) { + _done = other._done; + _current_bit = other._current_bit; + _remaining_byte = other._remaining_byte; + _bv = other._bv; + return(*this); +} + + // support the old-style increment(), done() + // and the new-style is_valid(); next() +bool BitVectorIter::is_valid() const { return !done(); } +void BitVectorIter::increment() { next(); } +bool BitVectorIter::done() const { return(_done); } +size_t BitVectorIter::get() const { return current(); } +void BitVectorIter::reset() { first(); } + + +void BitVectorIter::first() + { + if (_bv->num_significant_bits() == 0) { + _done = true; + return; + } + // set up the first byte + BitVector::ChunkT this_chunk = _bv->get_chunk(0); + bool ones_bit = _bv->get_infinity_bit(); + if (ones_bit) this_chunk = ~this_chunk; + unsigned byte_num = 0; + unsigned char this_byte = + (this_chunk >> (BITS_PER_CHAR * byte_num)); + _remaining_byte = this_byte; + _done = false; + _current_bit = 0; + next(); + } + +size_t BitVectorIter::current() const { + suif_assert(!_done); + return(_current_bit); +} + + +void BitVectorIter::next() + { + suif_assert(!_done); + // First the simple case: + // there is still more in the current byte. + if (_remaining_byte != 0) { + unsigned this_byte = _remaining_byte; + size_t first_bit = first_one_bit[this_byte]; + size_t current_bit = _current_bit; + size_t current_byte = current_bit/BITS_PER_CHAR; + current_bit = current_byte * BITS_PER_CHAR + first_bit; + + _current_bit = current_bit; + // we could use the mask, but why bother. We know the bit is set. + unsigned char next_byte = this_byte - ( 1U << first_bit); + _remaining_byte = next_byte; + return; + } + size_t current_bit = _current_bit; + current_bit = current_bit + (BITS_PER_CHAR - + (current_bit % (BITS_PER_CHAR))); + + // walk through each chunk... + size_t chunk_count = _bv->get_chunk_count(); + bool ones_bit = _bv->get_infinity_bit(); + unsigned chunk_num = current_bit / BITS_PER_WORD; + unsigned byte_num = (current_bit % BITS_PER_WORD) / BITS_PER_CHAR; + for (; chunk_num < chunk_count; chunk_num++, byte_num = 0) + { + BitVector::ChunkT this_chunk = _bv->get_chunk(chunk_num); + if (ones_bit) this_chunk = ~this_chunk; + if (this_chunk == 0) continue; + for (; + byte_num < (BITS_PER_WORD/BITS_PER_CHAR); + byte_num++) { + unsigned char this_byte = + (this_chunk >> (BITS_PER_CHAR * byte_num)); + if (this_byte == 0) continue; + size_t first_bit = first_one_bit[this_byte]; + _current_bit = chunk_num * BITS_PER_WORD + + byte_num * BITS_PER_CHAR + + first_bit; + unsigned char next_byte = this_byte - ( 1U << first_bit); + _remaining_byte = next_byte; + _done = false; + return; + } + } + _done = true; + } + + + diff -Nur nci/suif/suif2b/extratypes/bit_vector/bit_vector.h nci-latest/suif/suif2b/extratypes/bit_vector/bit_vector.h --- nci/suif/suif2b/extratypes/bit_vector/bit_vector.h Wed Feb 13 10:27:00 2002 +++ nci-latest/suif/suif2b/extratypes/bit_vector/bit_vector.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* file "bit_vector.h" */ @@ -22,7 +23,7 @@ /* - This is the definition of the suif_bit_vector class for sty, the + This is the definition of the bit_vector class for sty, the first-level main library of the SUIF system. */ #include @@ -56,15 +57,16 @@ size_t _count; // cache the count MUTABLE bool _has_count; // count cached - MUTABLE - static void do_initialization(void); void add_reference(BitVectorBlock *the_block); void remove_reference(BitVectorBlock *the_block); void make_changable(void); static unsigned char convert_from_hex(char hex_char); - + static bool _bit_vector_initialized; public: + static void do_initialization(void); + typedef unsigned long ChunkT; BitVector(void); @@ -98,6 +100,8 @@ void print(FILE *fp = stdout) const; void print(ion *the_ion) const; + void print_long(ion *the_ion) const; + bool is_equal_to(const BitVector &other) const; bool is_not_equal_to(const BitVector &other) const { return !is_equal_to(other); } @@ -164,15 +168,15 @@ BitVectorIter &operator=(const BitVectorIter &other); // support the old-style increment(), done() // and the new-style is_valid(); next() - bool is_valid() const; - void next(); - size_t current() const; - void first(); // reset + inline bool is_valid() const; + inline void next(); + inline size_t current() const; + inline void first(); // reset - void increment(); // next() - bool done() const; // !is_valid() + inline void increment(); // next() + inline bool done() const; // !is_valid() size_t get() const; // current() - void reset(); // first() + inline void reset(); // first() private: bool _done; diff -Nur nci/suif/suif2b/extratypes/bit_vector/bit_vector_forwarders.h nci-latest/suif/suif2b/extratypes/bit_vector/bit_vector_forwarders.h --- nci/suif/suif2b/extratypes/bit_vector/bit_vector_forwarders.h Sat May 29 00:58:36 1999 +++ nci-latest/suif/suif2b/extratypes/bit_vector/bit_vector_forwarders.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef BIT_VECTOR_FORWARDERS_H #define BIT_VECTOR_FORWARDERS_H diff -Nur nci/suif/suif2b/extratypes/bit_vector/bit_vector_set.h nci-latest/suif/suif2b/extratypes/bit_vector/bit_vector_set.h --- nci/suif/suif2b/extratypes/bit_vector/bit_vector_set.h Thu Apr 6 23:23:14 2000 +++ nci-latest/suif/suif2b/extratypes/bit_vector/bit_vector_set.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef BITVECTOR_SET_H #define BITVECTOR_SET_H diff -Nur nci/suif/suif2b/extratypes/bit_vector/bvector.cpp nci-latest/suif/suif2b/extratypes/bit_vector/bvector.cpp --- nci/suif/suif2b/extratypes/bit_vector/bvector.cpp Fri Oct 8 05:36:54 1999 +++ nci-latest/suif/suif2b/extratypes/bit_vector/bvector.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #include "bvector.h" diff -Nur nci/suif/suif2b/extratypes/bit_vector/bvector.h nci-latest/suif/suif2b/extratypes/bit_vector/bvector.h --- nci/suif/suif2b/extratypes/bit_vector/bvector.h Thu Dec 2 18:53:05 1999 +++ nci-latest/suif/suif2b/extratypes/bit_vector/bvector.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef _bit_vector_bvector_h_ #define _bit_vector_bvector_h_ diff -Nur nci/suif/suif2b/extratypes/bit_vector/bvtest.cpp nci-latest/suif/suif2b/extratypes/bit_vector/bvtest.cpp --- nci/suif/suif2b/extratypes/bit_vector/bvtest.cpp Thu Nov 4 02:04:43 1999 +++ nci-latest/suif/suif2b/extratypes/bit_vector/bvtest.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #include "bit_vector.h" class SuifEnv; diff -Nur nci/suif/suif2b/extratypes/bit_vector/cross_map.cpp nci-latest/suif/suif2b/extratypes/bit_vector/cross_map.cpp --- nci/suif/suif2b/extratypes/bit_vector/cross_map.cpp Sun Jun 4 09:10:22 2000 +++ nci-latest/suif/suif2b/extratypes/bit_vector/cross_map.cpp Wed Feb 13 10:26:07 2002 @@ -1 +1,2 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #include "cross_map.h" diff -Nur nci/suif/suif2b/extratypes/bit_vector/cross_map.h nci-latest/suif/suif2b/extratypes/bit_vector/cross_map.h --- nci/suif/suif2b/extratypes/bit_vector/cross_map.h Sat Jun 3 09:45:39 2000 +++ nci-latest/suif/suif2b/extratypes/bit_vector/cross_map.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef CROSS_MAP_H #define CROSS_MAP_H diff -Nur nci/suif/suif2b/extratypes/bit_vector/cross_map_forwarders.h nci-latest/suif/suif2b/extratypes/bit_vector/cross_map_forwarders.h --- nci/suif/suif2b/extratypes/bit_vector/cross_map_forwarders.h Fri Oct 8 01:33:21 1999 +++ nci-latest/suif/suif2b/extratypes/bit_vector/cross_map_forwarders.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef CROSS_MAP_FORWARDERS_H #define CROSS_MAP_FORWARDERS_H diff -Nur nci/suif/suif2b/extratypes/bit_vector/cset.h nci-latest/suif/suif2b/extratypes/bit_vector/cset.h --- nci/suif/suif2b/extratypes/bit_vector/cset.h Thu Apr 6 23:12:50 2000 +++ nci-latest/suif/suif2b/extratypes/bit_vector/cset.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef _CSET_H_ #define _CSET_H_ diff -Nur nci/suif/suif2b/extratypes/bit_vector/init.cpp nci-latest/suif/suif2b/extratypes/bit_vector/init.cpp --- nci/suif/suif2b/extratypes/bit_vector/init.cpp Mon Apr 5 22:29:40 1999 +++ nci-latest/suif/suif2b/extratypes/bit_vector/init.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ class SuifEnv; #include "bit_vector.h" diff -Nur nci/suif/suif2b/extratypes/bit_vector/standard_main.cpp nci-latest/suif/suif2b/extratypes/bit_vector/standard_main.cpp --- nci/suif/suif2b/extratypes/bit_vector/standard_main.cpp Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/bit_vector/standard_main.cpp Wed Feb 13 10:26:07 2002 @@ -0,0 +1,31 @@ +// This file was automatically build by +// /sow/16/16/livshits/work/src/nci/build_main.pl '-lion -lcommon -liokernel -lsuifkernel' +// from the $(LIBS} variable in the Makefile +// +#include "suifkernel/suifkernel_forwarders.h" +#include "suifkernel/suif_env.h" +#include "suifkernel/module_subsystem.h" +#include "suifkernel/token_stream.h" +#include "suifpasses/suifpasses.h" + + +int main( int argc, char* argv[] ) { + // initialize the environment + SuifEnv* suif = new SuifEnv; + suif->init(); + + // import and initialize the necessary libraries + suif->require_DLL("ion"); + + // transform the input arguments into a stream of + // input tokens + TokenStream token_stream( argc, argv ); + + // execute the Module "execute" + ModuleSubSystem* mSubSystem = suif->get_module_subsystem(); + mSubSystem -> execute( "execute", &token_stream ); + + delete suif; + + return 0; +} diff -Nur nci/suif/suif2b/extratypes/containers/container.h nci-latest/suif/suif2b/extratypes/containers/container.h --- nci/suif/suif2b/extratypes/containers/container.h Fri Apr 9 21:21:21 1999 +++ nci-latest/suif/suif2b/extratypes/containers/container.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef CONTAINER_H #define CONTAINER_H diff -Nur nci/suif/suif2b/extratypes/containers/container_iter.h nci-latest/suif/suif2b/extratypes/containers/container_iter.h --- nci/suif/suif2b/extratypes/containers/container_iter.h Fri Apr 9 21:21:21 1999 +++ nci-latest/suif/suif2b/extratypes/containers/container_iter.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef CONTAINER_ITER_H #define CONTAINER_ITER_H diff -Nur nci/suif/suif2b/extratypes/containers/container_list.h nci-latest/suif/suif2b/extratypes/containers/container_list.h --- nci/suif/suif2b/extratypes/containers/container_list.h Wed Feb 13 10:27:00 2002 +++ nci-latest/suif/suif2b/extratypes/containers/container_list.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef CONTAINER_LIST_H #define CONTAINER_LIST_H @@ -14,8 +15,7 @@ // // // This implements the Container interface for -// the suif_list<> (currently called suif_list<>) -// class. +// the suif_list<> class. // // It caches the last element retrieved // so that iterating through elements is diff -Nur nci/suif/suif2b/extratypes/containers/container_vector.h nci-latest/suif/suif2b/extratypes/containers/container_vector.h --- nci/suif/suif2b/extratypes/containers/container_vector.h Fri Apr 9 21:21:22 1999 +++ nci-latest/suif/suif2b/extratypes/containers/container_vector.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef CONTAINER_VECTOR_H #define CONTAINER_VECTOR_H diff -Nur nci/suif/suif2b/extratypes/extra_tests/Makefile nci-latest/suif/suif2b/extratypes/extra_tests/Makefile --- nci/suif/suif2b/extratypes/extra_tests/Makefile Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/extra_tests/Makefile Wed Feb 13 10:26:07 2002 @@ -0,0 +1,11 @@ +OBJ_FILES = sgraph_algs_tests.o +MAIN_OBJ = extra_tests.o + +PROGRAM = regress_extra_tests +LIBS += -lsuifpasses -lbasicnodes -lsuifnodes -lsuifkernel \ + -liokernel -lcommon $(DYNAMIC_LINKING_LIBRARY) \ + -lsgraph_algs + +SRCS = extra_tests.cpp sgraph_algs_tests.cpp + +include $(NCIHOME)/Makefile.std diff -Nur nci/suif/suif2b/extratypes/extra_tests/extra_tests.cpp nci-latest/suif/suif2b/extratypes/extra_tests/extra_tests.cpp --- nci/suif/suif2b/extratypes/extra_tests/extra_tests.cpp Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/extra_tests/extra_tests.cpp Wed Feb 13 10:26:07 2002 @@ -0,0 +1,27 @@ +#include +#include + +extern "C" bool test_sgraph_algs(SuifEnv *s); + +int main(int argc, char *argv[]) { + bool pass = true; + + SuifEnv *s = create_suif_env(); + + if (test_sgraph_algs(s) != true) + pass = false; + + delete s; + + if (pass) { + stdout_ion->put_s("Pass: regress_extra_tests\n"); + } else { + stdout_ion->put_s("Fail: regress_extra_tests\n"); + } + + + if (!pass) + return(1); + + return(0); +} diff -Nur nci/suif/suif2b/extratypes/extra_tests/sgraph_algs_tests.cpp nci-latest/suif/suif2b/extratypes/extra_tests/sgraph_algs_tests.cpp --- nci/suif/suif2b/extratypes/extra_tests/sgraph_algs_tests.cpp Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/extra_tests/sgraph_algs_tests.cpp Wed Feb 13 10:26:07 2002 @@ -0,0 +1,133 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +typedef struct from_to_struct FromTo; + +struct from_to_struct { + size_t from; + size_t to; +}; + +FromTo edges1[] = { + {1, 2}, + {2, 3}, + {2, 6}, + {3, 4}, + {6, 4}, + {4, 5}, + {1, 5} +}; +#define EDGE1_COUNT (sizeof(edges1)/sizeof(FromTo)) +#define EDGE1_ENTRY 1 +#define EDGE1_EXIT 5 + + +SGraphBit *build_bit_graph(FromTo *edges, size_t size) { + + SGraphBit *bit_graph = new SGraphBit(); + + for (size_t i = 0; i < size; i++) { + bit_graph->add_node(edges[i].from); + bit_graph->add_node(edges[i].to); + bit_graph->add_edge(SGraphEdge(edges[i].from, edges[i].to)); + } + return(bit_graph); +} + +SGraphList *build_list_graph(FromTo *edges, size_t size) { + + SGraphList *graph = new SGraphList(); + + for (size_t i = 0; i < size; i++) { + graph->add_node(edges[i].from); + graph->add_node(edges[i].to); + graph->add_edge(SGraphEdge(edges[i].from, edges[i].to)); + } + return(graph); +} + + + +bool test_tarjan_df(SGraph *graph, + size_t the_entry, size_t the_exit) { + bool pass = true; + + DFBuild *df_build = new DFBuild(graph, the_entry, the_exit); + df_build->do_build_dominance_frontier(); + SGraph *df = df_build->get_dominance_frontier(); + SGraph *df_idom = df_build->get_immediate_dominators(); + + TarjanDFBuild *t_build = new TarjanDFBuild(graph, the_entry, the_exit); + t_build->do_build_dominance_frontier(); + SGraph *t_df = t_build->get_dominance_frontier(); + DFSBuilder *t_dfs = t_build->get_dfs(); + SGraphForest *t_idom = t_build->get_immediate_dominators(); + + bool pass_this = SGraphHelper::is_same_graph(df, t_df); + if (!pass_this) { + stdout_ion->put_s("DF != Tarjan DF\n"); + stdout_ion->put_s("Fail: test_tarjan_df\n"); + pass = false; + } else { + stdout_ion->put_s("Pass: test_tarjan_df\n"); + } + // if (!pass_this) + { + stdout_ion->put_s("Original Graph\n"); + graph->print(stdout_ion); + + + stdout_ion->put_s("DF IDom\n"); + df_idom->print(stdout_ion); + + stdout_ion->put_s("DF Graph\n"); + df->print(stdout_ion); + + stdout_ion->put_s("Tarjan DFS\n"); + t_dfs->print(stdout_ion); + + stdout_ion->put_s("Tarjan DF IDom\n"); + t_idom->print(stdout_ion); + + stdout_ion->put_s("Tarjan DF Graph\n"); + t_df->print(stdout_ion); + } + + delete df_build; + delete t_build; + + return(pass); +} + +extern "C" bool test_sgraph_algs(SuifEnv *s); + +extern "C" bool test_sgraph_algs(SuifEnv *s) { + s->require_DLL("sgraph_algs"); + + SGraph *g1 = build_bit_graph(edges1, EDGE1_COUNT); + SGraph *g2 = build_list_graph(edges1, EDGE1_COUNT); + bool pass = true; + + if (test_tarjan_df(g1, EDGE1_ENTRY, EDGE1_EXIT) != true) + pass = false; + if (test_tarjan_df(g2, EDGE1_ENTRY, EDGE1_EXIT) != true) + pass = false; + + delete g1; + delete g2; + if (pass) { + stdout_ion->put_s("Pass: test_sgraph_algs\n"); + } else { + stdout_ion->put_s("Fail: test_sgraph_algs\n"); + } + + return(pass); +} diff -Nur nci/suif/suif2b/extratypes/extratypes/Makefile nci-latest/suif/suif2b/extratypes/extratypes/Makefile --- nci/suif/suif2b/extratypes/extratypes/Makefile Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/extratypes/Makefile Wed Feb 13 10:26:07 2002 @@ -0,0 +1,11 @@ +OBJ_FILES = + +SRCS = + +HEADERS = pair_stack.h extratypes_forwarders.h \ + small_set.h + +TARGET_LIB = extratypes + +include $(NCIHOME)/Makefile.std + diff -Nur nci/suif/suif2b/extratypes/extratypes/extratypes_forwarders.h nci-latest/suif/suif2b/extratypes/extratypes/extratypes_forwarders.h --- nci/suif/suif2b/extratypes/extratypes/extratypes_forwarders.h Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/extratypes/extratypes_forwarders.h Wed Feb 13 10:26:07 2002 @@ -0,0 +1,10 @@ +#ifndef EXTRATYPES_FORWARDERS_H +#define EXTRATYPES_FORWARDERS_H + +template +class small_set; + +template +class PairStack; + +#endif /* EXTRATYPES_FORWARDERS_H */ diff -Nur nci/suif/suif2b/extratypes/extratypes/pair_stack.h nci-latest/suif/suif2b/extratypes/extratypes/pair_stack.h --- nci/suif/suif2b/extratypes/extratypes/pair_stack.h Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/extratypes/pair_stack.h Wed Feb 13 10:26:07 2002 @@ -0,0 +1,38 @@ +#ifndef PAIR_STACK_H +#define PAIR_STACK_H + +#include +#include + +template +class PairStack { +public: + PairStack(sf_refed X t1, sf_refed Y t2, sf_refed PairStack *oldstack): + _t1(t1), _t2(t2), _more(oldstack){} + + PairStack(const PairStack &other): + _t1 (other._type1), _t2 (other._type2), _more (other._more) {} + + PairStack &operator=(const PairStack &other){ + _t1 = other._t1; + _t2 = other._t2; + _more = other._more; + return *this; + } + + bool is_in(X t1, Y t2){ + if (t1 == _t1 && t2 == _t2) + return true; + if (_more == NULL) + return false; + return _more->is_in(t1, t2); + } + +private: + sf_refed X _t1; + sf_refed Y _t2; + sf_refed PairStack *_more; +}; + +#endif // PAIR_STACK_H + diff -Nur nci/suif/suif2b/extratypes/extratypes/small_set.h nci-latest/suif/suif2b/extratypes/extratypes/small_set.h --- nci/suif/suif2b/extratypes/extratypes/small_set.h Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/extratypes/small_set.h Wed Feb 13 10:26:07 2002 @@ -0,0 +1,208 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +#ifndef _EXTRATYPES__SMALL_SET_H_ +#define _EXTRATYPES__SMALL_SET_H_ + +/** @file + * A set template for small sets. + */ + + +#include + +/** \class small_set small_set.h utils/small_set.h + * + */ +template +class small_set { + public: + typedef T SetType; + typedef T value_type; + typedef T* iterator; + typedef const T* const_iterator; + typedef bool (EqualChecker)(const T&, const T&); + + static bool is_equal(const T& x1, const T& x2) { + return x1 == x2; + }; + + protected: + T * _buff; + iterator _start; + iterator _finish; + iterator _end_of_storage; + EqualChecker * const _equal_checker; + + void allocate_set(unsigned n) { + if (n == 0) n++; + _buff = new T[n]; + _start = _buff; + _finish = _buff; + _end_of_storage = _buff + n; + } + + void set_fill(iterator& start, unsigned n, const T& val) { + iterator tmp = start; + while (tmp < _finish) { + *(tmp) = val; + tmp++; + } + } + + /* copy from start up to, but not including, end...to dest */ + iterator copy(const_iterator start, const_iterator end, iterator dest) { + for (const_iterator tmp = start; tmp < end; tmp++, dest++) { + *dest = *tmp; + } + return dest; + } + + void remove_at(iterator pos) { + assert(_start <= pos && pos < _finish); + //("Out-of-range error.")); + copy(pos+1, _finish, pos); + --_finish; + } + + public: + small_set(EqualChecker* f = &small_set::is_equal) : + _buff(0), + _start(0), + _finish(0), + _end_of_storage(0), + _equal_checker(f) { + + allocate_set(1); + _start = _buff; + _finish = _buff; + } + + /** Create a set + * @param Size to create + * @param Default value for elements + */ + small_set(unsigned n, + const T& val = T(), + EqualChecker* f = &small_set::is_equal) : + _buff(0), _start(0), _finish(0), _end_of_storage(0), _equal_checker(f) { + iterator tmp; + allocate_set(n); + _start = _buff; + tmp = _start; + _finish = tmp + n; + set_fill(_start, n, val); + } + + small_set(const small_set& vec) : + _buff(0), _start(0), _finish(0), _end_of_storage(0), + _equal_checker(vec._equal_checker) { + + const_iterator it = vec.begin(), end = vec.end(); + unsigned n = vec.size(); + delete [] _buff; + allocate_set(n); + copy(it, end, _buff); + _start = _buff; + _finish = _buff + n; + } + + ~small_set() { + delete [] _buff; + } + + small_set* clone() const { + return new small_set(*this); + } + + small_set& operator=(const small_set& vec) { + const_iterator it = vec.begin(), end_it = vec.end(); + unsigned n = vec.size(); + delete [] _buff; + allocate_set(n); + copy(it, end_it, _buff); + _start = _buff; + _finish = _buff + n; + return *this; + } + + iterator begin() { return _start; } + iterator end() { return _finish; } + + const_iterator begin() const { return _start; } + const_iterator end() const { return _finish; } + + /** return number of elements */ + inline unsigned size() const { return _finish - _start; } + + /** Is the set empty */ + inline bool is_empty() const { return size() == 0; } + + void remove(const T& x) { + for (iterator it = begin(); it < end();) { + if (_equal_checker(*it, x)) + remove_at(it); + else + it++; + } + } + + void add(const T& x) { + if (is_member(x)) return; + if (_finish != _end_of_storage) { + *_finish = x; + _finish++; + } else { + int oldsize = size(); + int newsize = 2 * oldsize + 1; + T *pOld = _buff; + allocate_set(newsize); + copy(pOld, pOld+oldsize, _buff); + _finish = _buff + oldsize; + *_finish = x; + _finish++; + delete [] pOld; + } + } + + bool is_member(const T& x) const { + for (const_iterator it = begin(); it != end(); it++) { + if (_equal_checker((*it), x)) return true; + } + return false; + } + + /** Empty the set */ + void clear(void) { + _finish = _buff; + } + + void do_union(const small_set* that) { + for (const_iterator it = that->begin(); it != that->end(); it++) { + add((*it)); + } + } + + void do_intersect(const small_set* that) { + small_set reject; + {for (const_iterator it = begin(); it < end(); it++) { + if (!that->is_member((*it))) reject.add(*it); + }} + {for (iterator it = reject.begin(); it < reject.end(); it++) { + remove(*it); + }} + } + + + void do_subtract(const small_set* that) { + small_set reject; + {for (const_iterator it = begin(); it < end(); it++) { + if (that->is_member(*it)) reject.add(*it); + }} + {for (iterator it = reject.begin(); it < reject.end(); it++) { + remove(*it); + }} + } + +}; // small_set + + +#endif /* _EXTRATYPES__SMALL_SET_H_ */ diff -Nur nci/suif/suif2b/extratypes/gclist/Makefile.deps nci-latest/suif/suif2b/extratypes/gclist/Makefile.deps --- nci/suif/suif2b/extratypes/gclist/Makefile.deps Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/gclist/Makefile.deps Wed Feb 13 10:26:07 2002 @@ -0,0 +1,18 @@ +# Dependencies for C files + +# Dependencies for C files + +CPP_TO_O_RULE = defined +C_TO_O_RULE = defined + +%.o: %.cpp %.cxx %.cc + -echo Can not build $*.o from $< without explicit dependency + -echo The Makefile.deps file was incorrectly generated + -echo All .o dependencies should be explicit in that file + +$(OBJDIR)/$(TARGET_LIB)/gclist.o: gclist.cpp gclist.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /usr/include/stdio.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h /usr/include/bits/stdio_lim.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/gclist.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) gclist.cpp + diff -Nur nci/suif/suif2b/extratypes/gclist/gclist.cpp nci-latest/suif/suif2b/extratypes/gclist/gclist.cpp --- nci/suif/suif2b/extratypes/gclist/gclist.cpp Tue Jun 6 05:30:46 2000 +++ nci-latest/suif/suif2b/extratypes/gclist/gclist.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* Generic List Implementation */ /* Copyright (c) 1994 Stanford University diff -Nur nci/suif/suif2b/extratypes/gclist/gclist.h nci-latest/suif/suif2b/extratypes/gclist/gclist.h --- nci/suif/suif2b/extratypes/gclist/gclist.h Tue Jun 27 17:53:59 2000 +++ nci-latest/suif/suif2b/extratypes/gclist/gclist.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* Generic List Definitions */ /* Copyright (c) 1994 Stanford University diff -Nur nci/suif/suif2b/extratypes/ion/Makefile.deps nci-latest/suif/suif2b/extratypes/ion/Makefile.deps --- nci/suif/suif2b/extratypes/ion/Makefile.deps Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/ion/Makefile.deps Wed Feb 13 10:26:07 2002 @@ -0,0 +1,18 @@ +# Dependencies for C files + +# Dependencies for C files + +CPP_TO_O_RULE = defined +C_TO_O_RULE = defined + +%.o: %.cpp %.cxx %.cc + -echo Can not build $*.o from $< without explicit dependency + -echo The Makefile.deps file was incorrectly generated + -echo All .o dependencies should be explicit in that file + +$(OBJDIR)/$(TARGET_LIB)/ion.o: ion.cpp ion.h /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h /usr/include/bits/stdio_lim.h /sow/16/16/livshits/work/src/nci/include/common/i_integer.h /sow/16/16/livshits/work/src/nci/include/common/MString.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h /sow/16/16/livshits/work/src/nci/include/common/simple_stack.h /usr/include/assert.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_messages.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_forwarders.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/common_forwarders.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_messages.h /usr/include/ctype.h /usr/include/endian.h /usr/include/bits/endian.h /usr/include/string.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/ion.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) ion.cpp + diff -Nur nci/suif/suif2b/extratypes/ion/ion.cpp nci-latest/suif/suif2b/extratypes/ion/ion.cpp --- nci/suif/suif2b/extratypes/ion/ion.cpp Mon Aug 23 20:58:54 1999 +++ nci-latest/suif/suif2b/extratypes/ion/ion.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* file "ion.cc" */ @@ -277,7 +278,10 @@ case 'd': case 'i': if ((modifier != NULL) && (*modifier == 'h')) - sprintf(buffer, format_buf, va_arg(arg, short)); + // (according to gcc 2.96), argument to va_arg should be the + // type passed *after passing promotion rules are applied*, hence + // va_arg(arg, int) here rather than va_arg(arg, short) + sprintf(buffer, format_buf, va_arg(arg, int)); else if ((modifier != NULL) && (*modifier == 'l')) sprintf(buffer, format_buf, va_arg(arg, long)); else @@ -289,8 +293,9 @@ case 'X': if ((modifier != NULL) && (*modifier == 'h')) { + // va_arg(arg, unsigned), not unsigned short; see above sprintf(buffer, format_buf, - va_arg(arg, unsigned short)); + va_arg(arg, unsigned int)); } else if ((modifier != NULL) && (*modifier == 'l')) { @@ -468,7 +473,7 @@ // } string_ion::string_ion(void) : - _buffer(new char[_space]), + _buffer(new char[DEFAULT_INIT_STRING_ION_SPACE]), _space(DEFAULT_INIT_STRING_ION_SPACE), _position(0) { @@ -617,3 +622,8 @@ { vfprintf(_fp, format, arg); } + +void file_ion::flush(){ + fflush(_fp); +} + diff -Nur nci/suif/suif2b/extratypes/ion/ion.h nci-latest/suif/suif2b/extratypes/ion/ion.h --- nci/suif/suif2b/extratypes/ion/ion.h Mon Feb 8 23:46:25 1999 +++ nci-latest/suif/suif2b/extratypes/ion/ion.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* file "ion.h" */ @@ -56,6 +57,7 @@ virtual void put_s(const char *s); virtual void printf(const char *format, ...); virtual void vprintf(const char *format, va_list arg); + virtual void flush(){} }; @@ -149,6 +151,7 @@ void put_s(const char *s); void printf(const char *format, ...); void vprintf(const char *format, va_list arg); + virtual void flush(); }; extern ion *stdout_ion; diff -Nur nci/suif/suif2b/extratypes/ion/ion_forwarders.h nci-latest/suif/suif2b/extratypes/ion/ion_forwarders.h --- nci/suif/suif2b/extratypes/ion/ion_forwarders.h Mon Feb 1 19:19:02 1999 +++ nci-latest/suif/suif2b/extratypes/ion/ion_forwarders.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef ION_FORWARDERS_H #define ION_FORWARDERS_H diff -Nur nci/suif/suif2b/extratypes/irational/i_rational.cpp nci-latest/suif/suif2b/extratypes/irational/i_rational.cpp --- nci/suif/suif2b/extratypes/irational/i_rational.cpp Sat Aug 21 22:03:24 1999 +++ nci-latest/suif/suif2b/extratypes/irational/i_rational.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* file "i_rational.cc" */ /* Copyright (c) 1995,1999 Stanford University diff -Nur nci/suif/suif2b/extratypes/irational/i_rational.h nci-latest/suif/suif2b/extratypes/irational/i_rational.h --- nci/suif/suif2b/extratypes/irational/i_rational.h Sat Aug 21 22:03:24 1999 +++ nci-latest/suif/suif2b/extratypes/irational/i_rational.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* file "i_rational.h" */ /* Copyright (c) 1995 Stanford University diff -Nur nci/suif/suif2b/extratypes/irational/i_rational_forwarders.h nci-latest/suif/suif2b/extratypes/irational/i_rational_forwarders.h --- nci/suif/suif2b/extratypes/irational/i_rational_forwarders.h Sat Aug 21 22:03:24 1999 +++ nci-latest/suif/suif2b/extratypes/irational/i_rational_forwarders.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* file "inumbers.h" */ /* Copyright (c) 1995 Stanford University diff -Nur nci/suif/suif2b/extratypes/iter_closure/iter_closure.h nci-latest/suif/suif2b/extratypes/iter_closure/iter_closure.h --- nci/suif/suif2b/extratypes/iter_closure/iter_closure.h Mon Jun 12 09:18:20 2000 +++ nci-latest/suif/suif2b/extratypes/iter_closure/iter_closure.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef __ITER_CLOSURE__ #define __ITER_CLOSURE__ //#include @@ -20,4 +21,4 @@ } }; -#endif \ No newline at end of file +#endif diff -Nur nci/suif/suif2b/extratypes/lattice_utils/Makefile nci-latest/suif/suif2b/extratypes/lattice_utils/Makefile --- nci/suif/suif2b/extratypes/lattice_utils/Makefile Mon Jun 12 23:53:46 2000 +++ nci-latest/suif/suif2b/extratypes/lattice_utils/Makefile Wed Feb 13 10:26:07 2002 @@ -4,6 +4,7 @@ OBJ_FILES = bit_lattice.o \ unary.o \ nary.o \ + named_nary.o \ interval_lattice.o \ indexed_lattice.o \ hindexed_lattice.o \ @@ -15,6 +16,7 @@ SRCS = bit_lattice.cpp \ unary.cpp \ nary.cpp \ + named_nary.cpp \ const_lattice.cpp \ nary_bit_lattice.cpp \ interval_lattice.cpp \ @@ -25,10 +27,10 @@ smash_lattice.cpp \ standard_main.cpp - HEADERS = bit_lattice.h \ unary.h \ nary.h \ + named_nary.h \ const_lattice.h \ nary_bit_lattice.h \ interval_lattice.h \ diff -Nur nci/suif/suif2b/extratypes/lattice_utils/Makefile.deps nci-latest/suif/suif2b/extratypes/lattice_utils/Makefile.deps --- nci/suif/suif2b/extratypes/lattice_utils/Makefile.deps Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/lattice_utils/Makefile.deps Wed Feb 13 10:26:07 2002 @@ -0,0 +1,90 @@ +# Dependencies for C files + +# Dependencies for C files + +CPP_TO_O_RULE = defined +C_TO_O_RULE = defined + +%.o: %.cpp %.cxx %.cc + -echo Can not build $*.o from $< without explicit dependency + -echo The Makefile.deps file was incorrectly generated + -echo All .o dependencies should be explicit in that file + +$(OBJDIR)/$(TARGET_LIB)/interval_lattice.o: interval_lattice.cpp interval_lattice.h /sow/16/16/livshits/work/src/nci/include/common/i_integer.h /sow/16/16/livshits/work/src/nci/include/common/MString.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h /sow/16/16/livshits/work/src/nci/include/common/simple_stack.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /usr/include/stdio.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h /usr/include/bits/stdio_lim.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_messages.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_forwarders.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/common_forwarders.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_messages.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/interval_lattice.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) interval_lattice.cpp + +$(OBJDIR)/$(TARGET_LIB)/unary.o: unary.cpp unary.h /sow/16/16/livshits/work/src/nci/include/bit_vector/bit_vector.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /sow/16/16/livshits/work/src/nci/include/common/MString.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h /sow/16/16/livshits/work/src/nci/include/common/simple_stack.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /sow/16/16/livshits/work/src/nci/include/common/i_integer.h /usr/include/stdio.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h /usr/include/bits/stdio_lim.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h /sow/16/16/livshits/work/src/nci/include/ion/ion.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/unary.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) unary.cpp + +$(OBJDIR)/$(TARGET_LIB)/indexed_lattice.o: indexed_lattice.cpp indexed_lattice.h /sow/16/16/livshits/work/src/nci/include/bit_vector/cross_map.h /sow/16/16/livshits/work/src/nci/include/common/machine_dependent.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h /sow/16/16/livshits/work/src/nci/include/common/common_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/suif_hash_map.h /sow/16/16/livshits/work/src/nci/include/common/suif_hash_fn.h /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/time.h /usr/include/endian.h /usr/include/bits/endian.h /usr/include/sys/select.h /usr/include/bits/select.h /usr/include/bits/sigset.h /usr/include/bits/time.h /usr/include/sys/sysmacros.h /usr/include/alloca.h /sow/16/16/livshits/work/src/nci/include/common/suif_vector.h /usr/include/g++-2/cstddef /sow/16/16/livshits/work/src/nci/include/common/MString.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h /sow/16/16/livshits/work/src/nci/include/common/simple_stack.h nary.h /sow/16/16/livshits/work/src/nci/include/bit_vector/bit_vector.h /sow/16/16/livshits/work/src/nci/include/common/i_integer.h /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h /usr/include/bits/stdio_lim.h /sow/16/16/livshits/work/src/nci/include/ion/ion.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/indexed_lattice.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) indexed_lattice.cpp + +$(OBJDIR)/$(TARGET_LIB)/nary_bit_lattice.o: nary_bit_lattice.cpp nary_bit_lattice.h bit_lattice.h /sow/16/16/livshits/work/src/nci/include/common/MString.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h /sow/16/16/livshits/work/src/nci/include/common/simple_stack.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h unary.h /sow/16/16/livshits/work/src/nci/include/bit_vector/bit_vector.h /sow/16/16/livshits/work/src/nci/include/common/i_integer.h /usr/include/stdio.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h /usr/include/bits/stdio_lim.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h /sow/16/16/livshits/work/src/nci/include/ion/ion.h nary.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/nary_bit_lattice.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) nary_bit_lattice.cpp + +$(OBJDIR)/$(TARGET_LIB)/hindexed_lattice.o: hindexed_lattice.cpp hindexed_lattice.h /sow/16/16/livshits/work/src/nci/include/common/suif_hash_map.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /sow/16/16/livshits/work/src/nci/include/common/suif_hash_fn.h /sow/16/16/livshits/work/src/nci/include/common/common_forwarders.h /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/time.h /usr/include/endian.h /usr/include/bits/endian.h /usr/include/sys/select.h /usr/include/bits/select.h /usr/include/bits/sigset.h /usr/include/bits/time.h /usr/include/sys/sysmacros.h /usr/include/alloca.h /sow/16/16/livshits/work/src/nci/include/common/MString.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h /sow/16/16/livshits/work/src/nci/include/common/simple_stack.h lattice_utils_forwarders.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/hindexed_lattice.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) hindexed_lattice.cpp + +$(OBJDIR)/$(TARGET_LIB)/standard_main.o: standard_main.cpp /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_forwarders.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_forwarders.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /sow/16/16/livshits/work/src/nci/include/common/common_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/MString.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h /sow/16/16/livshits/work/src/nci/include/common/simple_stack.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_messages.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_messages.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suif_env.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h /sow/16/16/livshits/work/src/nci/include/suifkernel/module_subsystem.h /sow/16/16/livshits/work/src/nci/include/suifkernel/token_stream.h /sow/16/16/livshits/work/src/nci/include/suifkernel/char_source.h /usr/include/g++-2/iostream.h /usr/include/g++-2/streambuf.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /sow/16/16/livshits/work/src/nci/include/suifpasses/suifpasses.h /sow/16/16/livshits/work/src/nci/include/suifpasses/standard_modules.h /sow/16/16/livshits/work/src/nci/include/suifkernel/module.h /sow/16/16/livshits/work/src/nci/include/suifpasses/passes.h /sow/16/16/livshits/work/src/nci/include/suifpasses/drivers.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/standard_main.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) standard_main.cpp + +$(OBJDIR)/$(TARGET_LIB)/const_lattice.o: const_lattice.cpp const_lattice.h /sow/16/16/livshits/work/src/nci/include/common/i_integer.h /sow/16/16/livshits/work/src/nci/include/common/MString.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h /sow/16/16/livshits/work/src/nci/include/common/simple_stack.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /usr/include/stdio.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h /usr/include/bits/stdio_lim.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/const_lattice.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) const_lattice.cpp + +$(OBJDIR)/$(TARGET_LIB)/named_nary.o: named_nary.cpp named_nary.h nary.h /sow/16/16/livshits/work/src/nci/include/bit_vector/bit_vector.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /sow/16/16/livshits/work/src/nci/include/common/MString.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h /sow/16/16/livshits/work/src/nci/include/common/simple_stack.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /sow/16/16/livshits/work/src/nci/include/common/i_integer.h /usr/include/stdio.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h /usr/include/bits/stdio_lim.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h /sow/16/16/livshits/work/src/nci/include/ion/ion.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/named_nary.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) named_nary.cpp + +$(OBJDIR)/$(TARGET_LIB)/lattice_utils.o: lattice_utils.cpp /sow/16/16/livshits/work/src/nci/include/suifkernel/suif_env.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_forwarders.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_forwarders.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /sow/16/16/livshits/work/src/nci/include/common/common_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/MString.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h /sow/16/16/livshits/work/src/nci/include/common/simple_stack.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_messages.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_messages.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/lattice_utils.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) lattice_utils.cpp + +$(OBJDIR)/$(TARGET_LIB)/init_lattice.o: init_lattice.cpp init_lattice.h /sow/16/16/livshits/work/src/nci/include/common/MString.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h /sow/16/16/livshits/work/src/nci/include/common/simple_stack.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/init_lattice.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) init_lattice.cpp + +$(OBJDIR)/$(TARGET_LIB)/nary.o: nary.cpp nary.h /sow/16/16/livshits/work/src/nci/include/bit_vector/bit_vector.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /sow/16/16/livshits/work/src/nci/include/common/MString.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h /sow/16/16/livshits/work/src/nci/include/common/simple_stack.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /sow/16/16/livshits/work/src/nci/include/common/i_integer.h /usr/include/stdio.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h /usr/include/bits/stdio_lim.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h /sow/16/16/livshits/work/src/nci/include/ion/ion.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/nary.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) nary.cpp + +$(OBJDIR)/$(TARGET_LIB)/smash_lattice.o: smash_lattice.cpp smash_lattice.h /sow/16/16/livshits/work/src/nci/include/common/MString.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h /sow/16/16/livshits/work/src/nci/include/common/simple_stack.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/smash_lattice.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) smash_lattice.cpp + +$(OBJDIR)/$(TARGET_LIB)/bit_lattice.o: bit_lattice.cpp bit_lattice.h /sow/16/16/livshits/work/src/nci/include/common/MString.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h /sow/16/16/livshits/work/src/nci/include/common/simple_stack.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h unary.h /sow/16/16/livshits/work/src/nci/include/bit_vector/bit_vector.h /sow/16/16/livshits/work/src/nci/include/common/i_integer.h /usr/include/stdio.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h /usr/include/bits/stdio_lim.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h /sow/16/16/livshits/work/src/nci/include/ion/ion.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/bit_lattice.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) bit_lattice.cpp + diff -Nur nci/suif/suif2b/extratypes/lattice_utils/bit_lattice.cpp nci-latest/suif/suif2b/extratypes/lattice_utils/bit_lattice.cpp --- nci/suif/suif2b/extratypes/lattice_utils/bit_lattice.cpp Sat Jun 3 09:36:49 2000 +++ nci-latest/suif/suif2b/extratypes/lattice_utils/bit_lattice.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #include "bit_lattice.h" BitLattice::BitLattice() : @@ -30,7 +31,7 @@ BitLattice::~BitLattice() {} -String BitLattice::toString() const { +String BitLattice::to_string() const { if (is_top()) return "^"; if (is_bottom()) return "v"; if (is_true()) return "1"; @@ -57,6 +58,14 @@ return (!is_definite() && _is_bottom); } +BitLattice BitLattice::new_top() const { + return(BitLattice(B_TOP)); +} + +BitLattice *BitLattice::new_top_ptr() const { + return(new BitLattice(B_TOP)); +} + BitLattice::BVal BitLattice::get_value() const { if (!_is_bottom && !_value) return(B_TOP); @@ -65,6 +74,13 @@ assert(_is_bottom && !_value); return(B_FALSE); } + +void +BitLattice::set_value(BVal value) { + BitLattice l(value); + (*this) = l; +} + bool BitLattice::get_bottom_bit() const { return _is_bottom; } bool BitLattice::get_value_bit() const { return _value; } diff -Nur nci/suif/suif2b/extratypes/lattice_utils/bit_lattice.h nci-latest/suif/suif2b/extratypes/lattice_utils/bit_lattice.h --- nci/suif/suif2b/extratypes/lattice_utils/bit_lattice.h Sat Jun 3 09:36:49 2000 +++ nci-latest/suif/suif2b/extratypes/lattice_utils/bit_lattice.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef BIT_LATTICE_H #define BIT_LATTICE_H @@ -28,14 +29,14 @@ typedef enum bval BVal; public: BitLattice(); /* top */ - BitLattice(BVal); + explicit BitLattice(BVal); BitLattice(const BitLattice &); BitLattice &operator=(const BitLattice &); - BitLattice(bool value); /* true or false */ + explicit BitLattice(bool value); /* true or false */ BitLattice(bool is_bottom, bool value); ~BitLattice(); - String toString() const; + String to_string() const; bool is_top() const; bool is_true() const; bool is_false() const; @@ -47,6 +48,7 @@ bool get_value_bit() const; BVal get_value() const; + void set_value(BVal); bool operator==(const BitLattice &) const; bool operator!=(const BitLattice &) const; @@ -62,6 +64,11 @@ static BitLattice do_and(const BitLattice &, const BitLattice &); static BitLattice do_or(const BitLattice &, const BitLattice &); static BitLattice do_not(const BitLattice &); + + /* standard template "new_top" */ + BitLattice BitLattice::new_top() const; + BitLattice *BitLattice::new_top_ptr() const; + }; typedef BitLattice (*unary_bit_transform) (const BitLattice &); diff -Nur nci/suif/suif2b/extratypes/lattice_utils/const_lattice.cpp nci-latest/suif/suif2b/extratypes/lattice_utils/const_lattice.cpp --- nci/suif/suif2b/extratypes/lattice_utils/const_lattice.cpp Sat Jun 3 09:36:49 2000 +++ nci-latest/suif/suif2b/extratypes/lattice_utils/const_lattice.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #include "const_lattice.h" ConstantLattice::ConstantLattice() : @@ -38,19 +39,19 @@ return(_value); } -String ConstantLattice::toString() const { +String ConstantLattice::to_string() const { switch(_key) { case B_TOP: - return("^"); + return("Top"); case B_CONST: - return(_value.to_String()); + return(_value.to_string()); case B_BOTTOM: - return("v"); + return("Bottom"); default: break; } assert(0); - return("v"); + return("Bottom"); } bool ConstantLattice::is_bottom() const { @@ -65,7 +66,7 @@ return(ConstantLattice(B_BOTTOM)); } ConstantLattice ConstantLattice::top() { - return(ConstantLattice(B_BOTTOM)); + return(ConstantLattice(B_TOP)); } @@ -107,4 +108,20 @@ return(false); *this = val; return(true); +} + +ConstantLattice ConstantLattice:: +new_top() const { + return(top()); +} + +ConstantLattice *ConstantLattice:: +new_top_ptr() const { + return(new ConstantLattice(top())); +} + + +ConstantLattice ConstantLattice:: +new_bottom() const { + return(bottom()); } diff -Nur nci/suif/suif2b/extratypes/lattice_utils/const_lattice.h nci-latest/suif/suif2b/extratypes/lattice_utils/const_lattice.h --- nci/suif/suif2b/extratypes/lattice_utils/const_lattice.h Sat Jun 3 09:36:49 2000 +++ nci-latest/suif/suif2b/extratypes/lattice_utils/const_lattice.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef CONST_LATTICE_H #define CONST_LATTICE_H @@ -39,7 +40,7 @@ ConstantLattice(const ConstantLattice &); ConstantLattice &operator=(const ConstantLattice &); ~ConstantLattice(); - String toString() const; + String to_string() const; bool is_top() const; IInteger get_constant() const; /* return is_undetermined for TOP or BOTTOM */ bool is_bottom() const; @@ -53,6 +54,9 @@ bool operator!=(const ConstantLattice &) const; static ConstantLattice do_meet(const ConstantLattice &, const ConstantLattice &); bool do_meet_with_test(const ConstantLattice &); + ConstantLattice new_top() const; + ConstantLattice *new_top_ptr() const; + ConstantLattice new_bottom() const; }; diff -Nur nci/suif/suif2b/extratypes/lattice_utils/hindexed_lattice.cpp nci-latest/suif/suif2b/extratypes/lattice_utils/hindexed_lattice.cpp --- nci/suif/suif2b/extratypes/lattice_utils/hindexed_lattice.cpp Sat Jun 3 09:36:49 2000 +++ nci-latest/suif/suif2b/extratypes/lattice_utils/hindexed_lattice.cpp Wed Feb 13 10:26:07 2002 @@ -1 +1,2 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #include "hindexed_lattice.h" diff -Nur nci/suif/suif2b/extratypes/lattice_utils/hindexed_lattice.h nci-latest/suif/suif2b/extratypes/lattice_utils/hindexed_lattice.h --- nci/suif/suif2b/extratypes/lattice_utils/hindexed_lattice.h Thu Jun 8 05:54:20 2000 +++ nci-latest/suif/suif2b/extratypes/lattice_utils/hindexed_lattice.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef HINDEXED_LATTICE_H #define HINDEXED_LATTICE_H @@ -5,6 +6,7 @@ // on the IndexObj #include +#include #include "lattice_utils_forwarders.h" // This contains a map from variable->lattice_value @@ -12,10 +14,17 @@ // It should just become a class parameterized by the // index. // -template +/* + * There are a number of constraints on the IndexObj and SubLattice + * -- For printing to work, SubLattice::to_string and + * a function ::index_to_string(IndexObj) must be visible. + */ + + +template class HIndexedLattice { - typedef suif_hash_map VMap; + typedef suif_hash_map VMap; typedef typename VMap::const_iterator ConstVIter; typedef typename VMap::iterator VIter; VMap *_values; @@ -25,11 +34,21 @@ HIndexedLattice(const HIndexedLattice &other); HIndexedLattice &operator=(const HIndexedLattice &other); ~HIndexedLattice(); + + // new_top is most useful for an indexed lattice where there is + // a shared id + HIndexedLattice new_top() const; + HIndexedLattice *new_top_ptr() const; + bool is_top() const; + bool is_bottom() const; + void set_value(IndexObj v, SubLattice val); SubLattice get_value(IndexObj v) const; SubLattice get_default_value() const; bool do_meet_with_test(const HIndexedLattice &other); + static HIndexedLattice do_meet(const HIndexedLattice &val1, + const HIndexedLattice &val2); HIndexedLattice *clone() const; // pass in a function pointer to a function that @@ -37,6 +56,9 @@ bool do_apply_fn_with_test(const HIndexedLattice &other, bool(*fn) (SubLattice &, const SubLattice &)); + bool operator==(const HIndexedLattice &other) const; + bool operator!=(const HIndexedLattice &other) const; + // To string must be passed functions that convert #if 0 // egcs 1.1.2 bug prevents this @@ -44,13 +66,14 @@ String (*lattice_to_string) (const SubLattice &), String delimiter) const; #endif + String to_string() const; class iterator { - suif_hash_map *_map; - suif_hash_map::iterator _iter; - suif_hash_map::iterator _iter_end; + suif_hash_map *_map; + suif_hash_map::iterator _iter; + suif_hash_map::iterator _iter_end; public: - iterator(const HIndexedLattice *map) : + iterator(const HIndexedLattice *map) : _map(map->_values), _iter(map->_values->begin()), _iter_end(map->_values->end()) @@ -87,29 +110,30 @@ // Here are the definitions -template -HIndexedLattice:: +template +HIndexedLattice:: HIndexedLattice(SubLattice def) : - _values( new suif_hash_map()), + _values( new suif_hash_map()), _default_value(def) {} -template -HIndexedLattice:: -HIndexedLattice(const HIndexedLattice &other) : - _values( new suif_hash_map()), - _default_value(other._default_value) +template +HIndexedLattice:: +HIndexedLattice(const HIndexedLattice &other) : + //_values( new suif_hash_map() ), + _values( new suif_hash_map(other._values->size())), + _default_value(other._default_value) { - for (VIter iter = - other._values->begin(); iter != other._values->end(); iter++) { - _values->enter_value((*iter).first, (*iter).second); - } + for (VIter iter = + other._values->begin(); iter != other._values->end(); iter++) { + _values->enter_value((*iter).first, (*iter).second); + } } -template -HIndexedLattice & -HIndexedLattice:: -operator=(const HIndexedLattice &other) { +template +HIndexedLattice & +HIndexedLattice:: +operator=(const HIndexedLattice &other) { _values->clear(); for (VIter iter = other._values->begin(); iter != other._values->end(); iter++) { @@ -119,38 +143,66 @@ return(*this); } +template +HIndexedLattice HIndexedLattice:: +new_top() const { + return(HIndexedLattice(_default_value.new_top())); +} + +template +HIndexedLattice *HIndexedLattice:: +new_top_ptr() const { + return(new HIndexedLattice(_default_value.new_top())); +} + +template +bool HIndexedLattice:: +is_top() const { + if (!_default_value.is_top()) + return(false); + return (_values->size() == 0); +} + +template +bool HIndexedLattice:: +is_bottom() const { + if (!_default_value.is_bottom()) + return(false); + return (_values->size() == 0); +} -template -HIndexedLattice:: + +template +HIndexedLattice:: ~HIndexedLattice() { delete _values; } -template -void HIndexedLattice:: +template +void HIndexedLattice:: set_value(IndexObj v, SubLattice val) { _values->enter_value(v, val); } -template -SubLattice HIndexedLattice:: +template +SubLattice HIndexedLattice:: get_value(IndexObj v) const { - suif_hash_map::const_iterator iter = + suif_hash_map::const_iterator iter = _values->find(v); if (iter == _values->end()) return(get_default_value()); return((*iter).second); } -template -SubLattice HIndexedLattice:: +template +SubLattice HIndexedLattice:: get_default_value() const { return(_default_value); } -template -bool HIndexedLattice:: +template +bool HIndexedLattice:: do_meet_with_test(const HIndexedLattice &other) { // This is just do_apply_fn with test but the FN is // meet. @@ -158,48 +210,83 @@ bool changed = false; // Make a list of all of the ones that are not default suif_hash_map v; - for (iterator iter(this); iter.is_valid(); iter.next()) { - v.enter_value(iter.current(), true); + for (iterator iter1(this); iter1.is_valid(); iter1.next()) { + v.enter_value(iter1.current(), true); } - for (iterator iter(&other); iter.is_valid(); iter.next()) { - v.enter_value(iter.current(), true); + for (iterator iter2(&other); iter2.is_valid(); iter2.next()) { + v.enter_value(iter2.current(), true); } + // 2 cases: If the default value changes, + // we work on the new val. + // Otherwise, work on the old val + + SubLattice default_value = _default_value; + bool changed_default = + default_value.do_meet_with_test(other._default_value); + // Now walk over that list and apply for each for (suif_hash_map::iterator it = v.begin(); it != v.end(); it++) { IndexObj obj = (*it).first; SubLattice v1 = get_value(obj); + + bool v1_is_default = (_values->find(obj) == _values->end()); + SubLattice v2 = other.get_value(obj); // This is the function - if (v1.do_meet_with_test(v2)) { + if (v1.do_meet_with_test(v2) + || (v1_is_default && changed_default)) { + // There is an issue when the orig default value is TOP, + // the other value is TOP and the default value will + // change changed = true; - set_value(obj, v1); + // We use the dangerous form in case + // set_value ever check against the default value + _values->enter_value(obj, v1); } } + // Finally, change the default if needed + // SubLattice default_value = _default_value; + // if (default_value.do_meet_with_test(other._default_value)) { + if (changed_default) { + changed = true; + _default_value = default_value; + } return(changed); } -template -HIndexedLattice *HIndexedLattice:: + +template +HIndexedLattice HIndexedLattice:: +do_meet(const HIndexedLattice &val1, const HIndexedLattice &val2) { + // This is just do_apply_fn with test but the FN is + // meet. + HIndexedLattice obj(val1); + obj.do_meet_with_test(val2); + return(obj); +} + +template +HIndexedLattice *HIndexedLattice:: clone() const { HIndexedLattice *new_l = new HIndexedLattice(*this); return(new_l); } -template -bool HIndexedLattice:: +template +bool HIndexedLattice:: do_apply_fn_with_test(const HIndexedLattice &other, bool(*fn) (SubLattice &, const SubLattice &)) { bool changed = false; // Make a list of all of the ones that are not default suif_hash_map v; - for (iterator iter(this); iter.is_valid(); iter.next()) { - v.enter_value(iter.current(), true); + for (iterator iter1(this); iter1.is_valid(); iter1.next()) { + v.enter_value(iter1.current(), true); } - for (iterator iter(&other); iter.is_valid(); iter.next()) { - v.enter_value(iter.current(), true); + for (iterator iter2(&other); iter2.is_valid(); iter2.next()) { + v.enter_value(iter2.current(), true); } // Now walk over that list and apply for each @@ -213,35 +300,79 @@ set_value(obj, v1); } } + + // Finally, change the default if needed + SubLattice default_value = _default_value; + if ((*fn)(default_value, other._default_value)) { + changed = true; + _default_value = default_value; + } + return(changed); } -/* This does NOT work in egcs 1.1.2 because of template problems */ -#if 0 -template -String HIndexedLattice:: -to_string( - String (*index_to_string)(const IndexObj &), - String (*lattice_to_string)(const SubLattice &), - String delimiter) const { - String s; - // Print the default value first - s += "default: "; - s += lattice_to_string(get_default_value()); - s += delimiter; - - for ( terator iter(this); - iter.is_valid(); iter.next()) { - IndexObj idx = iter.current(); - s += index_to_string(idx); - s += ": "; - SubLattice l = get_value(idx); - s += lattice_to_string(l); - s += delimiter; - } - return(s); + +template +String HIndexedLattice:: +to_string() const { + String s; + String delimiter(", "); + // Print the default value first + s += "{ default: {"; + s += get_default_value().to_string(); + s += "}"; + // s += delimiter; + + for ( HIndexedLattice::iterator iter(this); + iter.is_valid(); iter.next()) { + IndexObj idx = iter.current(); + + s += delimiter; + + s += ::index_to_string(idx); + s += ": {"; + SubLattice l = get_value(idx); + s += l.to_string(); + s += "}"; + } + s += "}"; + return(s); }; -#endif +template +bool HIndexedLattice:: +operator!=(const HIndexedLattice &other) const { + return( ! (*this == other)); +} + +template +bool HIndexedLattice:: +operator==(const HIndexedLattice &other) const { + + // Finally, change the default if needed + if (! (_default_value == other._default_value)) + return false; + + // Make a list of all of the ones that are not default + suif_hash_map v; + for (iterator iter1(this); iter1.is_valid(); iter1.next()) { + IndexObj obj = iter1.current(); + v.enter_value(obj, true); + if (other.get_value(obj) != iter1.current_val()) { + return(false); + } + } + for (iterator iter2(&other); iter2.is_valid(); iter2.next()) { + IndexObj obj = iter2.current(); + if (v.find(obj) == v.end()) { + continue; + } + v.enter_value(obj, true); + if (get_value(obj) != iter2.current_val()) { + return(false); + } + } + return(true); +} #endif /* HINDEXED_LATTICE_H */ diff -Nur nci/suif/suif2b/extratypes/lattice_utils/indexed_lattice.cpp nci-latest/suif/suif2b/extratypes/lattice_utils/indexed_lattice.cpp --- nci/suif/suif2b/extratypes/lattice_utils/indexed_lattice.cpp Sat Jun 3 09:36:50 2000 +++ nci-latest/suif/suif2b/extratypes/lattice_utils/indexed_lattice.cpp Wed Feb 13 10:26:07 2002 @@ -1 +1,2 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #include "indexed_lattice.h" diff -Nur nci/suif/suif2b/extratypes/lattice_utils/indexed_lattice.h nci-latest/suif/suif2b/extratypes/lattice_utils/indexed_lattice.h --- nci/suif/suif2b/extratypes/lattice_utils/indexed_lattice.h Sat Jun 3 09:36:50 2000 +++ nci-latest/suif/suif2b/extratypes/lattice_utils/indexed_lattice.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef INDEXED_LATTICE_H #define INDEXED_LATTICE_H @@ -10,59 +11,69 @@ // It should just become a class parameterized by the // index. // +// Template IndexedLattice requires: +// ::index_to_string(IndexObj) +// bool SubLattice::do_meet_with_test(const SubLattice &) +// SubLattice SubLattice::new_top() const; +// SubLattice SubLattice::new_bottom() const; +// bool SubLattice::is_top() const; +// bool SubLattice::is_bottom() const; + template class IndexedLattice { - CrossMap *_map; // shared with many other lattice values - NaryL _values; + CrossMap *_map; // shared with many other lattice values + NaryL _values; public: - IndexedLattice(CrossMap *map, SubLattice def); - void set_value(IndexObj v, SubLattice val); - SubLattice get_value(IndexObj v) const; - SubLattice get_default_value() const; - CrossMap *get_map() const { return(_map); } - - bool do_meet_with_test(const IndexedLattice &other); - IndexedLattice *clone() const; - - // To string must be passed functions that convert -#if 0 - // egcs 1.1.2 bug prevents this - String to_string( String (*index_to_string) (const IndexObj &), - String (*lattice_to_string) (const SubLattice &), - String delimiter) const; -#endif - - class iterator { - const IndexedLattice *_map; - CrossMap::iterator _iter; - public: - iterator(const IndexedLattice *map) : - _map(map), - _iter(map->_map) - {} - iterator(const iterator &other) : - _map(other._map), - _iter(other._iter) - {} - iterator &operator=(const iterator &other) { - _map = other._map; - _iter = other._iter; - return(*this); - } - IndexObj current() const { - return (_iter.current()); - } - SubLattice current_val() const { - return (_map.get_value(current())); - } - bool is_valid() const { - return (_iter.is_valid()); - } - void next() { _iter.next(); } - void reset() { _iter.reset(); } - }; - friend class iterator; + IndexedLattice(CrossMap *map, SubLattice def); + IndexedLattice(const IndexedLattice &other); + void set_value(IndexObj v, SubLattice val); + SubLattice get_value(IndexObj v) const; + SubLattice get_default_value() const; + CrossMap *get_map() const { return(_map); } + + bool do_meet_with_test(const IndexedLattice &other); + IndexedLattice *clone() const; + IndexedLattice new_top() const; + IndexedLattice *new_top_ptr() const; + IndexedLattice new_bottom() const; + + + bool is_top() const; + bool is_bottom() const; + + String to_string() const; + + class iterator { + const IndexedLattice *_map; + CrossMap::iterator _iter; + public: + iterator(const IndexedLattice *map) : + _map(map), + _iter(map->_map) + {} + iterator(const iterator &other) : + _map(other._map), + _iter(other._iter) + {} + iterator &operator=(const iterator &other) { + _map = other._map; + _iter = other._iter; + return(*this); + } + IndexObj current() const { + return (_iter.current()); + } + SubLattice current_val() const { + return (_map->get_value(current())); + } + bool is_valid() const { + return (_iter.is_valid()); + } + void next() { _iter.next(); } + void reset() { _iter.reset(); } + }; + friend class iterator; }; @@ -75,6 +86,13 @@ {} template +IndexedLattice:: +IndexedLattice(const IndexedLattice &other) : + _map(other._map), + _values(other._values) +{} + +template void IndexedLattice:: set_value(IndexObj v, SubLattice val) { size_t i = _map->retrieve_id(v); @@ -93,6 +111,7 @@ template SubLattice IndexedLattice:: get_default_value() const { + return(_values.get_default_value()); } @@ -113,32 +132,67 @@ return(new_l); } -/* This does NOT work in egcs 1.1.2 because of template problems */ -#if 0 +template +IndexedLattice IndexedLattice:: +new_top() const { + IndexedLattice new_l(_map, _values.get_default_value().new_top()); + return(new_l); +} + +template +IndexedLattice *IndexedLattice:: +new_top_ptr() const { + return(new IndexedLattice(_map, _values.get_default_value().new_top())); +} + +template +IndexedLattice IndexedLattice:: +new_bottom() const { + IndexedLattice new_l(_map, _values.get_default_value().new_top()); + return(new_l); +} + +template +bool IndexedLattice:: +is_top() const { + if (!get_default_value().is_top()) + return(false); + return(_values.size() == 0); +} + +template +bool IndexedLattice:: +is_bottom() const { + if (!get_default_value().is_bottom()) + return(false); + return(_values.size() == 0); +} + template String IndexedLattice:: -to_string( - String (*index_to_string)(const IndexObj &), - String (*lattice_to_string)(const SubLattice &), - String delimiter) const { +to_string() const { String s; + String delimiter(", "); // Print the default value first - s += "default: "; - s += lattice_to_string(get_default_value()); - s += delimiter; + s += "{ default: {"; + s += get_default_value().to_string(); + s += "}"; for ( IndexedLattice::iterator iter(this); iter.is_valid(); iter.next()) { - IndexObj *idx = iter.current(); - s += index_to_string(idx); - s += ": "; - SubLattice l = get_value(idx); - s += lattice_to_string(l); + IndexObj idx = iter.current(); s += delimiter; + + s += ::index_to_string(idx); + s += ": {"; + SubLattice l = iter.current_val(); + s += l.to_string(); + s += "}"; } + s += "}"; return(s); }; -#endif + #endif /* INDEXED_LATTICE_H */ diff -Nur nci/suif/suif2b/extratypes/lattice_utils/init_interval_lattice.h nci-latest/suif/suif2b/extratypes/lattice_utils/init_interval_lattice.h --- nci/suif/suif2b/extratypes/lattice_utils/init_interval_lattice.h Sat Jun 3 09:36:50 2000 +++ nci-latest/suif/suif2b/extratypes/lattice_utils/init_interval_lattice.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef INIT_INTERVAL_LATTICE_H #define INIT_INTERVAL_LATTICE_H @@ -36,7 +37,7 @@ bool operator!=(const IntervalVal &other) const; ~IntervalVal(); - String toString() const; + String to_string() const; // ObjectContext *get_object_context() const; bool is_top() const; diff -Nur nci/suif/suif2b/extratypes/lattice_utils/init_lattice.cpp nci-latest/suif/suif2b/extratypes/lattice_utils/init_lattice.cpp --- nci/suif/suif2b/extratypes/lattice_utils/init_lattice.cpp Sat Jun 3 09:36:50 2000 +++ nci-latest/suif/suif2b/extratypes/lattice_utils/init_lattice.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #include "init_lattice.h" InitLattice::InitLattice() : @@ -32,7 +33,7 @@ bool InitLattice::is_top() const { return(_key == B_TOP); } -String InitLattice::toString() const { +String InitLattice::to_string() const { switch(_key) { case B_TOP: return("TOP"); @@ -84,4 +85,21 @@ return(false); *this = val; return(true); +} + +InitLattice InitLattice:: +new_top() const { + return(top()); +} + + +InitLattice *InitLattice:: +new_top_ptr() const { + return(new InitLattice(top())); +} + + +InitLattice InitLattice:: +new_bottom() const { + return(bottom()); } diff -Nur nci/suif/suif2b/extratypes/lattice_utils/init_lattice.h nci-latest/suif/suif2b/extratypes/lattice_utils/init_lattice.h --- nci/suif/suif2b/extratypes/lattice_utils/init_lattice.h Sat Jun 3 09:36:50 2000 +++ nci-latest/suif/suif2b/extratypes/lattice_utils/init_lattice.h Wed Feb 13 10:26:07 2002 @@ -1,11 +1,12 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef INIT_LATTICE_H #define INIT_LATTICE_H -#include "common/i_integer.h" - -/* (c) 2000 David Heine, Stanford SUIF Project +/* (c) 2000 David Heine, Brian Murphy, Stanford SUIF Project */ +#include + /* Top * | * INIT @@ -21,24 +22,18 @@ /* This is the lattice: TOP - / \ - -inf .. -1 0 1 ... inf INITIAL - \ / + | + INITIAL + | BOTTOM */ - /* - * i_integer also encodes "is_undetermined" and is_infinity - * is_constant == false ===> _value == is_undetermined - * is_infinity is NEVER a valid value for a constant. - * it is "bottom" - */ public: InitLattice(); /* top */ InitLattice(BVal); /* to set top, bottom or initial */ InitLattice(const InitLattice &); InitLattice &operator=(const InitLattice &); ~InitLattice(); - String toString() const; + String to_string() const; bool is_top() const; bool is_bottom() const; bool is_initial() const; @@ -50,6 +45,9 @@ bool operator!=(const InitLattice &) const; static InitLattice do_meet(const InitLattice &, const InitLattice &); bool do_meet_with_test(const InitLattice &); + InitLattice new_top() const; + InitLattice *new_top_ptr() const; + InitLattice new_bottom() const; }; diff -Nur nci/suif/suif2b/extratypes/lattice_utils/interval_lattice.cpp nci-latest/suif/suif2b/extratypes/lattice_utils/interval_lattice.cpp --- nci/suif/suif2b/extratypes/lattice_utils/interval_lattice.cpp Sat Jun 3 09:36:50 2000 +++ nci-latest/suif/suif2b/extratypes/lattice_utils/interval_lattice.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #include "interval_lattice.h" #include @@ -79,7 +80,7 @@ return(true); } -String IntervalLattice::toString() const { +String IntervalLattice::to_string() const { if (is_bottom()) return ("<-inf...+inf>"); // if (get_is_exact()) return ( // String("[") + diff -Nur nci/suif/suif2b/extratypes/lattice_utils/interval_lattice.h nci-latest/suif/suif2b/extratypes/lattice_utils/interval_lattice.h --- nci/suif/suif2b/extratypes/lattice_utils/interval_lattice.h Sat Jun 3 09:36:51 2000 +++ nci-latest/suif/suif2b/extratypes/lattice_utils/interval_lattice.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef INTERVAL_LATTICE_H #define INTERVAL_LATTICE_H @@ -34,7 +35,7 @@ // value, then it is BOTTOM. ~IntervalLattice(); - String toString() const; + String to_string() const; // ObjectContext *get_object_context() const; bool is_top() const; diff -Nur nci/suif/suif2b/extratypes/lattice_utils/lattice_utils.cpp nci-latest/suif/suif2b/extratypes/lattice_utils/lattice_utils.cpp --- nci/suif/suif2b/extratypes/lattice_utils/lattice_utils.cpp Sat Jun 3 09:36:51 2000 +++ nci-latest/suif/suif2b/extratypes/lattice_utils/lattice_utils.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #include extern "C" void init_lattice_utils(SuifEnv *s) { s->require_DLL("bit_vector"); diff -Nur nci/suif/suif2b/extratypes/lattice_utils/lattice_utils_forwarders.h nci-latest/suif/suif2b/extratypes/lattice_utils/lattice_utils_forwarders.h --- nci/suif/suif2b/extratypes/lattice_utils/lattice_utils_forwarders.h Sat Jun 3 09:36:51 2000 +++ nci-latest/suif/suif2b/extratypes/lattice_utils/lattice_utils_forwarders.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef LATTICE_UTILS_FORWARDERS_H #define LATTICE_UTILS_FORWARDERS_H @@ -10,8 +11,13 @@ class IntervalLattice; class InitLattice; +#include +// needed to define the suif_hash_fn<> templates + template class IndexedLattice; -template class HIndexedLattice; +template , + class eqdomain = suif_eq_fn > class HIndexedLattice; template class SmashLattice; #endif /* LATTICE_UTILS_FORWARDERS_H */ diff -Nur nci/suif/suif2b/extratypes/lattice_utils/named_nary.cpp nci-latest/suif/suif2b/extratypes/lattice_utils/named_nary.cpp --- nci/suif/suif2b/extratypes/lattice_utils/named_nary.cpp Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/lattice_utils/named_nary.cpp Wed Feb 13 10:26:07 2002 @@ -0,0 +1,2 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +#include "named_nary.h" diff -Nur nci/suif/suif2b/extratypes/lattice_utils/named_nary.h nci-latest/suif/suif2b/extratypes/lattice_utils/named_nary.h --- nci/suif/suif2b/extratypes/lattice_utils/named_nary.h Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/lattice_utils/named_nary.h Wed Feb 13 10:26:07 2002 @@ -0,0 +1,227 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +#ifndef NAMED_NARY_H +#define NAMED_NARY_H + +#include "nary.h" + +/* + * Template class requirements + * class NameE MUST have a type named NameE::NameEnum + * that is used to index the relations + */ +template +class NamedNaryL { + NaryL _value; +public: + NamedNaryL(); /* default is top */ + NamedNaryL(const NamedNaryL &other); + NamedNaryL(const Rel &default_value); + NamedNaryL operator~() const; + static NamedNaryL do_negate(const NamedNaryL &val); + NamedNaryL &operator =(const NamedNaryL &other); + bool operator ==(const NamedNaryL &other) const; + bool operator !=(const NamedNaryL &other) const; + + + Rel& operator[](typename NameE::NameEnum e); /* expand */ + Rel operator[](typename NameE::NameEnum e) const; + + + Rel get_value(typename NameE::NameEnum e) const; + void set_value(typename NameE::NameEnum e, const Rel &val); + + bool is_empty() const; + bool is_top() const; + bool is_bottom() const; + size_t size() const; /* for this dimension */ + void set_default_value(const Rel &default_value); + Rel get_default_value() const; + size_t significant_bit_count() const; + bool do_meet_with_test(const NamedNaryL &other); + static NamedNaryL do_meet(const NamedNaryL &val1, const NamedNaryL &val2); + String to_string() const; + NamedNaryL new_top() const; + NamedNaryL *new_top_ptr() const; + +}; + +template +NamedNaryL::NamedNaryL() : _value() {} + +template +NamedNaryL::NamedNaryL(const NamedNaryL &other) : + _value(other._value) { +} + +template +NamedNaryL::NamedNaryL(const Rel &other) : + _value(other) { +} + +template +NamedNaryL NamedNaryL::operator~() const { + return(NamedNaryL(_value.operator~())); +} + +template +NamedNaryL NamedNaryL::do_negate(const NamedNaryL &val) { + return(NamedNaryL(val._value.do_negate())); +} + +template +NamedNaryL &NamedNaryL::operator =(const NamedNaryL &other) { + _value = other._value; + return(*this); +} + +template +bool NamedNaryL::operator ==(const NamedNaryL &other) const { + return(_value == other._value); +} +template +bool NamedNaryL::operator !=(const NamedNaryL &other) const { + return(! (*this == other)); +} + +template +Rel& NamedNaryL::operator[](typename NameE::NameEnum e) { + return(_value[(size_t)e]); +} + +template +Rel NamedNaryL::operator[](typename NameE::NameEnum e) const { + return(_value[(size_t)e]); +} + +template +Rel NamedNaryL::get_value(typename NameE::NameEnum e) const { + return(_value.get_value((size_t)e)); +} + +template +void NamedNaryL::set_value(typename NameE::NameEnum e, const Rel &val) { + return(_value.set_value((size_t)e, val)); +} + +template +bool NamedNaryL::is_empty() const { + return(_value.is_empty()); +} + +template +bool NamedNaryL::is_top() const { + return(_value.is_top()); +} + +template +bool NamedNaryL::is_bottom() const { + return(_value.is_bottom()); +} + +template +size_t NamedNaryL::size() const { + return(_value.size()); +} + +template +void NamedNaryL::set_default_value(const Rel &default_value) { + _value.set_default_value(default_value); +} + +template +Rel NamedNaryL::get_default_value() const { + return(_value.get_default_value()); +} + + +template +size_t NamedNaryL::significant_bit_count() const { + return(_value.significant_bit_count()); +} + +template +bool NamedNaryL::do_meet_with_test(const NamedNaryL &other) { + return(_value.do_meet_with_test(other._value)); +} + +template +NamedNaryL NamedNaryL::do_meet(const NamedNaryL &val1, + const NamedNaryL &val2) { + return(NamedNaryL(val1.do_meet(val1, val2))); +} + +template +String NamedNaryL::to_string() const { + String result = "{"; + for (size_t i = 0; i < _value.size(); i++) { + if (i != 0) { + result += ", "; + } + typename NameE::NameEnum e = (typename NameE::NameEnum)i; + String idx = NameE::get_index_name(e); + result += idx; + result += ": "; + result += _value.get_value(i).to_string(); + } + result += "}"; + return(result); +} + +template +NamedNaryL NamedNaryL::new_top() const { + NamedNaryL l(_value.get_default_value().new_top()); + return(l); +} + +template +NamedNaryL *NamedNaryL::new_top_ptr() const { + return (new NamedNaryL(_value.get_default_value().new_top())); +} + + +#if 0 +// Now special case for the unary... +template +class NamedUnaryBitLattice { + UnaryRelationBitLattice _value; +public: + NamedUnaryBitLattice(); /* default is top */ + NamedUnaryBitLattice(const NamedUnaryBitLattice &other); + NamedUnaryBitLattice(const BitLattice &default_value); /* default value */ + NamedUnaryBitLattice &operator=(const NamedUnaryBitLattice &other); + ~NamedUnaryBitLattice(); + + static NamedUnaryBitLattice map_unary(unary_bit_transform fn, + const NamedUnaryBitLattice &val); + static NamedUnaryBitLattice map_binary(binary_bit_transform, + const NamedUnaryBitLattice &val1, + const NamedUnaryBitLattice &val2); + bool map_unary_with_test(unary_bit_transform fn); + bool map_binary_with_test(binary_bit_transform fn, + const NamedUnaryBitLattice &val); + + + bool operator==(const NamedUnaryBitLattice &) const; + bool operator!=(const NamedUnaryBitLattice &) const; + BitLattice get_value(size_t i) const; + void set_value(size_t i, const BitLattice &value); + void set_default_value(const BitLattice &value); + size_t significant_bit_count() const; /* most significant bit */ + + bool do_or_with_test(const NamedUnaryBitLattice &other); + bool do_and_with_test(const NamedUnaryBitLattice &other); + bool do_not_with_test(); + bool do_meet_with_test(const NamedUnaryBitLattice &other); + + static NamedUnaryBitLattice do_or(const NamedUnaryBitLattice &, + const NamedUnaryBitLattice &); + static NamedUnaryBitLattice do_and(const NamedUnaryBitLattice &, + const NamedUnaryBitLattice &); + static NamedUnaryBitLattice do_not(const NamedUnaryBitLattice &); + static NamedUnaryBitLattice do_meet(const NamedUnaryBitLattice &, + const NamedUnaryBitLattice &); + +}; +#endif + +#endif /* NAMED_NARY_H */ diff -Nur nci/suif/suif2b/extratypes/lattice_utils/nary.cpp nci-latest/suif/suif2b/extratypes/lattice_utils/nary.cpp --- nci/suif/suif2b/extratypes/lattice_utils/nary.cpp Sat Jun 3 09:36:51 2000 +++ nci-latest/suif/suif2b/extratypes/lattice_utils/nary.cpp Wed Feb 13 10:26:07 2002 @@ -1,2 +1,3 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #include "nary.h" diff -Nur nci/suif/suif2b/extratypes/lattice_utils/nary.h nci-latest/suif/suif2b/extratypes/lattice_utils/nary.h --- nci/suif/suif2b/extratypes/lattice_utils/nary.h Sat Jun 3 09:36:51 2000 +++ nci-latest/suif/suif2b/extratypes/lattice_utils/nary.h Wed Feb 13 10:26:07 2002 @@ -1,46 +1,62 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef NARY_H #define NARY_H #include "bit_vector/bit_vector.h" -#include "common/suif_vector.h" +// Rel class must have a +// significant_bit_count() const; +// Rel::Rel(_default_value) constructor +// Rel Rel::do_meet(Rel, Rel) +// bool Rel::operator==(Rel, Rel) +// template class NaryL { - suif_vector *_values; - Rel _default_value; - public: - NaryL(); /* default is top */ - NaryL(const NaryL &other); - NaryL(const Rel &default_value); - NaryL operator~() const; - static NaryL do_negate(const NaryL &val); - NaryL &operator =(const NaryL &other); - bool operator ==(const NaryL &other) const; - bool operator !=(const NaryL &other) const; - - Rel& operator[](size_t i); /* expand */ - Rel operator[](size_t i) const; - - Rel get_value(size_t i) const; - void set_value(size_t i, const Rel &val); - - bool is_empty() const; - size_t size() const; /* for this dimension */ - void set_default_value(const Rel &default_value); - Rel get_default_value() const; - size_t significant_bit_count() const; - bool do_meet_with_test(const NaryL &other); - static NaryL do_meet(const NaryL &val1, const NaryL &val2); + Rel *_values; + size_t _allocated; + size_t _size; + Rel _default_value; +public: + NaryL(); /* default is top */ + NaryL(const NaryL &other); + NaryL(const Rel &default_value); + NaryL operator~() const; + static NaryL do_negate(const NaryL &val); + NaryL &operator =(const NaryL &other); + bool operator ==(const NaryL &other) const; + bool operator !=(const NaryL &other) const; + + Rel& operator[](size_t i); /* expand */ + Rel operator[](size_t i) const; + + Rel get_value(size_t i) const; + void set_value(size_t i, const Rel &val); + + bool is_empty() const; + bool is_top() const; + bool is_bottom() const; + size_t size() const; /* for this dimension */ + void set_default_value(const Rel &default_value); + Rel get_default_value() const; + size_t significant_bit_count() const; + bool do_meet_with_test(const NaryL &other); + static NaryL do_meet(const NaryL &val1, const NaryL &val2); + NaryL new_top() const; + NaryL *new_top_ptr() const; + protected: - void expand_to(size_t); -}; + void expand_to(size_t); + void clear_values(); + void copy_other(const NaryL &other); -#include +}; template NaryL::NaryL() : - _values(new suif_vector), + _values(0), + _allocated(0), + _size(0), _default_value() {} @@ -48,18 +64,25 @@ /* default is top */ template NaryL::NaryL(const NaryL &other) : - _values(new suif_vector), - _default_value(other._default_value) + _values(NULL), + _allocated(0), + _size(0), + _default_value(other._default_value) { - for (suif_vector::iterator iter = other._values->begin(); - iter != other._values->end(); iter++) { - _values->push_back(*iter); - } + _allocated = other._allocated; + if (other._values) { + _values = new Rel[_allocated](_default_value); + } + for (_size = 0; _size < other._size; ++_size) { + _values[_size] = other._values[_size]; + } } template NaryL::NaryL(const Rel &default_value) : - _values(new suif_vector), + _values(NULL), + _allocated(0), + _size(0), _default_value(default_value) { } @@ -71,15 +94,32 @@ } template +void NaryL::clear_values() { + if (_values) + delete [] _values; + _values = NULL; + _allocated = 0; + _size = 0; +} + +template +void NaryL::copy_other(const NaryL &other) { + clear_values(); + _default_value = other._default_value; + if (other._values) { + _values = new Rel[other._allocated](_default_value); + } + _allocated = other._allocated; + for (_size = 0; _size < other._size; ++_size) { + _values[_size] = other._values[_size]; + } +} + + +template NaryL &NaryL::operator =(const NaryL &other) { - _values->clear(); - for (suif_vector::iterator iter = other._values->begin(); - iter != other._values->end(); iter++) { - _values->push_back(*iter); - } - - _default_value = other._default_value; - return(*this); + copy_other(other); + return(*this); } template @@ -89,42 +129,120 @@ template bool NaryL::operator ==(const NaryL &other) const { - if (_default_value != other._default_value) return false; - if (size() != other.size()) return false; - size_t m = size(); - for (size_t i = 0; i < m ; i++) { - if ((*_values)[i] != (*other._values)[i]) - return(false); + if (!(_default_value == other._default_value)) return false; + // if (size() != o + size_t s1 = size(); + size_t s2 = other.size(); + size_t max_s = s1; + if (s2 > s1) { + max_s = s2; + } + // if (size() != other.size()) return false; + // size_t m = size(); + + // size_t max_m = m; + // if (if + for (size_t i = 0; i < max_s ; i++) { + if (i >= s2) { + if (_values[i] != (_default_value)) + return(false); + continue; + } + + if (i >= s1) { + if (other._values[i] != (_default_value)) + return(false); + continue; + } + if (_values[i] != other._values[i]) + return(false); } return(true); } template bool NaryL::is_empty() const { - return(size() == 0); + // return(size() == 0); + return(_values == NULL); } template +bool NaryL::is_top() const { + if (!_default_value.is_top()) return(false); + return (size() == 0); + + // for (size_t i = 0 ; i < size(); i++) { + // if (!(*_values)[i].is_top()) return(false); + // } + // return(true); +} + +template +NaryL NaryL::new_top() const { + NaryL a(_default_value.new_top()); + return(a); +} + + +template +NaryL *NaryL::new_top_ptr() const { + return(new NaryL(_default_value.new_top())); +} + +template +bool NaryL::is_bottom() const { + if (!_default_value.is_bottom()) return(false); + return (size() == 0); + // for (size_t i = 0 ; i < size(); i++) { + // if (_values->get_value(i) == 0) return(false); + // } + // return(true); +} + + + +template size_t NaryL::size() const { - return(_values->size()); + return(_size); } template -void NaryL::expand_to(size_t i) { - while(i >= size()) - _values->push_back(_default_value); +void NaryL::expand_to(size_t x_size) { + if (x_size < _allocated) { + _size = x_size + 1; + return; + } + + // reallocate + size_t new_size = size(); + while (new_size <= x_size) { + if (new_size == 0) { + new_size = 4; // 4 is pretty arbitrary + } else { + new_size = new_size*2 + 1; + } + } + Rel *new_values = new Rel[new_size](_default_value); + for (size_t i = 0; i < _size; i++) { + new_values[i] = _values[i]; + } + if (_values) + delete [] _values; + _values = new_values; + _allocated = new_size; + _size = x_size + 1; } template Rel& NaryL::operator[](size_t i) { expand_to(i); - return((*_values)[i]); + return(_values[i]); } template Rel NaryL::operator[](size_t i) const { if ( i < size()) - return((*_values)[i]); + return(_values[i]); return(_default_value); } @@ -134,14 +252,14 @@ Rel NaryL::get_value(size_t i) const { if (i >= size()) return(_default_value); - return((*_values)[i]); + return(_values[i]); } template void NaryL::set_value(size_t i, const Rel &val) { if (i >= size() && val == _default_value ) return; expand_to(i); - (*_values)[i] = val; + _values[i] = val; } @@ -162,10 +280,9 @@ template size_t NaryL::significant_bit_count() const { size_t m = size(); - for (suif_vector::iterator it = _values->begin(); - it != _values->end(); it++) { - size_t n = (*it).significant_bit_count(); - if (n > m) m = n; + for (size_t i = 0; i < size(); i++) { + size_t n = _values[i].significant_bit_count(); + if (n > m) m = n; } return(m); } diff -Nur nci/suif/suif2b/extratypes/lattice_utils/nary_bit_lattice.cpp nci-latest/suif/suif2b/extratypes/lattice_utils/nary_bit_lattice.cpp --- nci/suif/suif2b/extratypes/lattice_utils/nary_bit_lattice.cpp Sat Jun 3 09:36:51 2000 +++ nci-latest/suif/suif2b/extratypes/lattice_utils/nary_bit_lattice.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #include "nary_bit_lattice.h" BinaryRelationBitLattice::BinaryRelationBitLattice() : diff -Nur nci/suif/suif2b/extratypes/lattice_utils/nary_bit_lattice.h nci-latest/suif/suif2b/extratypes/lattice_utils/nary_bit_lattice.h --- nci/suif/suif2b/extratypes/lattice_utils/nary_bit_lattice.h Sat Jun 3 09:36:51 2000 +++ nci-latest/suif/suif2b/extratypes/lattice_utils/nary_bit_lattice.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef NARY_BIT_LATTICE_H #define NARY_BIT_LATTICE_H diff -Nur nci/suif/suif2b/extratypes/lattice_utils/obj_index.h nci-latest/suif/suif2b/extratypes/lattice_utils/obj_index.h --- nci/suif/suif2b/extratypes/lattice_utils/obj_index.h Sat Jun 3 09:36:52 2000 +++ nci-latest/suif/suif2b/extratypes/lattice_utils/obj_index.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef OBJ_INDEX_H #define OBJ_INDEX_H diff -Nur nci/suif/suif2b/extratypes/lattice_utils/smash_lattice.cpp nci-latest/suif/suif2b/extratypes/lattice_utils/smash_lattice.cpp --- nci/suif/suif2b/extratypes/lattice_utils/smash_lattice.cpp Sat Jun 3 09:36:52 2000 +++ nci-latest/suif/suif2b/extratypes/lattice_utils/smash_lattice.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #include "smash_lattice.h" /* just to make sure that it can be parsed */ diff -Nur nci/suif/suif2b/extratypes/lattice_utils/smash_lattice.h nci-latest/suif/suif2b/extratypes/lattice_utils/smash_lattice.h --- nci/suif/suif2b/extratypes/lattice_utils/smash_lattice.h Fri Jun 9 02:28:51 2000 +++ nci-latest/suif/suif2b/extratypes/lattice_utils/smash_lattice.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef SMASH_LATTICE_H #define SMASH_LATTICE_H @@ -46,22 +47,25 @@ | BOTTOM */ +protected: + void update_key(void); + public: - SmashLattice(); // This is ALWAYS top. - SmashLattice(BVal); // This is only valid for TOP or BOTTOM SmashLattice(Lattice1 value1, Lattice2 value2); // This specifies others SmashLattice(const SmashLattice &other); SmashLattice &operator=(const SmashLattice &); ~SmashLattice(); - String toString() const; + String to_string() const; - static SmashLattice top(); - static SmashLattice bottom(); + // static SmashLattice top(); + // static SmashLattice bottom(); bool is_top() const; bool is_bottom() const; Lattice1 get_value1() const; Lattice2 get_value2() const; + void set_value1(const Lattice1 &val); + void set_value2(const Lattice2 &val); BVal get_key() const; bool operator==(const SmashLattice &) const; bool operator!=(const SmashLattice &) const; @@ -71,6 +75,11 @@ bool do_meet_with_test(const SmashLattice &); static SmashLattice do_widen(const SmashLattice &, const SmashLattice &); bool do_widen_with_test(const SmashLattice &); + SmashLattice *clone() const; + + SmashLattice new_top() const; + SmashLattice *new_top_ptr() const; + SmashLattice new_bottom() const; }; /* @@ -78,35 +87,12 @@ */ template -SmashLattice::SmashLattice() : - _key(B_TOP), - _value1(), - _value2() -{ -} - -template -SmashLattice::SmashLattice(BVal bval) : - _key(bval), - _value1(), - _value2() -{ - suif_assert(bval == B_BOTTOM - || bval == B_TOP); - if (bval == B_BOTTOM) - _value1 = Lattice1(Lattice1::B_BOTTOM); -} - -template SmashLattice::SmashLattice(Lattice1 value1, Lattice2 value2) : _key(B_MIDDLE), _value1(value1), _value2(value2) { - if (_value1.is_top() && _value2.is_top()) - _key = B_TOP; - if (_value1.is_bottom() && _value2.is_bottom()) - _key = B_BOTTOM; + update_key(); } template @@ -128,14 +114,6 @@ template SmashLattice::~SmashLattice() {} -template -String SmashLattice::toString() const { - if (is_top()) return ("TOP"); - if (is_bottom()) return ("BOTTOM"); - String s = String("{") + _value1.toString() + ", " + - _value2.toString() + "}"; - return(s); -} template bool SmashLattice::is_top() const { @@ -158,17 +136,31 @@ } template -SmashLattice::BVal SmashLattice::get_key() const { - return(_key); +void SmashLattice::set_value1(const Lattice1 &val) { + _value1 = val; + update_key(); } template -SmashLattice SmashLattice::bottom() { - return(SmashLattice(B_BOTTOM)); +void SmashLattice::update_key() { + if (_value1.is_top() && _value2.is_top()) { + _key = B_TOP; + } else if (_value1.is_bottom() && _value2.is_bottom()) { + _key = B_BOTTOM; + } else { + _key = B_MIDDLE; + } } + template -SmashLattice SmashLattice::top() { - return(SmashLattice(B_TOP)); +void SmashLattice::set_value2(const Lattice2 &val) { + _value2 = val; + update_key(); +} + +template +SmashLattice::BVal SmashLattice::get_key() const { + return(_key); } @@ -203,18 +195,78 @@ template bool SmashLattice::do_meet_with_test(const SmashLattice &other) { - SmashLattice result = do_meet(*this, other); - if (result == *this) return(false); - *this = result; - return(true); + bool changed = false; + if (_value1.do_meet_with_test(other._value1)) { + changed = true; + } + if (_value2.do_meet_with_test(other._value2)) { + changed = true; + } + if (changed) { + update_key(); + } + return(changed); } template bool SmashLattice::do_widen_with_test(const SmashLattice &other) { - SmashLattice result = do_widen(*this, other); - if (result == *this) return(false); - *this = result; - return(true); + bool changed = false; + if (_value1.do_widen_with_test(other._value1)) { + changed = true; + } + if (_value2.do_widen_with_test(other._value2)) { + changed = true; + } + if (changed) { + update_key(); + } + return(changed); +} + +template +SmashLattice *SmashLattice:: +clone() const { + return (new SmashLattice(*this)); +} + + +template +SmashLattice SmashLattice:: +new_top() const { + SmashLattice ret_v(this->_value1.new_top(), + this->_value2.new_top()); + return (ret_v); +} + +template +SmashLattice *SmashLattice:: +new_top_ptr() const { + return (new SmashLattice(this->_value1.new_top(), + this->_value2.new_top())); +} + +template +SmashLattice SmashLattice:: +new_bottom() const { + SmashLattice val(this->_value1.new_bottom(), + this->_value2.new_bottom()); + return(val); +} + +template +String SmashLattice:: +to_string() const { + String val("<"); + if (is_top()) + val += "Top"; + else if (is_bottom()) + val += "Bottom"; + else { + val += _value1.to_string() + ", "; + val += _value2.to_string(); + } + val += ">"; + return(val); } diff -Nur nci/suif/suif2b/extratypes/lattice_utils/standard_main.cpp nci-latest/suif/suif2b/extratypes/lattice_utils/standard_main.cpp --- nci/suif/suif2b/extratypes/lattice_utils/standard_main.cpp Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/lattice_utils/standard_main.cpp Wed Feb 13 10:26:07 2002 @@ -0,0 +1,31 @@ +// This file was automatically build by +// /sow/16/16/livshits/work/src/nci/build_main.pl '-lbit_vector -lsuifkernel -lcommon' +// from the $(LIBS} variable in the Makefile +// +#include "suifkernel/suifkernel_forwarders.h" +#include "suifkernel/suif_env.h" +#include "suifkernel/module_subsystem.h" +#include "suifkernel/token_stream.h" +#include "suifpasses/suifpasses.h" + + +int main( int argc, char* argv[] ) { + // initialize the environment + SuifEnv* suif = new SuifEnv; + suif->init(); + + // import and initialize the necessary libraries + suif->require_DLL("bit_vector"); + + // transform the input arguments into a stream of + // input tokens + TokenStream token_stream( argc, argv ); + + // execute the Module "execute" + ModuleSubSystem* mSubSystem = suif->get_module_subsystem(); + mSubSystem -> execute( "execute", &token_stream ); + + delete suif; + + return 0; +} diff -Nur nci/suif/suif2b/extratypes/lattice_utils/unary.cpp nci-latest/suif/suif2b/extratypes/lattice_utils/unary.cpp --- nci/suif/suif2b/extratypes/lattice_utils/unary.cpp Sat Jun 3 09:36:52 2000 +++ nci-latest/suif/suif2b/extratypes/lattice_utils/unary.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #include "unary.h" UnaryRelation::UnaryRelation() : diff -Nur nci/suif/suif2b/extratypes/lattice_utils/unary.h nci-latest/suif/suif2b/extratypes/lattice_utils/unary.h --- nci/suif/suif2b/extratypes/lattice_utils/unary.h Sat Jun 3 09:36:52 2000 +++ nci-latest/suif/suif2b/extratypes/lattice_utils/unary.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef LATTICE_UTILS_UNARY_H #define LATTICE_UTILS_UNARY_H diff -Nur nci/suif/suif2b/extratypes/oosplay/Makefile.deps nci-latest/suif/suif2b/extratypes/oosplay/Makefile.deps --- nci/suif/suif2b/extratypes/oosplay/Makefile.deps Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/oosplay/Makefile.deps Wed Feb 13 10:26:07 2002 @@ -0,0 +1,18 @@ +# Dependencies for C files + +# Dependencies for C files + +CPP_TO_O_RULE = defined +C_TO_O_RULE = defined + +%.o: %.cpp %.cxx %.cc + -echo Can not build $*.o from $< without explicit dependency + -echo The Makefile.deps file was incorrectly generated + -echo All .o dependencies should be explicit in that file + +$(OBJDIR)/$(TARGET_LIB)/oosplay.o: oosplay.cpp oosplay.h /sow/16/16/livshits/work/src/nci/include/iter_closure/iter_closure.h /usr/include/stdlib.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /usr/include/sys/types.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/time.h /usr/include/endian.h /usr/include/bits/endian.h /usr/include/sys/select.h /usr/include/bits/select.h /usr/include/bits/sigset.h /usr/include/bits/time.h /usr/include/sys/sysmacros.h /usr/include/alloca.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/oosplay.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) oosplay.cpp + diff -Nur nci/suif/suif2b/extratypes/oosplay/oosplay.cpp nci-latest/suif/suif2b/extratypes/oosplay/oosplay.cpp --- nci/suif/suif2b/extratypes/oosplay/oosplay.cpp Fri May 5 20:34:49 2000 +++ nci-latest/suif/suif2b/extratypes/oosplay/oosplay.cpp Wed Feb 13 10:26:07 2002 @@ -1,2 +1,3 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ // just to generate an object file here -#include "oosplay.h" \ No newline at end of file +#include "oosplay.h" diff -Nur nci/suif/suif2b/extratypes/oosplay/oosplay.h nci-latest/suif/suif2b/extratypes/oosplay/oosplay.h --- nci/suif/suif2b/extratypes/oosplay/oosplay.h Tue Apr 11 21:35:29 2000 +++ nci-latest/suif/suif2b/extratypes/oosplay/oosplay.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef OOSPLAY_H #define OOSPLAY_H @@ -8,7 +9,7 @@ class secondary_key/*: public gc*/ { public: secondary_key() {}; - virtual int equal_to(secondary_key *to) { return 1; } + virtual int equal_to(secondary_key *other) { return 1; } }; template @@ -17,8 +18,8 @@ sec_type k; public: nonempty_secondary_key(sec_type _k) { k = _k; } - virtual int equal_to(secondary_key *to) { - return k == ((nonempty_secondary_key*)to)->k; + virtual int equal_to(secondary_key *other) { + return k == ((nonempty_secondary_key*)other)->k; } sec_type get_key() { return k; } }; @@ -35,7 +36,7 @@ key1_t get_key1() { return key1; } virtual secondary_key *get_key2() { return NULL; } virtual oosplay_node *get_chain() { return NULL; } - virtual void set_chain(oosplay_node *to) { abort(); } + virtual void set_chain(oosplay_node *other) { abort(); } oosplay_node *copy() { oosplay_node *retval = new oosplay_node; retval->key1 = key1; @@ -61,13 +62,13 @@ } elt_t get_elt() { return elt; } elt_t *get_elt_addr() { return &elt; } - void set_elt(elt_t to) { elt = to; } + void set_elt(elt_t other) { elt = other; } oosplay_node_elt *left, *right; key1_t get_key1() { return key1; } virtual secondary_key *get_key2() { return NULL; } virtual oosplay_node_elt *get_chain() { return NULL; } - virtual void set_chain(oosplay_node_elt *to) { abort(); } + virtual void set_chain(oosplay_node_elt *other) { abort(); } oosplay_node_elt *copy() { oosplay_node_elt *retval = new oosplay_node_elt; @@ -101,8 +102,8 @@ oosplay_node_2key *left, *right; key1_t get_key1() { return key1; } virtual oosplay_node_2key *get_chain() { return chain; } - virtual void set_chain(oosplay_node_2key *to) { - chain = to; + virtual void set_chain(oosplay_node_2key *other) { + chain = other; } oosplay_node_2key *copy() { oosplay_node_2key *retval = @@ -134,14 +135,14 @@ return key2; } elt_t get_elt() { return elt; } - void set_elt(elt_t to) { elt = to; } + void set_elt(elt_t other) { elt = other; } oosplay_node_2key_elt *left, *right; key1_t get_key1() { return key1; } virtual oosplay_node_2key_elt *get_chain() { return chain; } - virtual void set_chain(oosplay_node_2key_elt *to) { - chain = to; + virtual void set_chain(oosplay_node_2key_elt *other){ + chain = thero; } oosplay_node_2key_elt *copy() { oosplay_node_2key_elt *retval = diff -Nur nci/suif/suif2b/extratypes/sgraph/Makefile nci-latest/suif/suif2b/extratypes/sgraph/Makefile --- nci/suif/suif2b/extratypes/sgraph/Makefile Mon Jun 12 23:53:47 2000 +++ nci-latest/suif/suif2b/extratypes/sgraph/Makefile Wed Feb 13 10:26:07 2002 @@ -11,7 +11,9 @@ HEADERS = sgraph.h sgraph_iter.h sgraph_forwarders.h \ sgraph_list.h sgraph_bit.h sgraph_bit_iter.h \ sgraph_iter_impl.h sgraph_bit_subgraph.h \ - ngraph.h ngraph_base.h + ngraph.h ngraph_base.h \ + sgraph_forest.h sgraph_node_map.h \ + sgraph_helper.h # implementations are sgraph_bit or sgraph_list @@ -21,7 +23,9 @@ sgraph_bit_subgraph.cpp \ sgraph_iter_impl.cpp \ standard_main.cpp \ - ngraph.cpp ngraph_base.cpp + ngraph.cpp ngraph_base.cpp \ + sgraph_forest.cpp \ + sgraph_helper.cpp OBJ_FILES = $(SRCS:.cpp=.o) diff -Nur nci/suif/suif2b/extratypes/sgraph/Makefile.deps nci-latest/suif/suif2b/extratypes/sgraph/Makefile.deps --- nci/suif/suif2b/extratypes/sgraph/Makefile.deps Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/sgraph/Makefile.deps Wed Feb 13 10:26:07 2002 @@ -0,0 +1,84 @@ +# Dependencies for C files + +# Dependencies for C files + +CPP_TO_O_RULE = defined +C_TO_O_RULE = defined + +%.o: %.cpp %.cxx %.cc + -echo Can not build $*.o from $< without explicit dependency + -echo The Makefile.deps file was incorrectly generated + -echo All .o dependencies should be explicit in that file + +$(OBJDIR)/$(TARGET_LIB)/ngraph_base.o: ngraph_base.cpp ngraph_base.h /u/livshits/work/src/nci/include/common/suif_copyright.h /u/livshits/work/src/nci/include/common/suif_hash_map.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /u/livshits/work/src/nci/include/common/suif_hash_fn.h /u/livshits/work/src/nci/include/common/common_forwarders.h /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/time.h /usr/include/endian.h /usr/include/bits/endian.h /usr/include/sys/select.h /usr/include/bits/select.h /usr/include/bits/sigset.h /usr/include/bits/time.h /usr/include/sys/sysmacros.h /usr/include/alloca.h /u/livshits/work/src/nci/include/common/suif_vector.h /usr/include/g++-3/cstddef /u/livshits/work/src/nci/include/suifkernel/suifkernel_messages.h /u/livshits/work/src/nci/include/suifkernel/suifkernel_forwarders.h /u/livshits/work/src/nci/include/iokernel/iokernel_forwarders.h /u/livshits/work/src/nci/include/common/MString.h /u/livshits/work/src/nci/include/common/lstring.h /u/livshits/work/src/nci/include/common/system_specific.h /u/livshits/work/src/nci/include/common/simple_stack.h /u/livshits/work/src/nci/include/iokernel/iokernel_messages.h ngraph.h sgraph.h sgraph_forwarders.h /u/livshits/work/src/nci/include/common/machine_dependent.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h /u/livshits/work/src/nci/include/ion/ion_forwarders.h /u/livshits/work/src/nci/include/common/suif_list.h /u/livshits/work/src/nci/include/bit_vector/bit_vector_forwarders.h sgraph_iter.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/ngraph_base.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) ngraph_base.cpp + +$(OBJDIR)/$(TARGET_LIB)/sgraph_list.o: sgraph_list.cpp sgraph_list.h /u/livshits/work/src/nci/include/common/suif_copyright.h sgraph.h sgraph_forwarders.h /u/livshits/work/src/nci/include/common/machine_dependent.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h /u/livshits/work/src/nci/include/common/common_forwarders.h /u/livshits/work/src/nci/include/ion/ion_forwarders.h /u/livshits/work/src/nci/include/common/suif_list.h /u/livshits/work/src/nci/include/bit_vector/bit_vector_forwarders.h sgraph_iter.h sgraph_bit_iter.h sgraph_bit.h /u/livshits/work/src/nci/include/common/suif_vector.h /usr/include/g++-3/cstddef /u/livshits/work/src/nci/include/bit_vector/bit_vector.h /u/livshits/work/src/nci/include/common/MString.h /u/livshits/work/src/nci/include/common/lstring.h /u/livshits/work/src/nci/include/common/system_specific.h /u/livshits/work/src/nci/include/common/simple_stack.h /u/livshits/work/src/nci/include/common/i_integer.h /usr/include/stdio.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stdarg.h /usr/include/bits/stdio_lim.h /u/livshits/work/src/nci/include/ion/ion.h /u/livshits/work/src/nci/include/suifkernel/suifkernel_messages.h /u/livshits/work/src/nci/include/suifkernel/suifkernel_forwarders.h /u/livshits/work/src/nci/include/iokernel/iokernel_forwarders.h /u/livshits/work/src/nci/include/iokernel/iokernel_messages.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/sgraph_list.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) sgraph_list.cpp + +$(OBJDIR)/$(TARGET_LIB)/standard_main.o: standard_main.cpp /u/livshits/work/src/nci/include/suifkernel/suifkernel_forwarders.h /u/livshits/work/src/nci/include/iokernel/iokernel_forwarders.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.h /u/livshits/work/src/nci/include/common/common_forwarders.h /u/livshits/work/src/nci/include/common/MString.h /u/livshits/work/src/nci/include/common/lstring.h /u/livshits/work/src/nci/include/common/system_specific.h /u/livshits/work/src/nci/include/common/simple_stack.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /u/livshits/work/src/nci/include/iokernel/iokernel_messages.h /u/livshits/work/src/nci/include/suifkernel/suifkernel_messages.h /u/livshits/work/src/nci/include/suifkernel/suif_env.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stdarg.h /u/livshits/work/src/nci/include/suifkernel/module_subsystem.h /u/livshits/work/src/nci/include/suifkernel/token_stream.h /u/livshits/work/src/nci/include/suifkernel/char_source.h /usr/include/g++-3/iostream.h /usr/include/g++-3/streambuf.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /u/livshits/work/src/nci/include/suifpasses/suifpasses.h /u/livshits/work/src/nci/include/suifpasses/standard_modules.h /u/livshits/work/src/nci/include/suifkernel/module.h /u/livshits/work/src/nci/include/suifpasses/passes.h /u/livshits/work/src/nci/include/suifpasses/drivers.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/standard_main.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) standard_main.cpp + +$(OBJDIR)/$(TARGET_LIB)/sgraph.o: sgraph.cpp sgraph.h /u/livshits/work/src/nci/include/common/suif_copyright.h sgraph_forwarders.h /u/livshits/work/src/nci/include/common/machine_dependent.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h /u/livshits/work/src/nci/include/common/common_forwarders.h /u/livshits/work/src/nci/include/ion/ion_forwarders.h /u/livshits/work/src/nci/include/common/suif_list.h /u/livshits/work/src/nci/include/bit_vector/bit_vector_forwarders.h sgraph_iter.h /usr/include/stdio.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stdarg.h /usr/include/bits/stdio_lim.h /u/livshits/work/src/nci/include/ion/ion.h /u/livshits/work/src/nci/include/bit_vector/bit_vector.h /u/livshits/work/src/nci/include/common/MString.h /u/livshits/work/src/nci/include/common/lstring.h /u/livshits/work/src/nci/include/common/system_specific.h /u/livshits/work/src/nci/include/common/simple_stack.h /u/livshits/work/src/nci/include/common/i_integer.h /u/livshits/work/src/nci/include/suifkernel/suif_env.h /u/livshits/work/src/nci/include/suifkernel/suifkernel_forwarders.h /u/livshits/work/src/nci/include/iokernel/iokernel_forwarders.h /u/livshits/work/src/nci/include/iokernel/iokernel_messages.h /u/livshits/work/src/nci/include/suifkernel/suifkernel_messages.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/sgraph.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) sgraph.cpp + +$(OBJDIR)/$(TARGET_LIB)/sgraph_bit_iter.o: sgraph_bit_iter.cpp sgraph_bit_iter.h sgraph_iter.h sgraph.h /u/livshits/work/src/nci/include/common/suif_copyright.h sgraph_forwarders.h /u/livshits/work/src/nci/include/common/machine_dependent.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h /u/livshits/work/src/nci/include/common/common_forwarders.h /u/livshits/work/src/nci/include/ion/ion_forwarders.h /u/livshits/work/src/nci/include/common/suif_list.h /u/livshits/work/src/nci/include/bit_vector/bit_vector_forwarders.h sgraph_bit.h /u/livshits/work/src/nci/include/bit_vector/bit_vector.h /u/livshits/work/src/nci/include/common/MString.h /u/livshits/work/src/nci/include/common/lstring.h /u/livshits/work/src/nci/include/common/system_specific.h /u/livshits/work/src/nci/include/common/simple_stack.h /u/livshits/work/src/nci/include/common/i_integer.h /usr/include/stdio.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stdarg.h /usr/include/bits/stdio_lim.h /u/livshits/work/src/nci/include/ion/ion.h /usr/include/string.h /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h /usr/include/endian.h /usr/include/bits/endian.h /usr/include/sys/select.h /usr/include/bits/select.h /usr/include/bits/sigset.h /usr/include/bits/time.h /usr/include/sys/sysmacros.h /usr/include/alloca.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/sgraph_bit_iter.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) sgraph_bit_iter.cpp + +$(OBJDIR)/$(TARGET_LIB)/sgraph_iter_impl.o: sgraph_iter_impl.cpp sgraph_iter_impl.h sgraph_iter.h sgraph.h /u/livshits/work/src/nci/include/common/suif_copyright.h sgraph_forwarders.h /u/livshits/work/src/nci/include/common/machine_dependent.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h /u/livshits/work/src/nci/include/common/common_forwarders.h /u/livshits/work/src/nci/include/ion/ion_forwarders.h /u/livshits/work/src/nci/include/common/suif_list.h /u/livshits/work/src/nci/include/bit_vector/bit_vector_forwarders.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/sgraph_iter_impl.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) sgraph_iter_impl.cpp + +$(OBJDIR)/$(TARGET_LIB)/sgraph_bit.o: sgraph_bit.cpp sgraph_bit.h /u/livshits/work/src/nci/include/common/suif_copyright.h sgraph.h sgraph_forwarders.h /u/livshits/work/src/nci/include/common/machine_dependent.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h /u/livshits/work/src/nci/include/common/common_forwarders.h /u/livshits/work/src/nci/include/ion/ion_forwarders.h /u/livshits/work/src/nci/include/common/suif_list.h /u/livshits/work/src/nci/include/bit_vector/bit_vector_forwarders.h sgraph_iter.h sgraph_bit_iter.h /u/livshits/work/src/nci/include/common/suif_vector.h /usr/include/g++-3/cstddef /u/livshits/work/src/nci/include/bit_vector/bit_vector.h /u/livshits/work/src/nci/include/common/MString.h /u/livshits/work/src/nci/include/common/lstring.h /u/livshits/work/src/nci/include/common/system_specific.h /u/livshits/work/src/nci/include/common/simple_stack.h /u/livshits/work/src/nci/include/common/i_integer.h /usr/include/stdio.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stdarg.h /usr/include/bits/stdio_lim.h /u/livshits/work/src/nci/include/ion/ion.h /u/livshits/work/src/nci/include/suifkernel/suifkernel_messages.h /u/livshits/work/src/nci/include/suifkernel/suifkernel_forwarders.h /u/livshits/work/src/nci/include/iokernel/iokernel_forwarders.h /u/livshits/work/src/nci/include/iokernel/iokernel_messages.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/sgraph_bit.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) sgraph_bit.cpp + +$(OBJDIR)/$(TARGET_LIB)/sgraph_helper.o: sgraph_helper.cpp sgraph_helper.h sgraph_forwarders.h /u/livshits/work/src/nci/include/common/machine_dependent.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h /u/livshits/work/src/nci/include/common/common_forwarders.h /u/livshits/work/src/nci/include/ion/ion_forwarders.h sgraph.h /u/livshits/work/src/nci/include/common/suif_copyright.h /u/livshits/work/src/nci/include/common/suif_list.h /u/livshits/work/src/nci/include/bit_vector/bit_vector_forwarders.h sgraph_iter.h /u/livshits/work/src/nci/include/common/suif_vector.h /usr/include/g++-3/cstddef /u/livshits/work/src/nci/include/ion/ion.h /usr/include/stdio.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stdarg.h /usr/include/bits/stdio_lim.h /u/livshits/work/src/nci/include/suifkernel/suifkernel_messages.h /u/livshits/work/src/nci/include/suifkernel/suifkernel_forwarders.h /u/livshits/work/src/nci/include/iokernel/iokernel_forwarders.h /u/livshits/work/src/nci/include/common/MString.h /u/livshits/work/src/nci/include/common/lstring.h /u/livshits/work/src/nci/include/common/system_specific.h /u/livshits/work/src/nci/include/common/simple_stack.h /u/livshits/work/src/nci/include/iokernel/iokernel_messages.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/sgraph_helper.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) sgraph_helper.cpp + +$(OBJDIR)/$(TARGET_LIB)/sgraph_iter.o: sgraph_iter.cpp sgraph_iter.h sgraph.h /u/livshits/work/src/nci/include/common/suif_copyright.h sgraph_forwarders.h /u/livshits/work/src/nci/include/common/machine_dependent.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h /u/livshits/work/src/nci/include/common/common_forwarders.h /u/livshits/work/src/nci/include/ion/ion_forwarders.h /u/livshits/work/src/nci/include/common/suif_list.h /u/livshits/work/src/nci/include/bit_vector/bit_vector_forwarders.h /u/livshits/work/src/nci/include/bit_vector/bit_vector.h /u/livshits/work/src/nci/include/common/MString.h /u/livshits/work/src/nci/include/common/lstring.h /u/livshits/work/src/nci/include/common/system_specific.h /u/livshits/work/src/nci/include/common/simple_stack.h /u/livshits/work/src/nci/include/common/i_integer.h /usr/include/stdio.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stdarg.h /usr/include/bits/stdio_lim.h /u/livshits/work/src/nci/include/ion/ion.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/sgraph_iter.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) sgraph_iter.cpp + +$(OBJDIR)/$(TARGET_LIB)/sgraph_forest.o: sgraph_forest.cpp sgraph_forest.h /u/livshits/work/src/nci/include/sgraph/sgraph_forwarders.h /u/livshits/work/src/nci/include/common/machine_dependent.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h /u/livshits/work/src/nci/include/common/common_forwarders.h /u/livshits/work/src/nci/include/bit_vector/bit_vector_forwarders.h /u/livshits/work/src/nci/include/ion/ion.h /usr/include/stdio.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stdarg.h /usr/include/bits/stdio_lim.h sgraph.h /u/livshits/work/src/nci/include/common/suif_copyright.h sgraph_forwarders.h /u/livshits/work/src/nci/include/ion/ion_forwarders.h /u/livshits/work/src/nci/include/common/suif_list.h sgraph_iter.h /u/livshits/work/src/nci/include/common/suif_vector.h /usr/include/g++-3/cstddef /u/livshits/work/src/nci/include/bit_vector/bit_vector.h /u/livshits/work/src/nci/include/common/MString.h /u/livshits/work/src/nci/include/common/lstring.h /u/livshits/work/src/nci/include/common/system_specific.h /u/livshits/work/src/nci/include/common/simple_stack.h /u/livshits/work/src/nci/include/common/i_integer.h /u/livshits/work/src/nci/include/suifkernel/suifkernel_messages.h /u/livshits/work/src/nci/include/suifkernel/suifkernel_forwarders.h /u/livshits/work/src/nci/include/iokernel/iokernel_forwarders.h /u/livshits/work/src/nci/include/iokernel/iokernel_messages.h sgraph_bit_iter.h sgraph_bit.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/sgraph_forest.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) sgraph_forest.cpp + +$(OBJDIR)/$(TARGET_LIB)/sgraph_bit_subgraph.o: sgraph_bit_subgraph.cpp sgraph_bit_subgraph.h /u/livshits/work/src/nci/include/common/suif_copyright.h sgraph.h sgraph_forwarders.h /u/livshits/work/src/nci/include/common/machine_dependent.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h /u/livshits/work/src/nci/include/common/common_forwarders.h /u/livshits/work/src/nci/include/ion/ion_forwarders.h /u/livshits/work/src/nci/include/common/suif_list.h /u/livshits/work/src/nci/include/bit_vector/bit_vector_forwarders.h sgraph_iter.h /u/livshits/work/src/nci/include/bit_vector/bit_vector.h /u/livshits/work/src/nci/include/common/MString.h /u/livshits/work/src/nci/include/common/lstring.h /u/livshits/work/src/nci/include/common/system_specific.h /u/livshits/work/src/nci/include/common/simple_stack.h /u/livshits/work/src/nci/include/common/i_integer.h /usr/include/stdio.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stdarg.h /usr/include/bits/stdio_lim.h /u/livshits/work/src/nci/include/ion/ion.h sgraph_bit_iter.h sgraph_bit.h sgraph_iter_impl.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/sgraph_bit_subgraph.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) sgraph_bit_subgraph.cpp + +$(OBJDIR)/$(TARGET_LIB)/ngraph.o: ngraph.cpp ngraph.h /u/livshits/work/src/nci/include/common/suif_copyright.h /u/livshits/work/src/nci/include/suifkernel/suifkernel_messages.h /u/livshits/work/src/nci/include/suifkernel/suifkernel_forwarders.h /u/livshits/work/src/nci/include/iokernel/iokernel_forwarders.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.h /u/livshits/work/src/nci/include/common/common_forwarders.h /u/livshits/work/src/nci/include/common/MString.h /u/livshits/work/src/nci/include/common/lstring.h /u/livshits/work/src/nci/include/common/system_specific.h /u/livshits/work/src/nci/include/common/simple_stack.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /u/livshits/work/src/nci/include/iokernel/iokernel_messages.h sgraph.h sgraph_forwarders.h /u/livshits/work/src/nci/include/common/machine_dependent.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/2.96/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h /u/livshits/work/src/nci/include/ion/ion_forwarders.h /u/livshits/work/src/nci/include/common/suif_list.h /u/livshits/work/src/nci/include/bit_vector/bit_vector_forwarders.h sgraph_iter.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/ngraph.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) ngraph.cpp + diff -Nur nci/suif/suif2b/extratypes/sgraph/ngraph.cpp nci-latest/suif/suif2b/extratypes/sgraph/ngraph.cpp --- nci/suif/suif2b/extratypes/sgraph/ngraph.cpp Wed Mar 29 00:27:02 2000 +++ nci-latest/suif/suif2b/extratypes/sgraph/ngraph.cpp Wed Feb 13 10:26:07 2002 @@ -1,5 +1,7 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #include "ngraph.h" +// what the hell is this?.. extern "C" void enter_NGraph(int *argc, char *argv[]) { } diff -Nur nci/suif/suif2b/extratypes/sgraph/ngraph.h nci-latest/suif/suif2b/extratypes/sgraph/ngraph.h --- nci/suif/suif2b/extratypes/sgraph/ngraph.h Wed Feb 13 10:27:00 2002 +++ nci-latest/suif/suif2b/extratypes/sgraph/ngraph.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ngraph.h */ /* Copyright (c) 1998 Stanford University @@ -12,7 +13,7 @@ #ifndef NGRAPH_H #define NGRAPH_H - + /* * NGraph - The 'noded' graph interface * @@ -40,7 +41,7 @@ T* _from; T* _to; public: - NEdge(T* from, T* to) : _from(from), _to(to) {} + NEdge(T* from_node, T* to_node) : _from(from_node), _to(to_node) {} T* to() const { return(_to); } T* from() const { return(_from); } NEdge reverse() const { return(NEdge(_to, _from)); } @@ -54,37 +55,65 @@ // This is a mixed ownership bag that allows // for a simple -template +template class NNodeIter { - SNodeIter _iter; + void clone_iter() { + _iter = _iter->clone(); + _owned = true; + } + + NGraphNNodeIter* _iter; bool _owned; - void clone_iter(); - const NGraph* _graph; public: - NNodeIter(); - ~NNodeIter(); - NNodeIter(NNodeIter*iter, const NGraph* graph); - NNodeIter(const SNodeIter &other); - NNodeIter&operator=(const NNodeIter &other); + /* + * NNodeIter + * The value class + */ + ~NNodeIter() { + if (_owned) delete _iter; + } - T* get() const; - bool done() const; - void increment(); - void reset(); + NNodeIter() : + _iter(0), + _owned(false) + {} - // the suif2 form - bool is_valid() const; - T* current() const; - void next(); - - // Helper - T* step(); - NNodeIter clone() const; + NNodeIter(NGraphNNodeIter *iter) : + _iter(iter), + _owned(true) + {} + + NNodeIter(const NNodeIter &x) : + _iter(x._iter), _owned(x._owned) { + const_cast&>(x)._owned = false; + } + + NNodeIter &operator=(const NNodeIter &x) { + if(_owned){ + delete _iter; + } + _iter = x._iter; + _owned = x._owned; + const_cast(x)._owned = false; + return *this; + } + + T* get() const { return(_iter->get()); } + bool done() const { return(_iter->done()); } + void increment() { if (!_owned)clone_iter(); _iter->increment(); } + + NNodeIter clone() const { + return NNodeIter(_iter->clone()); + } + + bool is_valid() const { return(!done()); } + T* current() const { return(get()); } + void next() { increment(); } }; // value class to pass around -template +template class NEdgeIter { SEdgeIter _iter; bool _owned; @@ -101,7 +130,6 @@ NEdge get() const; bool done() const; void increment(); - void reset(); // the suif2 form bool is_valid() const; @@ -113,7 +141,7 @@ NEdgeIter clone() const; }; -template +template class NGraph : public SGraph { public: // Nodes @@ -135,6 +163,7 @@ virtual void add_nedge(const NEdge& edge); virtual void remove_nedge(const NEdge& edge); virtual void print_nedge(ion *out, const NEdge& edge) const; + virtual bool has_parent(T* node) const = 0; // printing the graph. // There is a common implementation of this. @@ -146,7 +175,7 @@ virtual NGraphNNodeIter *get_nnode_predecessor_iterator(T *nnode) const; // Build a bit vector of the nodes - // virtual suif_bit_vector *new_nnode_set() const = 0; + // virtual bit_vector *new_nnode_set() const = 0; // Useful shortcuts (helpers). virtual void remove_nnode_successor_edges(T *nnode); @@ -164,26 +193,26 @@ virtual bool is_nedge_member(const NEdge& edge, bool do_forward) const { if (do_forward) return(is_nedge_member(edge)); - else return(is_nedge_member(edge.reverse())); + else return(is_nedge_member(edge.reverse())); } virtual void add_nedge(const NEdge& edge, bool do_forward) { if (do_forward) add_nedge(edge); - else add_nedge(edge.reverse()); + else add_nedge(edge.reverse()); } virtual void remove_nedge(const NEdge& edge, bool do_forward ) { if (do_forward) remove_nedge(edge); - else remove_nedge(edge.reverse()); + else remove_nedge(edge.reverse()); } virtual void print_nedge(ion *out, const NEdge& edge, bool do_forward) const { if (do_forward) print_nedge(out, edge); - else print_nedge(out, edge.reverse()); + else print_nedge(out, edge.reverse()); } // Again, implementations to make forward and reverse easier @@ -191,13 +220,13 @@ virtual NGraphNNodeIter *get_nnode_successor_iterator(T *nnode, bool do_forward) const { if (do_forward) return(get_nnode_successor_iterator(nnode)); - else return(get_nnode_predecessor_iterator(nnode)); + else return(get_nnode_predecessor_iterator(nnode)); } virtual NGraphNNodeIter *get_nnode_predecessor_iterator(T *nnode, bool do_forward) const { if (!do_forward) return(get_nnode_successor_iterator(nnode)); - else return(get_nnode_predecessor_iterator(nnode)); + else return(get_nnode_predecessor_iterator(nnode)); } // Implementations to make forward/reverse easier @@ -205,45 +234,60 @@ virtual void remove_nnode_successor_edges(T *nnode, bool do_forward) { if (do_forward) remove_nnode_successor_edges(nnode); - else remove_nnode_predecessor_edges(nnode); + else remove_nnode_predecessor_edges(nnode); } virtual void remove_nnode_predecessor_edges(T *nnode, bool do_forward) { if (!do_forward) remove_nnode_successor_edges(nnode); - else remove_nnode_predecessor_edges(nnode); + else remove_nnode_predecessor_edges(nnode); } virtual void add_all_nnode_successor_edges(T *nnode, bool do_forward) { if (do_forward) add_all_nnode_successor_edges(nnode); - else add_all_nnode_predecessor_edges(nnode); + else add_all_nnode_predecessor_edges(nnode); } virtual void add_all_nnode_predecessor_edges(T *nnode, bool do_forward) { if (!do_forward) add_all_nnode_successor_edges(nnode); - else add_all_nnode_predecessor_edges(nnode); + else add_all_nnode_predecessor_edges(nnode); } virtual bool nnode_has_successors(T *nnode, bool do_forward) const { if (do_forward) return(nnode_has_successors(nnode)); - else return(nnode_has_predecessors(nnode)); + else return(nnode_has_predecessors(nnode)); } virtual bool nnode_has_predecessors(T *nnode, bool do_forward) const { if (!do_forward) return(nnode_has_successors(nnode)); - else return(nnode_has_predecessors(nnode)); + else return(nnode_has_predecessors(nnode)); } -/* - virtual SNodeIter get_node_iterator() const; - virtual SNodeIter get_node_successor_iterator(SGraphNode node) const; - virtual SNodeIter get_node_predecessor_iterator(SGraphNode node) const; -*/ -}; + virtual void add_nnodes_from_ngraph(const NGraph* graph) { + NNodeIter iter(graph->get_nnode_iterator()); + while(iter.is_valid()){ + add_nnode(iter.current()); + iter.next(); + } + } + + virtual void build_reverse_ngraph(NGraph* reverse) const { + reverse->add_nnodes_from_ngraph(this); + + for (SEdgeIter iter(get_edge_iterator()); + iter.is_valid(); iter.next()) + { + SGraphEdge edge = iter.current(); + NEdge nedge(get_nnode_from_node(edge.to()), get_nnode_from_node(edge.from())); + + reverse->add_nedge(nedge); + } + } +}; /* * ****************************************** @@ -255,23 +299,27 @@ template class NGraphNNodeIter { public: /* No initialization should be specified here */ - // virtual NGraph *get_graph() const = 0; virtual ~NGraphNNodeIter(); + virtual NGraphNNodeIter* clone() = 0; virtual T *get() const = 0; virtual bool done() const = 0; virtual void increment() = 0; - // Helper T& step() { T *nnode = get(); increment(); return(nnode); } + // SUIF 2 iterators + bool is_valid() const { return(!done()); } + T* current() const { return(get()); } + void next() { increment(); } }; // An empty implementation -template class NGraph_empty_iter : public NGraphNNodeIter { +template class NGraphEmptyIter : public NGraphNNodeIter { public: - NGraph_empty_iter() {} - ~NGraph_empty_iter() {} + NGraphEmptyIter() {} + ~NGraphEmptyIter() {} + NGraphNNodeIter* clone() {return new NGraphEmptyIter();} bool done() const { return TRUE; } T get() const { assert(0); return(0); } void increment() { assert(0); } @@ -300,6 +348,10 @@ ~NGraphBaseIter() { reset(NULL, NULL, false); } + NGraphNNodeIter* clone(){ + return new NGraphBaseIter(_parent, _parent_iter.clone(), true); + } + void reset(const NGraph *parent, SNodeIter parent_iter, bool owned) { //if (_owned _parent_iter != NULL) delete _parent_iter; @@ -399,79 +451,120 @@ SGraph *get_subgraph() const { return _sub_graph; } public: NGraphSubgraph() { - _parent = NULL; _sub_graph = sub_graph; _owned = false; + _parent = NULL; _sub_graph = sub_graph; _owned = false; } - + NGraphSubgraph(const NGraphSubgraph &other) { _parent = NULL; _sub_graph = sub_graph; _owned = false; reset(other._parent, other._sub_graph, false); } - + NGraphSubgraph(NGraph *parent, SGraph *sub_graph, bool owned) { _parent = NULL; _sub_graph = NULL; _owned = false; - reset(parent, sub_graph, owned); + reset(parent, sub_graph, owned); } ~NGraphSubgraph() { reset(NULL, NULL, false); } void reset(NGraph *parent, SGraph *sub_graph, bool owned) { - if (_owned && _parent_iter != NULL) delete _sub_graph; + if (_owned && _parent != NULL) delete _sub_graph; _parent = parent; _sub_graph = sub_graph; _owned = owned; } - // Nodes - virtual bool is_nnode_member(const T& nnode) const { + virtual bool is_nnode_member(const T* nnode) const { if (!get_parent()->is_nnode_member(nnode)) return false; SGraphNode node = get_parent()->get_node_from_nnode(nnode); - return(get_sub_graph()->is_node_member(nnode)); + return get_subgraph()->is_node_member(node); + } + + virtual SGraphNode max_num_nodes() const { + // suif_assert(false); + return get_subgraph()->max_num_nodes(); + } + + // Nodes + virtual bool is_node_member(SGraphNode node) const { + // suif_assert(false); + return is_nnode_member(get_nnode_from_node(node)); + } + + virtual void add_node(SGraphNode node) { + suif_assert(false); + add_nnode(get_nnode_from_node(node)); + } + + virtual bool has_parent(T* node) const { + return _sub_graph->has_parent(get_node_from_nnode(node)); + } + virtual void remove_node(SGraphNode node){ + suif_assert(false); + remove_nnode(get_nnode_from_node(node)); } // Can only add nodes that are members of the parent. virtual SGraphNode add_nnode (T *nnode) { assert(get_parent()->is_nnode_member(nnode)); SGraphNode node = get_parent()->get_node_from_nnode(nnode); - return(get_sub_graph()->add_node(nnode)); + (get_subgraph()->add_node(node)); + return node; } virtual void remove_nnode(T *nnode) { if (!get_parent()->is_nnode_member(nnode)) { return; } SGraphNode node = get_parent()->get_node_from_nnode(nnode); - get_sub_graph()->remove_node(nnode); + get_subgraph()->remove_node(node); } virtual T *get_nnode_from_node(SGraphNode node) const { - return(get_parent()->get_nnode_by_node(nnode)); } + return(get_parent()->get_nnode_from_node(node)); } virtual SGraphNode get_node_from_nnode(T *nnode) const { - return(get_parent()->get_node_from_nnode(node)); } + return(get_parent()->get_node_from_nnode(nnode)); } // Printing. virtual void print_nnode(ion *out, T *nnode) const { - return(get_parent()->print_nnode(out, nnode)); } + (get_parent()->print_nnode(out, nnode)); } // Edges // // There is no edge representation here. // just iterators over sucessors and predecessors - virtual bool is_nedge_member(T *from_nnode, - T *to_nnode) const { + virtual bool is_edge_member(const SGraphEdge &edge) const { + suif_assert(false); + //is_nedge_member(get_parent()->get_nedge_from_edge(edge)); + return false; + } + virtual void add_edge(const SGraphEdge &edge){ + suif_assert(false); + //add_nedge(get_nedge_from_edge(edge)); + } + virtual void remove_edge(const SGraphEdge &edge) { + suif_assert(false); + //remove_edge(get_nedge_from_edge(edge)); + } + + virtual bool is_nedge_member(T *from_nnode, T *to_nnode) const { if (!is_nnode_member(from_nnode) || - !is_nnode_member(to_nnode)) return false; - return(get_parent()->is_nedge_member(from_nnode, to_nnode)); + !is_nnode_member(to_nnode)) return false; + return(get_parent()->is_nedge_member(NEdge(from_nnode, to_nnode))); } virtual void add_nedge(T *from_nnode, - T *to_nnode) { assert(false); + T *to_nnode) { assert(false); } virtual void remove_nedge(T *from_nnode, - T *to_nnode) { assert(false); + T *to_nnode) { assert(false); } virtual void print_nedge(ion *out, T *from_nnode, T *to_nnode) const { - get_parent()->print_nedge(out, from_nnode, to_nnode); + get_parent()->print_nedge(out, NEdge(from_nnode, to_nnode)); + } + + virtual void print_edge(class ion *, const SGraphEdge &edge) const { + suif_assert(false); } // printing the graph. @@ -596,17 +689,18 @@ // The user must STILL define new_node_iterator... template SNodeIter NGraphSubgraph::get_node_iterator() const { - return(get_sub_graph()->get_node_iterator()); + return(get_subgraph()->get_node_iterator()); } template SNodeIter NGraphSubgraph::get_node_successor_iterator(SGraphNode node) const { - return(get_sub_graph()->get_node_successor_iterator(node)); + return(get_subgraph()->get_node_successor_iterator(node)); } template SNodeIter NGraphSubgraph::get_node_predecessor_iterator(SGraphNode node) const { - return(get_sub_graph()->get_node_predecessor_iterator(node)); + return(get_subgraph()->get_node_predecessor_iterator(node)); } + #endif /* NGRAPH_H */ diff -Nur nci/suif/suif2b/extratypes/sgraph/ngraph_base.cpp nci-latest/suif/suif2b/extratypes/sgraph/ngraph_base.cpp --- nci/suif/suif2b/extratypes/sgraph/ngraph_base.cpp Wed Mar 29 00:27:03 2000 +++ nci-latest/suif/suif2b/extratypes/sgraph/ngraph_base.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef NGRAPH_BASE_CC #define NGRAPH_BASE_CC diff -Nur nci/suif/suif2b/extratypes/sgraph/ngraph_base.h nci-latest/suif/suif2b/extratypes/sgraph/ngraph_base.h --- nci/suif/suif2b/extratypes/sgraph/ngraph_base.h Wed Mar 29 00:27:03 2000 +++ nci-latest/suif/suif2b/extratypes/sgraph/ngraph_base.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ngraph.h */ /* Copyright (c) 1998 Stanford University @@ -31,8 +32,12 @@ template class NGraphBase : public NGraph { +public: + typedef suif_hash_map NodeMap; +private: SGraph *_the_sgraph; - suif_hash_map _map; + bool _owned; + NodeMap _map; suif_vector _array; SGraphNode _next_id; @@ -47,9 +52,15 @@ public: SGraph *get_sgraph() const { return(_the_sgraph); } - NGraphBase(SGraph *the_sgraph) { - _the_sgraph = the_sgraph; - _next_id = 0; + NGraphBase(SGraph *the_sgraph, bool owned = false) : + _the_sgraph(the_sgraph), + _owned(owned), + _next_id(0) + { + } + ~NGraphBase() { + if (_owned) + delete _the_sgraph; } virtual size_t max_num_nodes() const { @@ -62,7 +73,7 @@ } virtual SGraphNode get_node_from_nnode(T *nnode) const { - suif_hash_map::iterator iter = _map.find(nnode); + NodeMap::iterator iter = _map.find(nnode); suif_assert_message(iter!=_map.end(), ("There is a mismatch in the map")); return (*iter).second; @@ -79,6 +90,10 @@ get_sgraph()->add_node(node); } + virtual bool has_parent(T* node) const { + return get_sgraph()->has_parent(get_node_from_nnode(node)); + }; + virtual void remove_node(SGraphNode node) { get_sgraph()->remove_node(node); } @@ -107,7 +122,7 @@ // Nodes virtual bool is_nnode_member(T *nnode) const { suif_assert(nnode != NULL); - suif_hash_map::iterator + NodeMap::iterator iter = _map.find(nnode); if (iter==_map.end()) return false; SGraphNode node = (*iter).second; diff -Nur nci/suif/suif2b/extratypes/sgraph/sgraph.cpp nci-latest/suif/suif2b/extratypes/sgraph/sgraph.cpp --- nci/suif/suif2b/extratypes/sgraph/sgraph.cpp Wed Mar 29 00:27:03 2000 +++ nci-latest/suif/suif2b/extratypes/sgraph/sgraph.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #include "sgraph.h" #include #include "sgraph_iter.h" @@ -101,12 +102,17 @@ for (SNodeIter iter = get_node_iterator(); !iter.done(); iter.increment()) { print_node(out, iter.get()); - out->printf("\n"); + out->printf("-> ("); + bool first = true; for (SNodeIter successor_iter(get_node_successor_iterator(iter.get())); !successor_iter.done(); successor_iter.increment()) { - print_edge(out, SGraphEdge(iter.get(), successor_iter.get())); - out->printf("\n"); + if (first) + first = false; + else + out->printf(" "); + print_node(out, successor_iter.get()); } + out->printf(")\n"); } } @@ -124,6 +130,24 @@ out->printf("N%u",node); } +String SGraph::node_to_string(SGraphNode node) const { + string_ion sion; + print_node(&sion, node); + return(sion.show()); +} + +String SGraph::edge_to_string(const SGraphEdge &edge) const { + string_ion sion; + print_edge(&sion, edge); + return(sion.show()); +} + +String SGraph::to_string() const { + string_ion sion; + print(&sion); + return(sion.show()); +} + SEdgeIter SGraph::get_edge_iterator() const { return(new SGraphAllEdgeIter(this)); } @@ -152,6 +176,7 @@ while (!list.empty()) { SGraphNode to_node = list.front(); + list.pop_front(); remove_edge(SGraphEdge(node, to_node)); } } @@ -165,6 +190,7 @@ while (!list.empty()) { SGraphNode from_node = list.front(); + list.pop_front(); remove_edge(SGraphEdge(from_node, node)); } } @@ -364,6 +390,102 @@ if (!do_forward) return(node_has_successors(node)); else return(node_has_predecessors(node)); } +bool SGraph::validate() const +{ + ion *warn_ion = stdout_ion; + bool has_warnings = false; + // walk over each node + // walk over all successors and check that + // 1) all are in + // 2) this is a predecessor + // walk over all predecessors and check that + // 1) all are in the graph + // 2) this is a successor + + for (SNodeIter node_iter = this->get_node_iterator(); + node_iter.is_valid(); node_iter.next()) { + SGraphNode node = node_iter.current(); + + for (SNodeIter succ_iter = this->get_node_successor_iterator(node); + succ_iter.is_valid(); succ_iter.next()) { + SGraphNode succ_node = succ_iter.current(); + if (!this->is_node_member(succ_node)) { + warn_ion->printf("Invalid node %d found\n", + succ_node); + has_warnings = true; + } + + int found_times = 0; + + for (SNodeIter succ_pred_iter = + this->get_node_predecessor_iterator(succ_node); + succ_pred_iter.is_valid(); succ_pred_iter.next()) { + SGraphNode succ_pred_node = succ_pred_iter.current(); + if (!this->is_node_member(succ_pred_node)) { + warn_ion->printf("Invalid node %d found\n", + succ_pred_node); + has_warnings = true; + } + + if (succ_pred_node == node) { + found_times++; + } + } + if (found_times == 0) { + warn_ion->printf("Node %d is not a pred of successor %d\n", + node, succ_node); + has_warnings = true; + } + if (found_times > 1) { + warn_ion->printf("Node %d is multiple pred of successor %d\n", + node, succ_node); + has_warnings = true; + } + } + + + for (SNodeIter pred_iter = this->get_node_predecessor_iterator(node); + pred_iter.is_valid(); pred_iter.next()) { + SGraphNode pred_node = pred_iter.current(); + if (!this->is_node_member(pred_node)) { + warn_ion->printf("Invalid node %d found\n", + pred_node); + has_warnings = true; + } + + int found_times = 0; + + for (SNodeIter pred_succ_iter = + this->get_node_successor_iterator(pred_node); + pred_succ_iter.is_valid(); pred_succ_iter.next()) { + SGraphNode pred_succ_node = pred_succ_iter.current(); + if (!this->is_node_member(pred_succ_node)) { + warn_ion->printf("Invalid node %d found\n", + pred_succ_node); + has_warnings = true; + } + + if (pred_succ_node == node) { + found_times++; + } + } + if (found_times == 0) { + warn_ion->printf("Node %d is not a succ of predecessor %d\n", + node, pred_node); + has_warnings = true; + } + if (found_times > 1) { + warn_ion->printf("Node %d is multiple succ of predecessor %d\n", + node, pred_node); + has_warnings = true; + } + } + + + } + return(has_warnings); +} + bool is_sgraph_node_list_member(SGraphNodeList *l, SGraphNode n) { for (SGraphNodeList::iterator iter = l->begin(); @@ -384,7 +506,7 @@ extern "C" void init_sgraph(SuifEnv *s) { - s->require_module("bit_vector"); + s->require_DLL("bit_vector"); } // // SGraphFilteredNodeIter diff -Nur nci/suif/suif2b/extratypes/sgraph/sgraph.h nci-latest/suif/suif2b/extratypes/sgraph/sgraph.h --- nci/suif/suif2b/extratypes/sgraph/sgraph.h Wed Feb 13 10:27:00 2002 +++ nci-latest/suif/suif2b/extratypes/sgraph/sgraph.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* SGraph.h */ /* Copyright (c) 1998 Stanford University @@ -13,8 +14,8 @@ #define SGRAPH_H #include "sgraph_forwarders.h" -#include -#include +#include +//#include /* * SGraph - library. @@ -47,7 +48,8 @@ SGraphNode _from; SGraphNode _to; public: - SGraphEdge(SGraphNode from, SGraphNode to) : _from(from), _to(to) {} + SGraphEdge(SGraphNode from_node, SGraphNode to_node) + : _from(from_node), _to(to_node) {} SGraphNode to() const { return(_to); } SGraphNode from() const { return(_from); } SGraphEdge reverse() const { return(SGraphEdge(_to, _from)); } @@ -81,6 +83,8 @@ virtual void remove_node(SGraphNode node) = 0; // Printing. virtual void print_node(ion *out, SGraphNode node) const; + virtual String node_to_string(SGraphNode node) const; + // Edges @@ -92,12 +96,14 @@ virtual void add_edge(const SGraphEdge &edge) = 0; virtual void remove_edge(const SGraphEdge &edge) = 0; virtual void print_edge(ion *out, const SGraphEdge &edge) const; + virtual String edge_to_string(const SGraphEdge &edge) const; // printing the graph. // There is a common implementation of this. virtual void print(ion *out) const; virtual void print_debug() const; + virtual String to_string() const; // Iterators // These always create a new iterator so the caller @@ -184,7 +190,7 @@ virtual bool node_has_predecessors(SGraphNode node, bool do_forward) const; - + virtual bool validate() const; protected: // These should have no implementation SGraph &operator=(const SGraph &); diff -Nur nci/suif/suif2b/extratypes/sgraph/sgraph_bit.cpp nci-latest/suif/suif2b/extratypes/sgraph/sgraph_bit.cpp --- nci/suif/suif2b/extratypes/sgraph/sgraph_bit.cpp Wed Mar 29 00:27:03 2000 +++ nci-latest/suif/suif2b/extratypes/sgraph/sgraph_bit.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #include "sgraph_bit.h" #include "sgraph_bit_iter.h" @@ -27,6 +28,10 @@ _nodes(0), _edges(0) { (*this) = other; +} + +SGraphBit::~SGraphBit() { + clear(); } void SGraphBit::clear() { diff -Nur nci/suif/suif2b/extratypes/sgraph/sgraph_bit.h nci-latest/suif/suif2b/extratypes/sgraph/sgraph_bit.h --- nci/suif/suif2b/extratypes/sgraph/sgraph_bit.h Wed Mar 29 00:27:03 2000 +++ nci-latest/suif/suif2b/extratypes/sgraph/sgraph_bit.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* SGraphBit */ /* Copyright (c) 1998 Stanford University @@ -32,6 +33,7 @@ public: SGraphBit(); SGraphBit(const SGraphBit &); + ~SGraphBit(); SGraphBit& operator=(const SGraphBit &); void clear(); diff -Nur nci/suif/suif2b/extratypes/sgraph/sgraph_bit_iter.cpp nci-latest/suif/suif2b/extratypes/sgraph/sgraph_bit_iter.cpp --- nci/suif/suif2b/extratypes/sgraph/sgraph_bit_iter.cpp Mon Jun 12 09:19:52 2000 +++ nci-latest/suif/suif2b/extratypes/sgraph/sgraph_bit_iter.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #include "sgraph_bit_iter.h" #include "bit_vector/bit_vector.h" #include @@ -14,7 +15,9 @@ reset(bits, owned); } SGraphBitIter &SGraphBitIter::operator=(const SGraphBitIter &other) { - reset(other._bits, false); + if(this != &other) { + reset(other._bits, false); + } return(*this); } void SGraphBitIter::reset(const BitVector *bits, bool owned) { @@ -27,6 +30,13 @@ _bits = bits; _owned = owned; _iter = new BitVectorIter(_bits); +} + +SGraphBitIter::~SGraphBitIter(){ + delete _iter; + if (_owned && _bits != NULL) { + delete _bits; + } } SGraphNodeIter *SGraphBitIter::clone() const { diff -Nur nci/suif/suif2b/extratypes/sgraph/sgraph_bit_iter.cpp~ nci-latest/suif/suif2b/extratypes/sgraph/sgraph_bit_iter.cpp~ --- nci/suif/suif2b/extratypes/sgraph/sgraph_bit_iter.cpp~ Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/sgraph/sgraph_bit_iter.cpp~ Wed Feb 13 10:26:07 2002 @@ -0,0 +1,60 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +#include "sgraph_bit_iter.h" +#include "bit_vector/bit_vector.h" +#include +#include + +SGraphBitIter::SGraphBitIter() : + _bits(NULL), _owned(false), _iter(0) {} +SGraphBitIter::SGraphBitIter(const SGraphBitIter &other) : + _bits(NULL), _owned(false), _iter(0) { + reset(other._bits, false); + } +SGraphBitIter::SGraphBitIter(const BitVector *bits, bool owned) : + _bits(NULL), _owned(false), _iter(0) { + reset(bits, owned); +} +SGraphBitIter &SGraphBitIter::operator=(const SGraphBitIter &other) { + reset(other._bits, false); + return(*this); +} +void SGraphBitIter::reset(const BitVector *bits, bool owned) { + delete _iter; + + if (_owned && _bits != NULL) { + delete _bits; + } + + _bits = bits; + _owned = owned; + _iter = new BitVectorIter(_bits); +} + +SGraphBitIter::~SGraphBitIter(){ + delete _iter; + if (_owned && _bits != NULL) { + delete _bits; + } +} + +SGraphNodeIter *SGraphBitIter::clone() const { + if (_owned) return new SGraphBitIter(new BitVector(*_bits), true); + return(new SGraphBitIter(_bits, false)); +} + +void SGraphBitIter::reset() { + _iter->first(); +} + +bool SGraphBitIter::done() const { + if (!_iter) return(true); + return _iter->done(); +} +size_t SGraphBitIter::get() const { + assert(!done()); + return(_iter->get()); +} +void SGraphBitIter::increment() { + if (done()) return; + _iter->next(); +} diff -Nur nci/suif/suif2b/extratypes/sgraph/sgraph_bit_iter.h nci-latest/suif/suif2b/extratypes/sgraph/sgraph_bit_iter.h --- nci/suif/suif2b/extratypes/sgraph/sgraph_bit_iter.h Wed Mar 29 00:27:04 2000 +++ nci-latest/suif/suif2b/extratypes/sgraph/sgraph_bit_iter.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef SGRAPH_BIT_ITER_H #define SGRAPH_BIT_ITER_H @@ -22,6 +23,7 @@ SGraphBitIter(const SGraphBitIter &other); SGraphBitIter(const BitVector *bits, bool owned); SGraphBitIter &operator=(const SGraphBitIter &other); + ~SGraphBitIter(); void reset(const BitVector *bits, bool owned); virtual void reset(); diff -Nur nci/suif/suif2b/extratypes/sgraph/sgraph_bit_subgraph.cpp nci-latest/suif/suif2b/extratypes/sgraph/sgraph_bit_subgraph.cpp --- nci/suif/suif2b/extratypes/sgraph/sgraph_bit_subgraph.cpp Wed Mar 29 00:27:04 2000 +++ nci-latest/suif/suif2b/extratypes/sgraph/sgraph_bit_subgraph.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #include "sgraph_bit_subgraph.h" #include #include "sgraph_bit_iter.h" @@ -6,6 +7,10 @@ SGraphBitSubgraph::SGraphBitSubgraph(const SGraph *parent) : _parent(parent), _nodes(new BitVector) { } + +SGraphBitSubgraph::~SGraphBitSubgraph() { + delete _nodes; +} // Nodes // maximum node number +1 @@ -70,14 +75,13 @@ SNodeIter SGraphBitSubgraph:: get_node_predecessor_iterator(SGraphNode node) const { - // build a bit vector and then create the iterator - BitVector *bv = new BitVector(); + if (!_parent->node_has_predecessors(node)) return new SGraphEmptyIter; + SNodeIter iter(_parent->get_node_predecessor_iterator(node)); - unsigned num = max_num_nodes(); - for (unsigned i = 0; i < num; i++) { - if (is_edge_member(SGraphEdge(i, node))) { bv->set_bit(i, true); } - } - return(new SGraphBitIter(bv, true)); + SGraphNodeFilter *filter = new SGraphNodeGraphFilter(this); + + SNodeIter new_iter(new SGraphFilteredNodeIter(iter, filter, true)); + return(new_iter); } diff -Nur nci/suif/suif2b/extratypes/sgraph/sgraph_bit_subgraph.h nci-latest/suif/suif2b/extratypes/sgraph/sgraph_bit_subgraph.h --- nci/suif/suif2b/extratypes/sgraph/sgraph_bit_subgraph.h Wed Mar 29 00:27:04 2000 +++ nci-latest/suif/suif2b/extratypes/sgraph/sgraph_bit_subgraph.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* sgraph_bit_subgraph.h */ /* Copyright (c) 1998 Stanford University @@ -39,6 +40,7 @@ public: SGraphBitSubgraph(const SGraph *parent); + ~SGraphBitSubgraph(); // Nodes // maximum node number +1 diff -Nur nci/suif/suif2b/extratypes/sgraph/sgraph_forest.cpp nci-latest/suif/suif2b/extratypes/sgraph/sgraph_forest.cpp --- nci/suif/suif2b/extratypes/sgraph/sgraph_forest.cpp Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/sgraph/sgraph_forest.cpp Wed Feb 13 10:26:07 2002 @@ -0,0 +1,236 @@ +#include "sgraph_forest.h" +#include +#include +#include +#include "sgraph_iter.h" +#include "sgraph_bit_iter.h" + +SGraphForest::SGraphForest(void) : + _nodes(new suif_vector()), + _roots(NULL), + _members(new BitVector) + // default is ALL nodes are root nodes of this forest +{ + BitVector zero; + BitVector ones = ~zero; + _roots = new BitVector(ones); +} + +SGraphForest::~SGraphForest(void) { + delete _nodes; + delete _roots; + delete _members; +} + +SGraphForest::SGraphForest(const SGraphForest &other) : + _nodes(new suif_vector(*other._nodes)), + _roots(new BitVector(*other._roots)), + _members(new BitVector(*other._members)) +{ +} +SGraphForest &SGraphForest::operator=(const SGraphForest &other) { + (*_nodes) = (*other._nodes); + (*_roots) = (*other._roots); + (*_members) = (*other._members); + return(*this); +} + + +bool SGraphForest::is_root(SGraphNode node) const { + if (!is_node_member(node)) + return(true); + return (_roots->get_bit(node)); +} +bool SGraphForest::is_node_member(SGraphNode node) const { + return (_members->get_bit(node)); +} + +SGraphNode SGraphForest::get_parent(SGraphNode node) const { + suif_assert(!is_root(node)); + return((*_nodes)[node]); +} + +void SGraphForest::set_parent(SGraphNode child, SGraphNode parent) { + suif_assert_message(child != parent, + ("SGraphForest::set_parent parent can not be self")); + _members->set_bit(child, true); + _members->set_bit(parent, true); + + if (is_root(child)) { + _roots->set_bit(child, false); + } + while (_nodes->size() <= child) { + _nodes->push_back(0); + } + (*_nodes)[child] = parent; +} + +void SGraphForest::set_root(SGraphNode node) { + if (!is_root(node)) + _roots->set_bit(node, true); + _members->set_bit(node, true); +} + +/* +void SGraphForest::print(ion *out) const { + for (BitVectorIter iter(_members); iter.is_valid(); iter.next()) { + size_t i = iter.current(); + SGraphNode child = i; + if (is_root(child)) { + out->printf("N%d<- ()\n", child); + } else { + SGraphNode parent = get_parent(child); + out->printf("N%d<- (N%d)\n", child, parent); + } + } +} +*/ + + +SGraphLinkEval::SGraphLinkEval(void) : + _forest() +{ +} + +SGraphLinkEval::SGraphLinkEval(const SGraphForest &forest) : + _forest(forest) +{ +} + +SGraphLinkEval::SGraphLinkEval(const SGraphLinkEval &other) : + _forest(other._forest) +{ +} + +SGraphLinkEval &SGraphLinkEval::operator=(const SGraphLinkEval &other) +{ + _forest = other._forest; + return(*this); +} + +SGraphLinkEval::~SGraphLinkEval(void) {} + +// These just dispatch to the Forest. +bool SGraphLinkEval::is_root(SGraphNode node) const { + return(_forest.is_root(node)); +} + +SGraphNode SGraphLinkEval::get_parent(SGraphNode node) const { + return(_forest.get_parent(node)); +} +void SGraphLinkEval::set_parent(SGraphNode child, SGraphNode parent) { + _forest.set_parent(child, parent); +} +void SGraphLinkEval::set_root(SGraphNode node) { + _forest.set_root(node); +} + +SGraphNode SGraphLinkEval::link(SGraphNode node1, SGraphNode node2) { + SGraphNode node1_rep = eval(node1); + SGraphNode node2_rep = eval(node2); + // at this point, both node1_rep and node2_rep are roots are + suif_assert(is_root(node1_rep)); + suif_assert(is_root(node2_rep)); + + if (node1_rep == node2_rep) + return(node1_rep); + + if (node1_rep > node2_rep) { + SGraphNode tmp = node1_rep; + node1_rep = node2_rep; + node2_rep = tmp; + } + _forest.set_parent(node2_rep, node1_rep); + return(node1_rep); +} + // representative will always be the smallest SGraphNode +SGraphNode SGraphLinkEval::eval(SGraphNode node) { + if (is_root(node)) + return(node); + SGraphNode parent = get_parent(node); + parent = eval(parent); + set_parent(node, parent); + return(parent); +} + +SGraphNode SGraphForest::max_num_nodes() const { + return(_members->num_significant_bits()); +} +void SGraphForest::add_node(SGraphNode node) { + if (!_members->get_bit(node)) { + _members->set_bit(node, true); + _roots->set_bit(node, true); + } +} + +void SGraphForest::remove_node(SGraphNode node) { + if (!is_node_member(node)) + return; + + // remove all edges that include this. + size_t count = _nodes->size(); + for (size_t i = 0; i < count; ++i) { + if (!is_root(i)) { + SGraphNode targ = (*_nodes)[i]; + if (targ == node) { + // set it to root. The other thing + // to do would be to link it to the parent of the + // original node. + set_root(targ); + } + } + } + // remove it + _members->set_bit(node, false); + _roots->set_bit(node, false); +} + +bool SGraphForest::is_edge_member(const SGraphEdge &edge) const { + if (is_root(edge.from())) { + return(false); + } + SGraphNode parent = get_parent(edge.from()); + return(parent == edge.to()); +} + +void SGraphForest::add_edge(const SGraphEdge &edge) { + if (!is_root(edge.from())) { + SGraphNode parent = get_parent(edge.from()); + suif_assert_message(parent == edge.to(), + ("Attempt to add second incoming edge to a SGraphForest")); + return; + } + + // For the sgraph, this is normal + suif_assert(is_node_member(edge.from())); + suif_assert(is_node_member(edge.to())); + set_parent(edge.from(), edge.to()); +} +void SGraphForest::remove_edge(const SGraphEdge &edge) { + if (!is_edge_member(edge)) + return; + set_root(edge.from()); +} + +SNodeIter SGraphForest::get_node_iterator() const { + return new SGraphBitIter(_members, false); +} + + +SNodeIter SGraphForest::get_node_predecessor_iterator(SGraphNode node) const { + // Ugh. + // Build a list and then an iterator.. + BitVector *successor_set = new BitVector; + for (SNodeIter iter = get_node_iterator(); iter.is_valid(); iter.next()) { + SGraphNode targ = iter.current(); + if (is_edge_member(SGraphEdge(targ, node))) + successor_set->set_bit(targ, true); + } + return(new SGraphBitIter(successor_set, true)); +} + +SNodeIter SGraphForest::get_node_successor_iterator(SGraphNode node) const { + if (is_root(node)) + return(new SGraphEmptyIter()); + return(new SGraphSingleIter(get_parent(node))); +} diff -Nur nci/suif/suif2b/extratypes/sgraph/sgraph_forest.h nci-latest/suif/suif2b/extratypes/sgraph/sgraph_forest.h --- nci/suif/suif2b/extratypes/sgraph/sgraph_forest.h Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/sgraph/sgraph_forest.h Wed Feb 13 10:26:07 2002 @@ -0,0 +1,99 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +#include +#include +#include +#include +#include "sgraph.h" + +/** + * SGraphForest + * + * When used as an SGraph, the successor of a node is + * it's parent. The predecessors of a node + * are expensive to compute. If needed frequently + * copy the forest to an SGraphList + */ + + +class SGraphForest : public SGraph { + // Instead of encoding a root as a node whos parent + // is itself, we use a bit-vector instead to + // force users to think about roots in their algorithms. + suif_vector *_nodes; + BitVector *_roots; + + BitVector *_members; +public: + SGraphForest(void); + SGraphForest(const SGraphForest &other); + SGraphForest &operator=(const SGraphForest &other); + + ~SGraphForest(void); + // If the node is not a member, it is presumed to be + // a root. + bool is_root(SGraphNode) const; + SGraphNode get_parent(SGraphNode) const; + // When using set_parent and set_root, + // the nodes are automatically added to the graph. + void set_parent(SGraphNode child, SGraphNode parent); + void set_root(SGraphNode node); + + + + bool is_node_member(SGraphNode) const; + + // initialize from a graph + // This is allowed to FAIL. It will return true if + // it does. i.e. the graph is NOT a forest. + // Conversion from sgraph and to sgraph + // bool from_sgraph(const SGraph *graph); + // void to_sgraph(SGraph *graph) const; + // void print(ion *out) const; + + // virtual functions to implement the sgraph interface. + // Note that Successors will be costly!! + // If you expect to need successors, copy this into + // a list or bit implementation + virtual SGraphNode max_num_nodes() const; + void add_node(SGraphNode); + void remove_node(SGraphNode); + bool is_edge_member(const class SGraphEdge &) const; + // Adding an edge is dangerous with this type of + // graph. Only one incoming edge is allowed for + // each node + void add_edge(const class SGraphEdge &); + void remove_edge(const class SGraphEdge &); + class SNodeIter get_node_iterator() const; + class SNodeIter get_node_successor_iterator(SGraphNode) const; + class SNodeIter get_node_predecessor_iterator(SGraphNode) const; +}; + + + +// We will use this with DFS numbers +class SGraphLinkEval { + SGraphForest _forest; + +public: + SGraphLinkEval(void); + SGraphLinkEval(const SGraphForest &forest); + SGraphLinkEval(const SGraphLinkEval &other); + SGraphLinkEval &operator=(const SGraphLinkEval &other); + ~SGraphLinkEval(void); + + // These just dispatch to the Forest. + + SGraphNode link(SGraphNode node1, SGraphNode node2); + // representative will always be the smallest SGraphNode + SGraphNode eval(SGraphNode node); +protected: + + bool is_root(SGraphNode) const; + SGraphNode get_parent(SGraphNode) const; + void set_parent(SGraphNode child, SGraphNode parent); + void set_root(SGraphNode node); + +}; + + diff -Nur nci/suif/suif2b/extratypes/sgraph/sgraph_forwarders.h nci-latest/suif/suif2b/extratypes/sgraph/sgraph_forwarders.h --- nci/suif/suif2b/extratypes/sgraph/sgraph_forwarders.h Wed Feb 13 10:27:00 2002 +++ nci-latest/suif/suif2b/extratypes/sgraph/sgraph_forwarders.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef SGRAPH_FORWARDERS_H #define SGRAPH_FORWARDERS_H @@ -13,11 +14,17 @@ class SGraphEdge; - +class SNodeIter; class SGraphEmptyIter; class SGraphBitIter; class SGraphList; template class NGraphBase; template class NGraph; +template class NNodeIter; +template class NEdgeIter; + +class SGraphForest; +class SGraphLinkEval; +template class SGraphNodeMap; #endif diff -Nur nci/suif/suif2b/extratypes/sgraph/sgraph_helper.cpp nci-latest/suif/suif2b/extratypes/sgraph/sgraph_helper.cpp --- nci/suif/suif2b/extratypes/sgraph/sgraph_helper.cpp Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/sgraph/sgraph_helper.cpp Wed Feb 13 10:26:07 2002 @@ -0,0 +1,342 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +#include "sgraph_helper.h" +#include "sgraph.h" +#include +#include +#include +#include + +void SGraphHelper::node_print(SGraphNode node, + const SGraph *the_sgraph, ion *out, + const suif_vector *name_map) { + if (name_map && + name_map->size() > node) { + String s = (*name_map)[node]; + if (s != emptyString) { + out->printf("%s", s.c_str()); + return; + } + } + the_sgraph->print_node(out, node); +} + +void SGraphHelper::export_dot(const SGraph *the_sgraph, ion *out){ + suif_assert_message (the_sgraph != NULL, + ("export_dot: NULL graph")); + out->printf("digraph foo {\nsize = \"8,10\";\n"); + + SNodeIter iter(the_sgraph->get_node_iterator()); + // Print out nodes names and their labels + for (; !iter.done(); iter.increment()) { + SGraphNode node = iter.get(); + the_sgraph->print_node(out, node); + out->printf(" ["); + out->printf("shape=box, label=\""); + the_sgraph->print_node(out, node); + out->printf("\"];\n"); + } + + iter = the_sgraph->get_node_iterator(); + // Print out each connecting edge + for (; !iter.done(); iter.increment()) { + SGraphNode from_node = iter.get(); + for (SNodeIter iter2(the_sgraph->get_node_successor_iterator(from_node)); + !iter2.done(); iter2.increment()) { + SGraphNode to_node = iter2.get(); + the_sgraph->print_node(out, from_node); + out->printf(" -> "); + the_sgraph->print_node(out, to_node); + out->printf("\n"); + } + } + out->printf("}\n"); +} + +void SGraphHelper::export_named_dot(const SGraph *the_sgraph, ion *out, + const suif_vector* name_map, + String graph_name, + suif_list* additional_edges, + suif_list* additional_edge_names) +{ + out->printf("digraph foo {\nsize = \"8,10\";\n" + "label = \"%s\"; \n", graph_name.c_str()); + + SNodeIter iter(the_sgraph->get_node_iterator()); + // Print out nodes names and their labels + for (; !iter.done(); iter.increment()) { + SGraphNode node = iter.get(); + the_sgraph->print_node(out, node); + out->printf(" ["); + out->printf("shape=box, label=\""); + node_print(node, the_sgraph, out, name_map); + out->printf("\"];\n"); + } + + iter = the_sgraph->get_node_iterator(); + // Print out each connecting edge + for (; !iter.done(); iter.increment()) { + SGraphNode from_node = iter.get(); + for (SNodeIter iter2(the_sgraph->get_node_successor_iterator(from_node)); + !iter2.done(); iter2.increment()) { + SGraphNode to_node = iter2.get(); + the_sgraph->print_node(out, from_node); + out->printf(" -> "); + the_sgraph->print_node(out, to_node); + out->printf("[id=1];\n"); + //out->printf("%s", (*name_map)[to_node].c_str()); + } + } + + if(additional_edges && additional_edge_names){ + suif_list::iterator edge_iter = additional_edges->begin(); + suif_list::iterator name_iter = additional_edge_names->begin(); + + for(; edge_iter != additional_edges->end(); edge_iter++, name_iter++){ + SGraphNode from_node = (*edge_iter).from(); + SGraphNode to_node = (*edge_iter).to(); + String name = *name_iter; + + the_sgraph->print_node(out, from_node); + out->printf(" -> "); + the_sgraph->print_node(out, to_node); + out->printf("[style=dotted, label=\"%s\", id=2];\n", name.c_str()); + out->printf("\n"); + // different id's are used in case regular and additional edges coincide + } + } + out->printf("}\n"); +} + +void SGraphHelper::export_named_dot(const suif_list& graphs, + ion *out, + const suif_vector *node_name_map, + const suif_list& graph_names) +{ + int i = 0; + suif_list::iterator iter1 = graphs.begin(); + suif_list::iterator iter2 = graph_names.begin(); + //suif_assert(iter1.length() == iter2.length()); + + for(;iter1 != graphs.end(); iter1++) + { + const SGraph* graph = *iter1; + String graph_name = *iter2; + export_named_dot(graph, out, node_name_map, graph_name); + i++; + } +} + +void SGraphHelper::print_named(const SGraph *the_sgraph, ion *out, + const suif_vector *name_map) +{ + // out->printf("digraph foo {\nsize = \"8,10\";\n"); + out->printf("BEGIN GRAPH\n"); + // Print out nodes names and their labels + {for (SNodeIter iter(the_sgraph->get_node_iterator()); + !iter.done(); iter.increment()) { + SGraphNode node = iter.get(); + out->printf(" %d{", node); + node_print(node, the_sgraph, out, name_map); + out->printf("}\n"); + }} + + + // Print out each connecting edge + {for (SNodeIter iter = the_sgraph->get_node_iterator(); + !iter.done(); iter.increment()) { + SGraphNode from_node = iter.get(); + for (SNodeIter iter2(the_sgraph->get_node_successor_iterator(from_node)); + !iter2.done(); iter2.increment()) { + SGraphNode to_node = iter2.get(); + out->printf(" %d{", from_node); + node_print(from_node, the_sgraph, out, name_map); + out->printf("} "); + out->printf(" -> "); + out->printf(" %d{", to_node); + node_print(to_node, the_sgraph, out, name_map); + out->printf("} "); + out->printf("\n"); + } + }} + out->printf("END GRAPH\n"); +} + +bool SGraphHelper::is_same_graph(const SGraph *a, + const SGraph *b) { + {for (SEdgeIter sedge = a->get_edge_iterator(); sedge.is_valid(); + sedge.next()) { + SGraphEdge edge = sedge.current(); + if (!b->is_node_member(edge.from())) return(false); + if (!b->is_node_member(edge.to())) return(false); + if (!b->is_edge_member(edge)) return(false); + }} + {for (SEdgeIter sedge = b->get_edge_iterator(); sedge.is_valid(); + sedge.next()) { + SGraphEdge edge = sedge.current(); + if (!a->is_node_member(edge.from())) return(false); + if (!a->is_node_member(edge.to())) return(false); + if (!a->is_edge_member(edge)) return(false); + }} + return(true); +} + + +void SGraphHelper::print_graph_diff(ion *out, + const SGraph *a, + const SGraph *b) { + for (SEdgeIter sedge = a->get_edge_iterator(); sedge.is_valid(); + sedge.next()) { + SGraphEdge edge = sedge.current(); + + if (!b->is_node_member(edge.from())) { + String str = String("b missing node ") + + a->node_to_string(edge.from()) + "\n"; + out->put_s(str.c_str()); + continue; + } + if (!b->is_node_member(edge.to())) { + String str = String("b missing node ") + + a->node_to_string(edge.to()) + "\n"; + out->put_s(str.c_str()); + continue; + } + if (!b->is_edge_member(edge)) { + String str = String("b missing edge ") + + a->edge_to_string(edge) + "\n"; + out->put_s(str.c_str()); + continue; + } + } + {for (SEdgeIter sedge = b->get_edge_iterator(); sedge.is_valid(); + sedge.next()) { + SGraphEdge edge = sedge.current(); + if (!a->is_node_member(edge.from())) { + String str = String("a missing node ") + + b->node_to_string(edge.from()) + "\n"; + out->put_s(str.c_str()); + continue; + } + if (!a->is_node_member(edge.to())) { + String str = String("a missing node ") + + b->node_to_string(edge.to()) + "\n"; + out->put_s(str.c_str()); + continue; + } + if (!a->is_edge_member(edge)) { + String str = String("a missing edge ") + + b->edge_to_string(edge) + "\n"; + out->put_s(str.c_str()); + continue; + } + }} +} + +bool SGraphHelper::has_unique_successor(const SGraph *the_sgraph, + SGraphNode node) { + SNodeIter iter(the_sgraph->get_node_successor_iterator(node)); + if (!iter.is_valid()) + return(false); + iter.increment(); + if (iter.is_valid()) + return(false); + return(true); +} + +bool SGraphHelper::has_unique_predecessor(const SGraph *the_sgraph, + SGraphNode node) { + SNodeIter iter(the_sgraph->get_node_predecessor_iterator(node)); + if (!iter.is_valid()) + return(false); + iter.increment(); + if (iter.is_valid()) + return(false); + return(true); +} +SGraphNode SGraphHelper::get_unique_successor(const SGraph *the_sgraph, + SGraphNode node) { + SNodeIter iter(the_sgraph->get_node_successor_iterator(node)); + suif_assert(iter.is_valid()); + SGraphNode current = iter.current(); + iter.increment(); + suif_assert(!iter.is_valid()); + return(current); +} + +SGraphNode SGraphHelper::get_unique_predecessor(const SGraph *the_sgraph, + SGraphNode node) { + SNodeIter iter(the_sgraph->get_node_predecessor_iterator(node)); + suif_assert(iter.is_valid()); + SGraphNode current = iter.current(); + iter.increment(); + suif_assert(!iter.is_valid()); + return(current); +} + +void SGraphHelper::copy_graph(const SGraph *a, + SGraph *b) { + SGraphNodeList *l = b->new_node_list(); + for (SGraphNodeList::iterator iter = l->begin(); + iter != l->end(); ++iter) { + SGraphNode node = *iter; + b->remove_node(node); + } + delete l; + + {for (SNodeIter iter = a->get_node_iterator(); iter.is_valid(); + iter.next()) { + SGraphNode node = iter.current(); + b->add_node(node); + }} + + {for (SEdgeIter sedge = a->get_edge_iterator(); sedge.is_valid(); + sedge.next()) { + SGraphEdge edge = sedge.current(); + b->add_edge(edge); + }} +} + +void SGraphHelper::eliminate(SGraph *g, + SGraphNode nd) { + SGraphNodeList succ; + for (SNodeIter iter = g->get_node_successor_iterator(nd); + iter.is_valid(); iter.next()) { + succ.push_back(iter.current()); + } + SGraphNodeList pred; + {for (SNodeIter iter = g->get_node_predecessor_iterator(nd); + iter.is_valid(); iter.next()) { + pred.push_back(iter.current()); + }} + + g->remove_node(nd); + {for (SGraphNodeList::iterator it1 = succ.begin(); + it1 != succ.end(); ++it1) { + for (SGraphNodeList::iterator it2 = pred.begin(); + it2 != pred.end(); ++it2) { + g->add_edge(SGraphEdge(*it2, *it1)); + } + }} +} + +void SGraphHelper::reverse(SGraph *to, + const SGraph *from) { + { + // expect it to be empty + // suif_assert(to->empty()); + SNodeIter iter(to->get_node_iterator()); + suif_assert(!iter.is_valid()); + } + + + // add all of the nodes. + for (SNodeIter iter(from->get_node_iterator()); + iter.is_valid(); iter.next()) { + SGraphNode node = iter.current(); + to->add_node(node); + } + {for (SEdgeIter sedge = from->get_edge_iterator(); sedge.is_valid(); + sedge.next()) { + SGraphEdge edge = sedge.current(); + to->add_edge(SGraphEdge(edge.to(), edge.from())); + }} +} diff -Nur nci/suif/suif2b/extratypes/sgraph/sgraph_helper.h nci-latest/suif/suif2b/extratypes/sgraph/sgraph_helper.h --- nci/suif/suif2b/extratypes/sgraph/sgraph_helper.h Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/sgraph/sgraph_helper.h Wed Feb 13 10:26:07 2002 @@ -0,0 +1,60 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* SGraphHelper.h */ +#ifndef SGRAPH__SGRAPH_HELPER +#define SGRAPH__SGRAPH_HELPER + +#include "sgraph_forwarders.h" +#include "ion/ion_forwarders.h" +#include "common/common_forwarders.h" + +class SGraphHelper { +public: + static void node_print(SGraphNode node, + const SGraph *the_sgraph, + ion *out, + const suif_vector *name_map); + + static bool is_same_graph(const SGraph *graph1, + const SGraph *graph2); + static void print_graph_diff(ion *out, + const SGraph *graph1, + const SGraph *graph2); + + static void export_dot(const SGraph *the_sgraph, ion *out); + + static void export_named_dot(const SGraph *the_sgraph, ion *out, + const suif_vector *node_name_map, + String graph_name, + // these additional edges will be displayed as dotted + suif_list* additional_edges = NULL, + suif_list* additional_edge_names = NULL); + + static void export_named_dot(const suif_list& graphs, ion *out, + const suif_vector *node_name_map, + const suif_list& graph_names); + + static void print_named(const SGraph *the_sgraph, ion *out, + const suif_vector *node_name_map); + + static bool has_unique_successor(const SGraph *the_sgraph, + SGraphNode node); + static bool has_unique_predecessor(const SGraph *the_sgraph, + SGraphNode node); + // Must have unique successor or FAIL + static SGraphNode get_unique_successor(const SGraph *the_sgraph, + SGraphNode node); + static SGraphNode get_unique_predecessor(const SGraph *the_sgraph, + SGraphNode node); + static void copy_graph(const SGraph *the_sgraph, + SGraph *graph); + static void eliminate(SGraph *g, + SGraphNode nd); + + static void reverse(SGraph *to, const SGraph *from); + +}; + + + + +#endif /* SGRAPH__SGRAPH_HELPER */ diff -Nur nci/suif/suif2b/extratypes/sgraph/sgraph_iter.cpp nci-latest/suif/suif2b/extratypes/sgraph/sgraph_iter.cpp --- nci/suif/suif2b/extratypes/sgraph/sgraph_iter.cpp Thu Jun 8 02:27:11 2000 +++ nci-latest/suif/suif2b/extratypes/sgraph/sgraph_iter.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #include "sgraph_iter.h" #include "bit_vector/bit_vector.h" @@ -44,14 +45,19 @@ } SNodeIter &SNodeIter::operator=(const SNodeIter &x) { - _iter = x._iter; - _owned = x._owned; - const_cast(x)._owned = false; + if(this != &x) { + if(_owned){ + delete _iter; + } + _iter = x._iter; + _owned = x._owned; + const_cast(x)._owned = false; + } return *this; } SGraphNode SNodeIter::get() const { return(_iter->get()); } -bool SNodeIter::done() const { return(_iter->done()); } +bool SNodeIter::done() const { return(_iter && _iter->done()); } void SNodeIter::increment() { if (!_owned)clone_iter(); _iter->increment(); } void SNodeIter::reset() { if (!_owned)clone_iter(); _iter->reset(); } SNodeIter SNodeIter::clone() const { return(_iter->clone()); } @@ -95,9 +101,14 @@ } SEdgeIter &SEdgeIter::operator=(const SEdgeIter &x) { - _iter = x._iter; - _owned = x._owned; - const_cast(x)._owned = false; + if(this != &x) { + if(_owned){ + delete _iter; + } + _iter = x._iter; + _owned = x._owned; + const_cast(x)._owned = false; + } return *this; } @@ -116,3 +127,23 @@ bool SEdgeIter::is_valid() const { return(!done()); } SGraphEdge SEdgeIter::current() const { return(get()); } void SEdgeIter::next() { increment(); } + +SGraphSingleIter::SGraphSingleIter(SGraphNode node) : + _node(node), + _done(false) +{} +bool SGraphSingleIter::done() const { + return _done; +} +SGraphNode SGraphSingleIter::get() const { + assert(!done()); return(_node); +} +void SGraphSingleIter::increment() { + assert(!done()); _done = true; +} +void SGraphSingleIter::reset() { + _done = false; +} +SGraphNodeIter *SGraphSingleIter::clone() const { + return new SGraphSingleIter(_node); +} diff -Nur nci/suif/suif2b/extratypes/sgraph/sgraph_iter.cpp~ nci-latest/suif/suif2b/extratypes/sgraph/sgraph_iter.cpp~ --- nci/suif/suif2b/extratypes/sgraph/sgraph_iter.cpp~ Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/sgraph/sgraph_iter.cpp~ Wed Feb 13 10:26:07 2002 @@ -0,0 +1,145 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +#include "sgraph_iter.h" +#include "bit_vector/bit_vector.h" + + +/* + * SGraphNodeIter + * The value class + */ + +bool SGraphNodeIter::is_valid() const { return(!done()); } +SGraphNode SGraphNodeIter::current() const { return(get()); } +void SGraphNodeIter::next() { increment(); } + +bool SGraphEdgeIter::is_valid() const { return(!done()); } +SGraphEdge SGraphEdgeIter::current() const { return(get()); } +void SGraphEdgeIter::next() { increment(); } + + +/* + * SNodeIter + * The value class + */ +void SNodeIter::clone_iter() { + _iter = _iter->clone(); + _owned = true; +} +SNodeIter::~SNodeIter() { + if (_owned) delete _iter; +} + +SNodeIter::SNodeIter() : + _iter(0), + _owned(false) +{} + +SNodeIter::SNodeIter(SGraphNodeIter *iter) : + _iter(iter), + _owned(true) +{} + +SNodeIter::SNodeIter(const SNodeIter &x) : + _iter(x._iter), _owned(x._owned) { + const_cast(x)._owned = false; +} + +SNodeIter &SNodeIter::operator=(const SNodeIter &x) { + if(_owned){ + delete _iter; + } + _iter = x._iter; + _owned = x._owned; + const_cast(x)._owned = false; + return *this; +} + +SGraphNode SNodeIter::get() const { return(_iter->get()); } +bool SNodeIter::done() const { return(_iter && _iter->done()); } +void SNodeIter::increment() { if (!_owned)clone_iter(); _iter->increment(); } +void SNodeIter::reset() { if (!_owned)clone_iter(); _iter->reset(); } +SNodeIter SNodeIter::clone() const { return(_iter->clone()); } + +bool SNodeIter::is_valid() const { return(!done()); } +SGraphNode SNodeIter::current() const { return(get()); } +void SNodeIter::next() { increment(); } + + +// Helper +/* +SGraphNode SNodeIter::step() { if(!_owned)clone_iter(); return(_iter->step()); } +*/ + +/* + * SEdgeIter + * The value class + */ +void SEdgeIter::clone_iter() { + _iter = _iter->clone(); + _owned = true; +} + +SEdgeIter::~SEdgeIter() { + if (_owned) delete _iter; +} + +SEdgeIter::SEdgeIter() : + _iter(0), + _owned(false) +{} + +SEdgeIter::SEdgeIter(SGraphEdgeIter *iter) : + _iter(iter), + _owned(true) +{} + +SEdgeIter::SEdgeIter(const SEdgeIter &x) : + _iter(x._iter), _owned(x._owned) { + const_cast(x)._owned = false; +} + +SEdgeIter &SEdgeIter::operator=(const SEdgeIter &x) { + if(_owned){ + delete _iter; + } + _iter = x._iter; + _owned = x._owned; + const_cast(x)._owned = false; + return *this; +} + +SGraphEdge SEdgeIter::get() const { return(_iter->get()); } +bool SEdgeIter::done() const { return(_iter->done()); } +void SEdgeIter::increment() { if (!_owned)clone_iter(); _iter->increment(); } +void SEdgeIter::reset() { if (!_owned)clone_iter(); _iter->reset(); } + +// Helper +/* +SGraphEdge SEdgeIter::step() { + if(!_owned)clone_iter(); return(_iter->step()); +} +*/ + +bool SEdgeIter::is_valid() const { return(!done()); } +SGraphEdge SEdgeIter::current() const { return(get()); } +void SEdgeIter::next() { increment(); } + +SGraphSingleIter::SGraphSingleIter(SGraphNode node) : + _node(node), + _done(false) +{} +bool SGraphSingleIter::done() const { + return _done; +} +SGraphNode SGraphSingleIter::get() const { + assert(!done()); return(_node); +} +void SGraphSingleIter::increment() { + assert(!done()); _done = true; +} +void SGraphSingleIter::reset() { + _done = false; +} +SGraphNodeIter *SGraphSingleIter::clone() const { + return new SGraphSingleIter(_node); +} diff -Nur nci/suif/suif2b/extratypes/sgraph/sgraph_iter.h nci-latest/suif/suif2b/extratypes/sgraph/sgraph_iter.h --- nci/suif/suif2b/extratypes/sgraph/sgraph_iter.h Wed Mar 29 00:27:04 2000 +++ nci-latest/suif/suif2b/extratypes/sgraph/sgraph_iter.h Wed Feb 13 10:26:07 2002 @@ -1,9 +1,9 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #include "sgraph.h" #ifndef SGRAPH_ITER_H #define SGRAPH_ITER_H - /* * ****************************************** * * @@ -150,6 +150,22 @@ virtual void increment() { assert(0); } virtual void reset() {} virtual SGraphNodeIter *clone() const { return new SGraphEmptyIter(); } +}; + +/* + * implementation of an empty iterator + */ +// A single-node iterator +class SGraphSingleIter : public SGraphNodeIter { + SGraphNode _node; + bool _done; +public: + SGraphSingleIter(SGraphNode node); + virtual bool done() const; + virtual SGraphNode get() const; + virtual void increment(); + virtual void reset(); + virtual SGraphNodeIter *clone() const; }; diff -Nur nci/suif/suif2b/extratypes/sgraph/sgraph_iter_impl.cpp nci-latest/suif/suif2b/extratypes/sgraph/sgraph_iter_impl.cpp --- nci/suif/suif2b/extratypes/sgraph/sgraph_iter_impl.cpp Wed Mar 29 00:27:04 2000 +++ nci-latest/suif/suif2b/extratypes/sgraph/sgraph_iter_impl.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #include "sgraph_iter_impl.h" @@ -20,7 +21,8 @@ reset(other._list, false); } SGraphEdgeListIter &SGraphEdgeListIter::operator=(const SGraphEdgeListIter &other) { - reset(other._list, false); + if(this != &other) + reset(other._list, false); return(*this); } SGraphEdgeListIter::SGraphEdgeListIter(SGraphEdgeList *lst, bool owned) : @@ -33,7 +35,7 @@ } void SGraphEdgeListIter::reset(SGraphEdgeList *lst, bool owned) { - if (_owned && _list != NULL) delete lst; + if (_owned && _list != NULL) delete _list; _list = lst; _owned = owned; reset(); @@ -62,7 +64,8 @@ reset(other._list, false); } SGraphNodeListIter &SGraphNodeListIter::operator=(const SGraphNodeListIter &other) { - reset(other._list, false); + if(this != &other) + reset(other._list, false); return(*this); } SGraphNodeListIter::SGraphNodeListIter(SGraphNodeList *lst, bool owned) : @@ -75,7 +78,7 @@ } void SGraphNodeListIter::reset(SGraphNodeList *lst, bool owned) { - if (_owned && _list != NULL) delete lst; + if (_owned && _list != NULL) delete _list; _list = lst; _owned = owned; reset(); @@ -106,7 +109,8 @@ reset(base_iter, filter, owned); } SGraphFilteredNodeIter &SGraphFilteredNodeIter::operator=(const SGraphFilteredNodeIter &other) { - reset(other._base_iter, other._filter, false); + if(this != &other) + reset(other._base_iter, other._filter, false); return(*this); } @@ -117,9 +121,10 @@ void SGraphFilteredNodeIter::reset(SNodeIter base_iter, SGraphNodeFilter *filter, bool owned) { - if (_owned && _filter != NULL) delete filter; + if (_owned) delete _filter; _filter = filter; _base_iter = base_iter; + _owned = owned; // added by djp1 _done = false; _last = 0; for(;!_base_iter.done(); _base_iter.increment()) { @@ -154,4 +159,9 @@ } } _done = true; +} + +SGraphFilteredNodeIter::~SGraphFilteredNodeIter(){ + if(_owned) + delete _filter; } diff -Nur nci/suif/suif2b/extratypes/sgraph/sgraph_iter_impl.cpp~ nci-latest/suif/suif2b/extratypes/sgraph/sgraph_iter_impl.cpp~ --- nci/suif/suif2b/extratypes/sgraph/sgraph_iter_impl.cpp~ Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/sgraph/sgraph_iter_impl.cpp~ Wed Feb 13 10:26:07 2002 @@ -0,0 +1,162 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +#include "sgraph_iter_impl.h" + + +/* + * now some implementations + */ + + + +// +// An edge list iterator that potntially owns a tos of edges. +// + + +SGraphEdgeListIter::SGraphEdgeListIter() : + _list(NULL), _owned(false), + _iter() {} +SGraphEdgeListIter::SGraphEdgeListIter(const SGraphEdgeListIter &other) : + _list(NULL), _owned(false), _iter() { + reset(other._list, false); +} +SGraphEdgeListIter &SGraphEdgeListIter::operator=(const SGraphEdgeListIter &other) { + reset(other._list, false); + return(*this); +} +SGraphEdgeListIter::SGraphEdgeListIter(SGraphEdgeList *lst, bool owned) : + _list(NULL), _owned(false), _iter(){ + reset(lst, owned); +} + +SGraphEdgeIter *SGraphEdgeListIter::clone() const { + return(new SGraphEdgeListIter(_list, false)); +} + +void SGraphEdgeListIter::reset(SGraphEdgeList *lst, bool owned) { + if (_owned && _list != NULL) delete _list; + _list = lst; + _owned = owned; + reset(); +} +void SGraphEdgeListIter::reset() { + _iter = _list->begin(); +} +bool SGraphEdgeListIter::done() const { return (_iter == _list->end()); } +SGraphEdge SGraphEdgeListIter::get() const { return *_iter; } +void SGraphEdgeListIter::increment() { _iter++; } +SGraphEdge SGraphEdgeListIter::step() { + SGraphEdge node = get(); increment(); return(node); } + + + +// +// An node list iterator that potentially owns the list +// + + +SGraphNodeListIter::SGraphNodeListIter() : + _list(NULL), _owned(false), + _iter() {} +SGraphNodeListIter::SGraphNodeListIter(const SGraphNodeListIter &other) : + _list(NULL), _owned(false), _iter() { + reset(other._list, false); +} +SGraphNodeListIter &SGraphNodeListIter::operator=(const SGraphNodeListIter &other) { + reset(other._list, false); + return(*this); +} +SGraphNodeListIter::SGraphNodeListIter(SGraphNodeList *lst, bool owned) : + _list(NULL), _owned(false), _iter(){ + reset(lst, owned); +} + +SGraphNodeIter *SGraphNodeListIter::clone() const { + return(new SGraphNodeListIter(_list, false)); +} + +void SGraphNodeListIter::reset(SGraphNodeList *lst, bool owned) { + if (_owned && _list != NULL) delete _list; + _list = lst; + _owned = owned; + reset(); +} +void SGraphNodeListIter::reset() { + _iter = _list->begin(); +} +bool SGraphNodeListIter::done() const { return (_iter == _list->end()); } +SGraphNode SGraphNodeListIter::get() const { return *_iter; } +void SGraphNodeListIter::increment() { _iter++; } +SGraphNode SGraphNodeListIter::step() { + SGraphNode node = get(); increment(); return(node); } + + + + + +SGraphFilteredNodeIter::SGraphFilteredNodeIter() : + _base_iter(NULL), _filter(NULL), _owned(false), _last(0), _done(true) { } +SGraphFilteredNodeIter::SGraphFilteredNodeIter(const SGraphFilteredNodeIter &other) : + _base_iter(NULL), _filter(NULL), _owned(false), _last(0), _done(true) { + reset(other._base_iter, other._filter, false); +} +SGraphFilteredNodeIter::SGraphFilteredNodeIter(SNodeIter base_iter, + SGraphNodeFilter *filter, + bool owned) : + _base_iter(NULL), _filter(NULL), _owned(false), _last(0), _done(true) { + reset(base_iter, filter, owned); +} +SGraphFilteredNodeIter &SGraphFilteredNodeIter::operator=(const SGraphFilteredNodeIter &other) { + reset(other._base_iter, other._filter, false); + return(*this); +} + +SGraphNodeIter *SGraphFilteredNodeIter::clone() const { + return(new SGraphFilteredNodeIter(_base_iter.clone(), _filter, false)); +} + +void SGraphFilteredNodeIter::reset(SNodeIter base_iter, + SGraphNodeFilter *filter, + bool owned) { + if (_owned && _filter != NULL) delete _filter; + _filter = filter; + _base_iter = base_iter; + _done = false; + _last = 0; + for(;!_base_iter.done(); _base_iter.increment()) { + SGraphNode node = _base_iter.get(); + if (_filter->is_node_member(node)) { + _last = node; return; + } + } + _done = true; +} +void SGraphFilteredNodeIter::reset() { + _base_iter.reset(); + _done = false; + _last = 0; + for(;!_base_iter.done(); _base_iter.increment()) { + SGraphNode node = _base_iter.get(); + if (_filter->is_node_member(node)) { + _last = node; return; + } + } + _done = true; +} +bool SGraphFilteredNodeIter::done() const { return _done; } +size_t SGraphFilteredNodeIter::get() const { return _last; } +void SGraphFilteredNodeIter::increment() { + if (_done) return; + _base_iter.increment(); + for(;!_base_iter.done(); _base_iter.increment()) { + SGraphNode node = _base_iter.get(); + if (_filter->is_node_member(node)) { + _last = node; return; + } + } + _done = true; +} + +SGraphFilteredNodeIter::~SGraphFilteredNodeIter(){ + delete _filter; +} diff -Nur nci/suif/suif2b/extratypes/sgraph/sgraph_iter_impl.h nci-latest/suif/suif2b/extratypes/sgraph/sgraph_iter_impl.h --- nci/suif/suif2b/extratypes/sgraph/sgraph_iter_impl.h Wed Mar 29 00:27:05 2000 +++ nci-latest/suif/suif2b/extratypes/sgraph/sgraph_iter_impl.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef SGRAPH_ITER_IMPL_H #define SGRAPH_ITER_IMPL_H @@ -84,6 +85,7 @@ SGraphNodeFilter *filter, bool owned); SGraphFilteredNodeIter &operator=(const SGraphFilteredNodeIter &other); + virtual ~SGraphFilteredNodeIter(); void reset(SNodeIter base_iter, SGraphNodeFilter *filter, bool owned); virtual void reset(); diff -Nur nci/suif/suif2b/extratypes/sgraph/sgraph_list.cpp nci-latest/suif/suif2b/extratypes/sgraph/sgraph_list.cpp --- nci/suif/suif2b/extratypes/sgraph/sgraph_list.cpp Wed Mar 29 00:27:05 2000 +++ nci-latest/suif/suif2b/extratypes/sgraph/sgraph_list.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #include "sgraph_list.h" #include "sgraph_iter.h" @@ -95,7 +96,7 @@ get_node_successor_iterator(SGraphNode node) const { SGraphNodeList *l = get_succ_list(node); if (!l) return new SGraphEmptyIter; - return(new SGraphListIter(l, false)); + return (new SGraphListIter(l, false)); } SNodeIter SGraphList:: get_node_predecessor_iterator(SGraphNode node) const { @@ -142,8 +143,14 @@ void SGraphList:: add_edge(const SGraphEdge &edge) { // Idempotent - suif_assert(is_node_member(edge.from())); - suif_assert(is_node_member(edge.to())); + suif_assert_message(is_node_member(edge.from()), + ("Attempt to add edge (%d,%d) without from node %d", + edge.from(), edge.to(), edge.from() + )); + suif_assert_message(is_node_member(edge.to()), + ("Attempt to add edge (%d,%d) without node %d", + edge.from(), edge.to(), edge.to() + )); if (is_edge_member(edge)) return; retrieve_succ_list(edge.from())->push_back(edge.to()); retrieve_pred_list(edge.to())->push_back(edge.from()); @@ -235,7 +242,8 @@ reset(other._the_list, false); } SGraphListIter &SGraphListIter::operator=(const SGraphListIter &other) { - reset(other._the_list, false); + if(this != &other) + reset(other._the_list, false); return(*this); } SGraphNodeIter *SGraphListIter::clone() const { @@ -255,7 +263,7 @@ _the_list(NULL), _owned(true), _iter() { reset(the_list, owned); } void SGraphListIter::reset(SGraphNodeList *the_list, bool owned) { - if (_owned && _the_list != NULL) delete the_list; + if (_owned && _the_list != NULL) delete _the_list; _the_list = the_list; _owned = owned; reset(); diff -Nur nci/suif/suif2b/extratypes/sgraph/sgraph_list.cpp~ nci-latest/suif/suif2b/extratypes/sgraph/sgraph_list.cpp~ --- nci/suif/suif2b/extratypes/sgraph/sgraph_list.cpp~ Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/sgraph/sgraph_list.cpp~ Wed Feb 13 10:26:07 2002 @@ -0,0 +1,279 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +#include "sgraph_list.h" +#include "sgraph_iter.h" +#include "sgraph_bit_iter.h" +#include "common/suif_list.h" +#include "common/suif_vector.h" +#include "bit_vector/bit_vector.h" +#include "suifkernel/suifkernel_messages.h" + + + + +/* + * ****************************************** + * * + * * iterators over nodes + * * + * ****************************************** + */ +class SGraphListIter : public SGraphNodeIter { + SGraphNodeList *_the_list; + bool _owned; // If owned, delete it afterwards + SGraphNodeList::iterator _iter; +public: + SGraphListIter(); + ~SGraphListIter(); + SGraphListIter(const SGraphListIter &other); + SGraphListIter &operator=(const SGraphListIter &other); + SGraphListIter(SGraphNodeList *the_list, bool owned); + void reset(SGraphNodeList *the_list, bool owned); + virtual bool done() const; + virtual SGraphNode get() const; + virtual void increment(); + virtual void reset(); + SGraphNodeIter *clone() const; +}; + + + +SGraphNode SGraphList::max_num_nodes() const { + return (_nodes->num_significant_bits()); +} + +// Nodes +bool SGraphList::is_node_member(SGraphNode node) const { + return(_nodes->get_bit(node)); } + +void SGraphList::add_node (SGraphNode node) { + _nodes->set_bit(node, true); +} + +void SGraphList::remove_node(SGraphNode node) { + // This is optional. + remove_node_successor_edges(node); + remove_node_predecessor_edges(node); + _nodes->set_bit(node, false); } // don't mess with the edges here. + + +// Edges +// +// There is no edge representation here. +// just iterators over sucessors and predecessors +bool SGraphList::is_edge_member(const SGraphEdge &edge) const { + SGraphNodeList *succ = get_succ_list(edge.from()); + if (!succ) return false; + SGraphNodeList *pred = get_pred_list(edge.to()); + if (!pred) return false; + + // check the shorter list + if (pred->size() < succ->size()) { + return(list_contains(pred, edge.from())); + } + return (list_contains(succ, edge.to())); +} +void SGraphList::remove_edge(const SGraphEdge &edge) { + if (!is_edge_member(edge)) return; + list_remove(retrieve_succ_list(edge.from()), edge.to()); + list_remove(retrieve_pred_list(edge.to()), edge.from()); +} + +// Implementation in the .cc file +// void print(ion *out) const; + +// Iterators. Implementations in the .cc file +BitVector *SGraphList::new_node_set() const { + if (!_nodes) { return new BitVector; } + return( new BitVector(*_nodes)); +} + + +SNodeIter SGraphList::get_node_iterator() const { + return new SGraphBitIter(_nodes, false); +} +SNodeIter SGraphList:: +get_node_successor_iterator(SGraphNode node) const { + SGraphNodeList *l = get_succ_list(node); + if (!l) return new SGraphEmptyIter; + return (new SGraphListIter(l, false)); +} +SNodeIter SGraphList:: +get_node_predecessor_iterator(SGraphNode node) const { + SGraphNodeList *l = get_pred_list(node); + if (!l) return new SGraphEmptyIter; + return(new SGraphListIter(l, false)); +} + +bool SGraphList:: +node_has_successors(SGraphNode node) const { + SGraphNodeList *l = get_succ_list(node); + if (!l) return false; + return(!l->empty()); +} +bool SGraphList:: +node_has_predecessors(SGraphNode node) const { + SGraphNodeList *l = get_pred_list(node); + if (!l) return false; + return(!l->empty()); +} + + +SGraphList::SGraphList() : + _nodes(new BitVector), + _predecessors(new sgraph_node_list_vector), + _successors(new sgraph_node_list_vector) +{} + +SGraphList::~SGraphList() { + {for (sgraph_node_list_vector::iterator iter = _predecessors->begin(); + iter != _predecessors->end(); iter++) { + delete (*iter); +}} + + {for (sgraph_node_list_vector::iterator iter = _successors->begin(); + iter != _successors->end(); iter++) { + delete (*iter); + }} + delete _predecessors; + delete _successors; + delete _nodes; +} + +void SGraphList:: +add_edge(const SGraphEdge &edge) { + // Idempotent + suif_assert_message(is_node_member(edge.from()), + ("Attempt to add edge (%d,%d) without from node %d", + edge.from(), edge.to(), edge.from() + )); + suif_assert_message(is_node_member(edge.to()), + ("Attempt to add edge (%d,%d) without node %d", + edge.from(), edge.to(), edge.to() + )); + if (is_edge_member(edge)) return; + retrieve_succ_list(edge.from())->push_back(edge.to()); + retrieve_pred_list(edge.to())->push_back(edge.from()); +} + + +/* + * Helper methods + */ +bool SGraphList::has_succ_list(SGraphNode from_node) const { + if (_successors->size() <= from_node) { + return(false); + } + return((*_successors)[from_node] != 0); +} + +SGraphNodeList *SGraphList::retrieve_succ_list(SGraphNode from_node) { + while (_successors->size() <= from_node) { + _successors->push_back(NULL); + } + if ((*_successors)[from_node] == NULL) { + (*_successors)[from_node] = new SGraphNodeList; + } + return((*_successors)[from_node]); +} + +SGraphNodeList *SGraphList::get_succ_list(SGraphNode from_node) const { + if (has_succ_list(from_node)) { + return((*_successors)[from_node]); + } + return(NULL); +} + +// Same helpers for predecessors +bool SGraphList::has_pred_list(SGraphNode from_node) const { + if (_predecessors->size() <= from_node) { + return(false); + } + return((*_predecessors)[from_node] != 0); +} + +SGraphNodeList *SGraphList::retrieve_pred_list(SGraphNode from_node) { + while (_predecessors->size() <= from_node) { + _predecessors->push_back(NULL); + } + if ((*_predecessors)[from_node] == NULL) { + (*_predecessors)[from_node] = new SGraphNodeList; + } + return((*_predecessors)[from_node]); +} + +SGraphNodeList *SGraphList::get_pred_list(SGraphNode from_node) const { + if (has_pred_list(from_node)) { + return((*_predecessors)[from_node]); + } + return(NULL); +} + +bool SGraphList::list_contains(SGraphNodeList *l, SGraphNode node) { + for (SGraphNodeList::iterator iter = l->begin(); + iter != l->end(); iter++) { + if ((*iter) == node) return true; + } + return(false); +} +void SGraphList::list_remove(SGraphNodeList *l, SGraphNode node) { + for (SGraphNodeList::iterator iter = l->begin(); + iter != l->end(); iter++) { + if ((*iter) == node) { + l->erase(iter); + return; + } + } +} + + +/* + * ************************************************ + * + * Implementation of the iterator for SGraphList + * + * ************************************************ + */ + +SGraphListIter::SGraphListIter() : + _the_list(NULL), _owned(false), _iter() {} +SGraphListIter::SGraphListIter(const SGraphListIter &other) : + _the_list(NULL), _owned(false), _iter() { + reset(other._the_list, false); +} +SGraphListIter &SGraphListIter::operator=(const SGraphListIter &other) { + reset(other._the_list, false); + return(*this); +} +SGraphNodeIter *SGraphListIter::clone() const { + if (_owned) { + SGraphNodeList * l = new SGraphNodeList; + for (SGraphNodeList::iterator iter = _the_list->begin(); + iter != _the_list->end(); iter++) { + l->push_back(*iter); + } + return(new SGraphListIter(l, true)); + } + return(new SGraphListIter(_the_list, false)); +} + + +SGraphListIter::SGraphListIter(SGraphNodeList *the_list, bool owned) : + _the_list(NULL), _owned(true), _iter() { + reset(the_list, owned); } +void SGraphListIter::reset(SGraphNodeList *the_list, bool owned) { + if (_owned && _the_list != NULL) delete _the_list; + _the_list = the_list; + _owned = owned; + reset(); +} +void SGraphListIter::reset() { + _iter = _the_list->begin(); +} +SGraphListIter::~SGraphListIter() { + if (_owned) delete _the_list; +} + +bool SGraphListIter::done() const { return _iter == _the_list->end(); } +size_t SGraphListIter::get() const { return *_iter; } +void SGraphListIter::increment() { _iter++; } diff -Nur nci/suif/suif2b/extratypes/sgraph/sgraph_list.h nci-latest/suif/suif2b/extratypes/sgraph/sgraph_list.h --- nci/suif/suif2b/extratypes/sgraph/sgraph_list.h Wed Mar 29 00:27:05 2000 +++ nci-latest/suif/suif2b/extratypes/sgraph/sgraph_list.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* sgraph_list */ /* Copyright (c) 1998 Stanford University diff -Nur nci/suif/suif2b/extratypes/sgraph/sgraph_node_map.h nci-latest/suif/suif2b/extratypes/sgraph/sgraph_node_map.h --- nci/suif/suif2b/extratypes/sgraph/sgraph_node_map.h Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/sgraph/sgraph_node_map.h Wed Feb 13 10:26:07 2002 @@ -0,0 +1,86 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +#ifndef SGRAPH_NODE_MAP_H +#define SGRAPH_NODE_MAP_H + +#include +#include +#include + + +/* automatically expanding vector */ +template +class SGraphNodeMap { + suif_vector *_values; + T _default_value; +public: + typedef typename suif_vector::iterator iterator; + typedef typename suif_vector::const_iterator const_iterator; + SGraphNodeMap(T default_value); + SGraphNodeMap(const SGraphNodeMap &other); + SGraphNodeMap &operator=(const SGraphNodeMap &other); + ~SGraphNodeMap(void); + iterator begin(); + const_iterator begin() const; + + iterator end(); + const_iterator end() const; + + + T get_value(SGraphNode) const; + void set_value(SGraphNode node, T value); + void clear(); +}; + +/* Impl follows */ +#include +template +SGraphNodeMap::SGraphNodeMap(T default_value) : + _values(new suif_vector()), + _default_value(default_value) +{ +} + +template +SGraphNodeMap::SGraphNodeMap(const SGraphNodeMap &other) : + _values(new suif_vector(*other._values)), + _default_value(other._default_value) +{ +} + +template +SGraphNodeMap &SGraphNodeMap::operator=(const SGraphNodeMap &other) +{ + (*values) = (*other._values); + _default_value = other._default_value; + return(*this); +} + +template +SGraphNodeMap::~SGraphNodeMap() +{ + delete _values; +} + +template +T SGraphNodeMap::get_value(SGraphNode node) const { + if (_values->size() <= node) { + return(_default_value); + } + return((*_values)[node]); +} +template +void SGraphNodeMap::set_value(SGraphNode node, T value) { + while (_values->size() <= node) { + _values->push_back(_default_value); + } + (*_values)[node] = value; +} + +template +void SGraphNodeMap::clear(void) { + _values->clear(); +} + + +#endif /* SGRAPH_NODE_MAP_H */ diff -Nur nci/suif/suif2b/extratypes/sgraph/standard_main.cpp nci-latest/suif/suif2b/extratypes/sgraph/standard_main.cpp --- nci/suif/suif2b/extratypes/sgraph/standard_main.cpp Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/sgraph/standard_main.cpp Wed Feb 13 10:26:07 2002 @@ -0,0 +1,32 @@ +// This file was automatically build by +// /sow/16/16/livshits/work/src/nci/build_main.pl '-lsuifkernel -liokernel -lcommon -lion -lbit_vector' +// from the $(LIBS} variable in the Makefile +// +#include "suifkernel/suifkernel_forwarders.h" +#include "suifkernel/suif_env.h" +#include "suifkernel/module_subsystem.h" +#include "suifkernel/token_stream.h" +#include "suifpasses/suifpasses.h" + + +int main( int argc, char* argv[] ) { + // initialize the environment + SuifEnv* suif = new SuifEnv; + suif->init(); + + // import and initialize the necessary libraries + suif->require_DLL("ion"); + suif->require_DLL("bit_vector"); + + // transform the input arguments into a stream of + // input tokens + TokenStream token_stream( argc, argv ); + + // execute the Module "execute" + ModuleSubSystem* mSubSystem = suif->get_module_subsystem(); + mSubSystem -> execute( "execute", &token_stream ); + + delete suif; + + return 0; +} diff -Nur nci/suif/suif2b/extratypes/sgraph_algs/Makefile nci-latest/suif/suif2b/extratypes/sgraph_algs/Makefile --- nci/suif/suif2b/extratypes/sgraph_algs/Makefile Wed Jun 14 03:10:06 2000 +++ nci-latest/suif/suif2b/extratypes/sgraph_algs/Makefile Wed Feb 13 10:26:07 2002 @@ -6,10 +6,13 @@ # The primary interfaces here are: # sgraph and ngraph -HEADERS = sgraph_algs.h cfgraph_algs.h +HEADERS = sgraph_algs.h cfgraph_algs.h sgraph_algs_forwarders.h \ + tarjan_dominator.h -SRCS = sgraph_algs.cpp cfgraph_algs.cpp standard_main.cpp -OBJ_FILES = sgraph_algs.o cfgraph_algs.o +SRCS = sgraph_algs.cpp cfgraph_algs.cpp standard_main.cpp \ + tarjan_dominator.cpp +OBJ_FILES = sgraph_algs.o cfgraph_algs.o \ + tarjan_dominator.o LIBS += -lsuifkernel -liokernel -lcommon LIBS += -lion -lsgraph -lbit_vector diff -Nur nci/suif/suif2b/extratypes/sgraph_algs/Makefile.deps nci-latest/suif/suif2b/extratypes/sgraph_algs/Makefile.deps --- nci/suif/suif2b/extratypes/sgraph_algs/Makefile.deps Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/sgraph_algs/Makefile.deps Wed Feb 13 10:26:07 2002 @@ -0,0 +1,36 @@ +# Dependencies for C files + +# Dependencies for C files + +CPP_TO_O_RULE = defined +C_TO_O_RULE = defined + +%.o: %.cpp %.cxx %.cc + -echo Can not build $*.o from $< without explicit dependency + -echo The Makefile.deps file was incorrectly generated + -echo All .o dependencies should be explicit in that file + +$(OBJDIR)/$(TARGET_LIB)/tarjan_dominator.o: tarjan_dominator.cpp tarjan_dominator.h /sow/16/16/livshits/work/src/nci/include/common/suif_copyright.h /sow/16/16/livshits/work/src/nci/include/sgraph/sgraph_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/machine_dependent.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h /sow/16/16/livshits/work/src/nci/include/common/common_forwarders.h /sow/16/16/livshits/work/src/nci/include/sgraph_algs/sgraph_algs_forwarders.h /sow/16/16/livshits/work/src/nci/include/ion/ion_forwarders.h /sow/16/16/livshits/work/src/nci/include/sgraph/sgraph_node_map.h /sow/16/16/livshits/work/src/nci/include/bit_vector/bit_vector_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/suif_vector.h /usr/include/g++-2/cstddef cfgraph_algs.h /sow/16/16/livshits/work/src/nci/include/sgraph/sgraph.h /sow/16/16/livshits/work/src/nci/include/common/suif_list.h /sow/16/16/livshits/work/src/nci/include/sgraph/sgraph_iter.h /sow/16/16/livshits/work/src/nci/include/sgraph/sgraph_forest.h /sow/16/16/livshits/work/src/nci/include/ion/ion.h /usr/include/stdio.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h /usr/include/bits/stdio_lim.h /sow/16/16/livshits/work/src/nci/include/iokernel/helper.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/MString.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h /sow/16/16/livshits/work/src/nci/include/common/simple_stack.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_messages.h /sow/16/16/livshits/work/src/nci/include/bit_vector/bit_vector.h /sow/16/16/livshits/work/src/nci/include/common/i_integer.h /sow/16/16/livshits/work/src/nci/include/sgraph/sgraph_bit_subgraph.h sgraph_algs.h /sow/16/16/livshits/work/src/nci/include/sgraph/ngraph.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_messages.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_forwarders.h /sow/16/16/livshits/work/src/nci/include/sgraph/sgraph_bit.h /sow/16/16/livshits/work/src/nci/include/sgraph/sgraph_list.h /sow/16/16/livshits/work/src/nci/include/sgraph/sgraph_helper.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/tarjan_dominator.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) tarjan_dominator.cpp + +$(OBJDIR)/$(TARGET_LIB)/cfgraph_algs.o: cfgraph_algs.cpp /sow/16/16/livshits/work/src/nci/include/sgraph/sgraph_forest.h /sow/16/16/livshits/work/src/nci/include/sgraph/sgraph_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/machine_dependent.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h /sow/16/16/livshits/work/src/nci/include/common/common_forwarders.h /sow/16/16/livshits/work/src/nci/include/bit_vector/bit_vector_forwarders.h /sow/16/16/livshits/work/src/nci/include/ion/ion.h /usr/include/stdio.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h /usr/include/bits/stdio_lim.h /sow/16/16/livshits/work/src/nci/include/sgraph/sgraph.h /sow/16/16/livshits/work/src/nci/include/common/suif_copyright.h /sow/16/16/livshits/work/src/nci/include/ion/ion_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/suif_list.h /sow/16/16/livshits/work/src/nci/include/sgraph/sgraph_iter.h /sow/16/16/livshits/work/src/nci/include/bit_vector/bit_vector.h /sow/16/16/livshits/work/src/nci/include/common/MString.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h /sow/16/16/livshits/work/src/nci/include/common/simple_stack.h /sow/16/16/livshits/work/src/nci/include/common/i_integer.h cfgraph_algs.h sgraph_algs.h /sow/16/16/livshits/work/src/nci/include/sgraph/ngraph.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_messages.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_forwarders.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_forwarders.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_messages.h /sow/16/16/livshits/work/src/nci/include/sgraph/sgraph_bit.h /sow/16/16/livshits/work/src/nci/include/sgraph/sgraph_list.h /sow/16/16/livshits/work/src/nci/include/common/suif_vector.h /usr/include/g++-2/cstddef /sow/16/16/livshits/work/src/nci/include/sgraph/sgraph_bit_subgraph.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/cfgraph_algs.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) cfgraph_algs.cpp + +$(OBJDIR)/$(TARGET_LIB)/standard_main.o: standard_main.cpp /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_forwarders.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_forwarders.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /sow/16/16/livshits/work/src/nci/include/common/common_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/MString.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h /sow/16/16/livshits/work/src/nci/include/common/simple_stack.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_messages.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_messages.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suif_env.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h /sow/16/16/livshits/work/src/nci/include/suifkernel/module_subsystem.h /sow/16/16/livshits/work/src/nci/include/suifkernel/token_stream.h /sow/16/16/livshits/work/src/nci/include/suifkernel/char_source.h /usr/include/g++-2/iostream.h /usr/include/g++-2/streambuf.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /sow/16/16/livshits/work/src/nci/include/suifpasses/suifpasses.h /sow/16/16/livshits/work/src/nci/include/suifpasses/standard_modules.h /sow/16/16/livshits/work/src/nci/include/suifkernel/module.h /sow/16/16/livshits/work/src/nci/include/suifpasses/passes.h /sow/16/16/livshits/work/src/nci/include/suifpasses/drivers.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/standard_main.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) standard_main.cpp + +$(OBJDIR)/$(TARGET_LIB)/sgraph_algs.o: sgraph_algs.cpp /sow/16/16/livshits/work/src/nci/include/common/suif_copyright.h /sow/16/16/livshits/work/src/nci/include/sgraph/sgraph.h /sow/16/16/livshits/work/src/nci/include/sgraph/sgraph_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/machine_dependent.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h /sow/16/16/livshits/work/src/nci/include/common/common_forwarders.h /sow/16/16/livshits/work/src/nci/include/ion/ion_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/suif_list.h /sow/16/16/livshits/work/src/nci/include/bit_vector/bit_vector_forwarders.h /sow/16/16/livshits/work/src/nci/include/sgraph/sgraph_iter.h /sow/16/16/livshits/work/src/nci/include/sgraph/sgraph_helper.h sgraph_algs.h /sow/16/16/livshits/work/src/nci/include/sgraph/ngraph.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_messages.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_forwarders.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/MString.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h /sow/16/16/livshits/work/src/nci/include/common/simple_stack.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_messages.h /sow/16/16/livshits/work/src/nci/include/sgraph/sgraph_bit.h /sow/16/16/livshits/work/src/nci/include/sgraph/sgraph_list.h /sow/16/16/livshits/work/src/nci/include/common/suif_vector.h /usr/include/g++-2/cstddef /sow/16/16/livshits/work/src/nci/include/sgraph/sgraph_forest.h /sow/16/16/livshits/work/src/nci/include/ion/ion.h /usr/include/stdio.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h /usr/include/bits/stdio_lim.h /sow/16/16/livshits/work/src/nci/include/bit_vector/bit_vector.h /sow/16/16/livshits/work/src/nci/include/common/i_integer.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suif_env.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/sgraph_algs.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) sgraph_algs.cpp + diff -Nur nci/suif/suif2b/extratypes/sgraph_algs/cfgraph_algs.cpp nci-latest/suif/suif2b/extratypes/sgraph_algs/cfgraph_algs.cpp --- nci/suif/suif2b/extratypes/sgraph_algs/cfgraph_algs.cpp Mon Jun 12 09:21:11 2000 +++ nci-latest/suif/suif2b/extratypes/sgraph_algs/cfgraph_algs.cpp Wed Feb 13 10:26:07 2002 @@ -1,8 +1,20 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +#include +#include #include "cfgraph_algs.h" #include "sgraph_algs.h" #include "sgraph/sgraph_bit_subgraph.h" +#include -DFBuild::DFBuild(SGraph *graph, +static void print_node_list(FILE *fp, SGraphNodeList *l) { + for (SGraphNodeList::iterator iter = l->begin(); + iter != l->end(); iter++) { + SGraphNode node = *iter; + fprintf(fp, "%d ", node); + } +} + +DFBuild::DFBuild(const SGraph *graph, SGraphNode entry, SGraphNode the_exit) : _initial_graph(graph), @@ -13,12 +25,22 @@ _dominance_frontier(NULL), _iterated_dominance_frontier(NULL), _entries(new SGraphNodeList), - _exits(new SGraphNodeList) + _exits(new SGraphNodeList), + _verbose_level(0) { _entries->push_back(entry); _exits->push_back(the_exit); } +int DFBuild::get_verbose_level() const { + return(_verbose_level); +} + +void DFBuild::set_verbose_level(int verbose_level) { + _verbose_level = verbose_level; +} + + DFBuild::~DFBuild(){ delete _entries; delete _exits; @@ -35,20 +57,53 @@ SGraphBitSubgraph *reachable = new SGraphBitSubgraph(_initial_graph); + if (_verbose_level > 0) { + printf("BEGIN: CFGraph::reachable INIT\n"); + reachable->print(stdout_ion); + printf("END: CFGraph::reachable INIT\n"); + } + for (SGraphNodeList::iterator iter = _entries->begin(); iter != _entries->end(); iter++) { - BitVector *bits = build_reachable(_initial_graph, + sf_owned BitVector *bits = build_reachable(_initial_graph, *iter, true); reachable->add_nodes_from_bits(bits); + if (_verbose_level > 0) { + printf("BEGIN: CFGraph::reachable validate\n"); + reachable->validate(); + printf("END: CFGraph::reachable validate\n"); + } + delete bits; } _reachable = reachable; + if (_verbose_level > 0) { + printf("BEGIN: CFGraph::_initial_graph\n"); + _initial_graph->print(stdout_ion); + printf("END: CFGraph::_initial_graph\n"); + } + if (_verbose_level > 0) { + printf("BEGIN: CFGraph::_entries\n"); + print_node_list(stdout, _entries); + printf("\n"); + printf("END: CFGraph::_entries\n"); + printf("BEGIN: CFGraph::_exits\n"); + print_node_list(stdout, _exits); + printf("\n"); + printf("END: CFGraph::_exits\n"); + } + if (_verbose_level > 0) { + printf("BEGIN: CFGraph::_reachable\n"); + _reachable->print(stdout_ion); + printf("END: CFGraph::_reachable\n"); + } } +SimpleDFBuild::SimpleDFBuild(const SGraph *graph, SGraphNode entry, SGraphNode the_exit): + DFBuild(graph, entry, the_exit){} - -void DFBuild::do_build_dominance_frontier() { +void SimpleDFBuild::do_build_dominance_frontier() { if (_dominance_frontier != NULL) return; do_build_reachable(); do_build_dominators(); @@ -66,9 +121,15 @@ true); } _dominance_frontier = df; + if (_verbose_level > 0) { + printf("BEGIN: CFGraph::_dominance_frontier\n"); + _dominance_frontier->print(stdout_ion); + printf("END: CFGraph::_reachable\n"); + } } -void DFBuild::do_build_iterated_dominance_frontier() { + +void SimpleDFBuild::do_build_iterated_dominance_frontier() { if (_iterated_dominance_frontier != NULL) return; do_build_dominance_frontier(); @@ -79,6 +140,11 @@ _reachable, _dominance_frontier); _iterated_dominance_frontier = idf; + if (_verbose_level > 0) { + printf("BEGIN: CFGraph::_iterated_dominance_frontier\n"); + _iterated_dominance_frontier->print(stdout_ion); + printf("END: CFGraph::_iterated_dominance_frontier\n"); + } } void DFBuild::do_build_reverse_postorder_list() { @@ -97,16 +163,23 @@ _reverse_postorder_list = build_reverse_postorder_list(_reachable, _entries, - true); + true, true); + if (_verbose_level > 0) { + printf("BEGIN: CFGraph::_reverse_postorder_list\n"); + print_node_list(stdout, _reverse_postorder_list); + printf("\n"); + printf("END: CFGraph::_reverse_postorder_list\n"); + } + } -void DFBuild::do_build_immediate_dominators() { +void SimpleDFBuild::do_build_immediate_dominators() { if (_immediate_dominators != NULL) return; do_build_reachable(); do_build_reverse_postorder_list(); do_build_dominators(); - SGraphList *id = new SGraphList; + SGraphForest *id = new SGraphForest; id->add_nodes_from_sgraph(_reachable); for (SGraphNodeList::iterator iter = _entries->begin(); @@ -122,9 +195,15 @@ // id->add_edge(entry,entry); } _immediate_dominators = id; + if (_verbose_level > 0) { + printf("BEGIN: CFGraph::_immediate_dominators\n"); + _immediate_dominators->print(stdout_ion); + printf("END: CFGraph::_immediate_dominators\n"); + } + } -void DFBuild::do_build_dominators() { +void SimpleDFBuild::do_build_dominators() { if (_dominators != NULL) return; do_build_reachable(); do_build_reverse_postorder_list(); @@ -134,16 +213,22 @@ for (SGraphNodeList::iterator iter = _entries->begin(); iter != _entries->end(); iter++) { + SGraphNode entry = *iter; build_dominators(dom, _reachable, _reverse_postorder_list, - *iter, + entry, true); } _dominators = dom; + if (_verbose_level > 0) { + printf("BEGIN: CFGraph::_dominators\n"); + _dominators->print(stdout_ion); + printf("END: CFGraph::_dominators\n"); + } } -SGraph *DFBuild::get_initial_graph() const{ +const SGraph *DFBuild::get_initial_graph() const{ return _initial_graph; } @@ -171,3 +256,8 @@ return _iterated_dominance_frontier; } +SGraphNode DFBuild::get_immed_dom(SGraphNode node) const { + return _immediate_dominators->is_root(node) ? + node : + _immediate_dominators->get_parent(node); +} diff -Nur nci/suif/suif2b/extratypes/sgraph_algs/cfgraph_algs.h nci-latest/suif/suif2b/extratypes/sgraph_algs/cfgraph_algs.h --- nci/suif/suif2b/extratypes/sgraph_algs/cfgraph_algs.h Tue Jun 27 17:53:59 2000 +++ nci-latest/suif/suif2b/extratypes/sgraph_algs/cfgraph_algs.h Wed Feb 13 10:26:07 2002 @@ -1,45 +1,60 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef CFGRAPH_ALGS #define CFGRAPH_ALGS #include "sgraph/sgraph.h" class DFBuild { - SGraph *_initial_graph; +protected: + const SGraph *_initial_graph; SGraph *_reachable; SGraphNodeList *_reverse_postorder_list; SGraph *_dominators; - SGraph *_immediate_dominators; + SGraphForest *_immediate_dominators; SGraph *_dominance_frontier; SGraph *_iterated_dominance_frontier; SGraphNodeList *_entries; SGraphNodeList *_exits; - public: - DFBuild(SGraph *graph, SGraphNode entry, SGraphNode the_exit); - ~DFBuild(); + int _verbose_level; + public: - void do_build_reachable(); - void do_build_reverse_postorder_list(); - void do_build_dominators(); - void do_build_immediate_dominators(); - void do_build_dominance_frontier(); - void do_build_iterated_dominance_frontier(); + DFBuild(const SGraph *graph, SGraphNode entry, SGraphNode the_exit); + virtual ~DFBuild(); - SGraph *get_initial_graph() const; + void set_verbose_level(int verbose_level); + int get_verbose_level() const; + const SGraph *get_initial_graph() const; SGraph *get_reachable_graph() const; SGraph *get_dominators() const; SGraphNodeList *get_reverse_postorder_list() const; SGraph *get_immediate_dominators() const; SGraph *get_dominance_frontier() const; SGraph *get_iterated_dominance_frontier() const; - SGraphNode get_immed_dom(SGraphNode node) const; - SGraphNode get_immed_postdom(SGraphNode node) const; + + virtual void do_build_reverse_postorder_list(); + virtual void do_build_reachable(); + + virtual void do_build_dominators() = 0; + virtual void do_build_immediate_dominators() = 0; + virtual void do_build_dominance_frontier() = 0; + virtual void do_build_iterated_dominance_frontier() = 0; + private: /* avoid default assignment ops, don't define these */ DFBuild &operator=(const DFBuild&); DFBuild(const DFBuild&); +}; + +class SimpleDFBuild : public DFBuild { +public: + SimpleDFBuild(const SGraph *graph, SGraphNode entry, SGraphNode the_exit); + virtual void do_build_dominators(); + virtual void do_build_immediate_dominators(); + virtual void do_build_dominance_frontier(); + virtual void do_build_iterated_dominance_frontier(); }; #endif /* CFGRAPH_ALGS */ diff -Nur nci/suif/suif2b/extratypes/sgraph_algs/sgraph_algs.cpp nci-latest/suif/suif2b/extratypes/sgraph_algs/sgraph_algs.cpp --- nci/suif/suif2b/extratypes/sgraph_algs/sgraph_algs.cpp Wed Feb 13 10:27:00 2002 +++ nci-latest/suif/suif2b/extratypes/sgraph_algs/sgraph_algs.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* Graph algorithms */ /* Copyright (c) 1994,1998 Stanford University @@ -11,8 +12,10 @@ #include "sgraph/sgraph.h" +#include "sgraph/sgraph_helper.h" #include "sgraph_algs.h" #include "sgraph/sgraph_iter.h" +#include "sgraph/sgraph_forest.h" #include "bit_vector/bit_vector.h" #include "suifkernel/suifkernel_messages.h" #include "suifkernel/suif_env.h" @@ -39,26 +42,38 @@ if (_visited != NULL) delete _visited; } void ordered_sgraph_visitor::reset(const SGraph *the_sgraph, - bool do_forward) { + bool do_forward, bool reset_visited) { _the_sgraph = the_sgraph; _do_forward = do_forward; - if (_visited != NULL) delete _visited; - _visited = new BitVector;//_the_sgraph->new_node_set(); + if(reset_visited){ + if (_visited != NULL) delete _visited; + _visited = new BitVector;//_the_sgraph->new_node_set(); + }else{ + if(_visited == NULL){ + _visited = new BitVector;//_the_sgraph->new_node_set(); + } + } } // depth-first postorder void ordered_sgraph_visitor::visit_postorder(SGraphNode node) { // I think this was a bug from the old code. + //printf("visiting %d because get_bit(%d)=%d\n", node, node, _visited->get_bit(node)); _visited->set_bit(node, true); + suif_assert(_visited->get_bit(node)); + for (SNodeIter iter = _the_sgraph->get_node_successor_iterator(node, _do_forward); !iter.done(); iter.increment()) { SGraphNode next_node = iter.get(); /* check if the node has already been visited */ - if (_visited->get_bit(next_node)) continue; + if (_visited->get_bit(next_node)) { + //printf("skipping %d because get_bit(%d)=%d\n", next_node, next_node, _visited->get_bit(next_node)); + continue; + } // Here was the bug. The entry node might be visited // more than once. - // _visited->add_member(next_node); + //_visited->set_bit(next_node, true); visit_postorder(next_node); } do_node_action(node); @@ -99,7 +114,8 @@ bool reverse_graph, SGraphNodeList *lst, bool reverse_list) { - reset(the_sgraph, reverse_graph); + reset(the_sgraph, reverse_graph, false); + if (_list != NULL) delete _list; _list = lst; _reverse_list = reverse_list; @@ -141,9 +157,9 @@ SGraphNodeList * build_reverse_postorder_list(const SGraph *the_sgraph, SGraphNode node, - bool do_forward) { + bool do_forward, bool reverse_list) { SGraphNodeList *the_list = new SGraphNodeList; - ordered_sgraph_list_builder vis(the_sgraph, do_forward, the_list, true); + ordered_sgraph_list_builder vis(the_sgraph, do_forward, the_list, reverse_list); vis.visit_postorder(node); return(vis.take_list()); } @@ -151,14 +167,16 @@ SGraphNodeList * build_reverse_postorder_list(const SGraph *the_sgraph, const SGraphNodeList *entries, - bool do_forward) { + bool do_forward, bool reverse_list) { SGraphNodeList *the_list = new SGraphNodeList; - ordered_sgraph_list_builder vis(the_sgraph, do_forward, 0, true); + ordered_sgraph_list_builder vis(the_sgraph, do_forward, 0, reverse_list); for (SGraphNodeList::iterator iter = entries->begin(); - iter != entries->end(); iter++) { - vis.reset_builder(the_sgraph, do_forward, the_list, true); + iter != entries->end(); iter++) + { + vis.reset_builder(the_sgraph, do_forward, the_list, reverse_list); SGraphNode node = *iter; vis.visit_postorder(node); + //printf("get_bit(2): %d \n", vis.get_visited()->get_bit(2)); the_list = vis.take_list(); } return the_list; @@ -172,6 +190,17 @@ bool do_forward) { SGraphNodeList *node_list = rev_postord_list; // build_reverse_postorder_list(reachable, node, do_forward); + // bool verbose = true; + bool verbose = false; + + if (verbose) { + printf("BEGIN: build_dominators::reachable\n"); + reachable->print(stdout_ion); + printf("END: build_dominators::reachable\n"); + printf("BEGIN: build_dominators::validate\n"); + reachable->validate(); + printf("END: build_dominators::validate\n"); + } //size_t max_num_nodes = reachable->max_num_nodes(); @@ -184,11 +213,22 @@ // domination->set_fully_connected(); domination->add_all_edges(); - + + if (verbose) { + printf("BEGIN: build_dominators::full\n"); + domination->print(stdout_ion); + printf("END: build_dominators::full\n"); + } /* set up the first node */ // initialize for no outgoing edges. // domination->remove_edges_from(start); dom->remove_node_successor_edges(start, do_forward); + + if (verbose) { + printf("BEGIN: build_dominators::no successors\n"); + domination->print(stdout_ion); + printf("END: build_dominators::no successors\n"); + } // a node dominates itself. domination->add_edge(SGraphEdge(start, start)); @@ -197,7 +237,7 @@ BitVector *node_set = reachable->new_node_set(); BitVector t; - + int iter_number = 0; /* iterate until no changes */ do { changed = false; @@ -205,6 +245,10 @@ node_iter != node_list->end(); node_iter++) { SGraphNode current_node = *node_iter; + if (verbose) { + printf("BEGIN: Handle %d\n", current_node); + } + if (current_node == start) continue; BitVector *local_val = domination->new_node_successors(current_node, do_forward); @@ -232,6 +276,15 @@ // local_changed = true; } } + if (verbose) { + printf(" BEGIN: build_dominators::Iteration %d: Node %d: Pred %d\n", + iter_number, current_node, pred_node); + t.print_long(stdout_ion); + stdout_ion->printf("\n"); + printf(" END: build_dominators::Iteration %d: Node %d: Pred %d\n", + iter_number, current_node, pred_node); + } + } /* include itself in dominator set */ @@ -250,8 +303,25 @@ domination->set_node_successors(current_node, &t, do_forward); } + if (verbose) { + printf(" BEGIN: build_dominators::Iteration %d: Node %d\n", + iter_number, current_node); + domination->print(stdout_ion); + printf(" END: build_dominators::Iteration %d: Node %d\n", + iter_number, + current_node); + } + if (verbose) { + printf("END: Handle %d\n", current_node); + } delete local_val; } + if (verbose) { + printf(" BEGIN: build_dominators::Iteration %d\n", iter_number); + domination->print(stdout_ion); + printf(" END: build_dominators::Iteration %d\n", iter_number); + } + iter_number++; } while (changed); delete node_set; @@ -379,7 +449,13 @@ // This feels backwards. //@@@ SNodeIter iter(immed_dom->get_node_successor_iterator(node)); - assert(!iter.done()); + if (!iter.done()) { + bool verbose = false; + if (verbose) + immed_dom->print(stdout_ion); + suif_assert_message(!iter.done(), + ("Node %d has no successor in the immed-dom graph\n")); + } SGraphNode idom = iter.get(); iter.increment(); assert(iter.done()); @@ -754,116 +830,33 @@ - -static void node_print(SGraphNode node, - const SGraph *the_sgraph, ion *out, - suif_vector *name_map) { - if (name_map && - name_map->size() > node) { - String s = (*name_map)[node]; - if (s != emptyString) { - out->printf("%s", s.c_str()); - return; - } - } - the_sgraph->print_node(out, node); -} - +/* A number of these implementations that are not + * really algorithmic have been moved to the + * SGraphHelper class. + * We leave these implementations here to avoid breaking + * old code + */ void export_dot(const SGraph *the_sgraph, ion *out){ - out->printf("digraph foo {\nsize = \"8,10\";\n"); - - SNodeIter iter(the_sgraph->get_node_iterator()); - // Print out nodes names and their labels - for (; !iter.done(); iter.increment()) { - SGraphNode node = iter.get(); - the_sgraph->print_node(out, node); - out->printf(" ["); - out->printf("shape=box, label=\""); - the_sgraph->print_node(out, node); - out->printf("\"];\n"); - } - - iter = the_sgraph->get_node_iterator(); - // Print out each connecting edge - for (; !iter.done(); iter.increment()) { - SGraphNode from_node = iter.get(); - for (SNodeIter iter2(the_sgraph->get_node_successor_iterator(from_node)); - !iter2.done(); iter2.increment()) { - SGraphNode to_node = iter2.get(); - the_sgraph->print_node(out, from_node); - out->printf(" -> "); - the_sgraph->print_node(out, to_node); - out->printf("\n"); - } - } - out->printf("}\n"); + SGraphHelper::export_dot(the_sgraph, out); } void export_named_dot(const SGraph *the_sgraph, ion *out, - suif_vector* name_map){ - out->printf("digraph foo {\nsize = \"8,10\";\n"); + suif_vector* name_map, String graph_name) +{ + SGraphHelper::export_named_dot(the_sgraph, out, name_map, graph_name); +} - SNodeIter iter(the_sgraph->get_node_iterator()); - // Print out nodes names and their labels - for (; !iter.done(); iter.increment()) { - SGraphNode node = iter.get(); - the_sgraph->print_node(out, node); - out->printf(" ["); - out->printf("shape=box, label=\""); - node_print(node, the_sgraph, out, name_map); - out->printf("\"];\n"); - } - - iter = the_sgraph->get_node_iterator(); - // Print out each connecting edge - for (; !iter.done(); iter.increment()) { - SGraphNode from_node = iter.get(); - for (SNodeIter iter2(the_sgraph->get_node_successor_iterator(from_node)); - !iter2.done(); iter2.increment()) { - SGraphNode to_node = iter2.get(); - the_sgraph->print_node(out, from_node); - out->printf(" -> "); - the_sgraph->print_node(out, to_node); - //out->printf("%s", (*name_map)[to_node].c_str()); - out->printf("\n"); - } - } - out->printf("}\n"); +void export_named_dot(suif_list& graphs, ion *out, + suif_vector *node_name_map, suif_list& graph_names) +{ + SGraphHelper::export_named_dot(graphs, out, node_name_map, + graph_names); } void print_named(const SGraph *the_sgraph, ion *out, suif_vector *name_map) { - // out->printf("digraph foo {\nsize = \"8,10\";\n"); - out->printf("BEGIN GRAPH\n"); - // Print out nodes names and their labels - {for (SNodeIter iter(the_sgraph->get_node_iterator()); - !iter.done(); iter.increment()) { - SGraphNode node = iter.get(); - out->printf(" %d{", node); - node_print(node, the_sgraph, out, name_map); - out->printf("}\n"); - }} - - - // Print out each connecting edge - {for (SNodeIter iter = the_sgraph->get_node_iterator(); - !iter.done(); iter.increment()) { - SGraphNode from_node = iter.get(); - for (SNodeIter iter2(the_sgraph->get_node_successor_iterator(from_node)); - !iter2.done(); iter2.increment()) { - SGraphNode to_node = iter2.get(); - out->printf(" %d{", from_node); - node_print(from_node, the_sgraph, out, name_map); - out->printf("} "); - out->printf(" -> "); - out->printf(" %d{", to_node); - node_print(to_node, the_sgraph, out, name_map); - out->printf("} "); - out->printf("\n"); - } - }} - out->printf("END GRAPH\n"); + SGraphHelper::print_named(the_sgraph, out, name_map); } // Assume the given graph is clear @@ -873,14 +866,101 @@ for (SEdgeIter iter(the_graph->get_edge_iterator()); !iter.done(); iter.increment()) { SGraphEdge edge = iter.get(); - reverse->add_edge(edge.reverse()); + reverse->add_edge(SGraphEdge(edge.to(), edge.from())); } } +void SGraphAlgsHelper::simplify_basic_blocks(const SGraph *the_sgraph, + SGraph *bb_graph, + SGraphLinkEval *bb_pred) { + BitVector visited; + + for (SNodeIter iter(the_sgraph->get_node_iterator()); + !iter.done(); + iter.increment()) { + SGraphNode node = iter.current(); + if (visited.get_bit(node)) continue; + + visited.set_bit(node, true); + if (SGraphHelper::has_unique_predecessor(the_sgraph, node) && + SGraphHelper::has_unique_successor(the_sgraph, node)) { + //bb_pred->set_root(node); + // Go up + SGraphNode first_node = node; + while (SGraphHelper::has_unique_predecessor(the_sgraph, first_node)) { + SGraphNode prev_node = + SGraphHelper::get_unique_predecessor(the_sgraph, + first_node); + if (visited.get_bit(prev_node) == true) + break; + visited.set_bit(prev_node, true); + if (SGraphHelper::has_unique_successor(the_sgraph, prev_node) + && SGraphHelper::has_unique_predecessor(the_sgraph, prev_node)) { + first_node = prev_node; + bb_pred->link(node, first_node); + } else { + break; + } + } + // Go down + SGraphNode last_node = node; + while (SGraphHelper::has_unique_successor(the_sgraph, last_node)) { + SGraphNode succ_node = + SGraphHelper::get_unique_successor(the_sgraph, + last_node); + if (visited.get_bit(succ_node) == true) + break; + visited.set_bit(succ_node, true); + if (SGraphHelper::has_unique_successor(the_sgraph, succ_node) + && SGraphHelper::has_unique_predecessor(the_sgraph, succ_node)) { + last_node = succ_node; + bb_pred->link(node, last_node); + } else { + break; + } + } + } + } + + {for (SNodeIter iter(the_sgraph->get_node_iterator()); + !iter.done(); + iter.increment()) { + SGraphNode node = iter.current(); + bb_graph->add_node(bb_pred->eval(node)); + }} + + // Build the new graph + // walk over all edges and combine as needed + {for (SEdgeIter iter(the_sgraph->get_edge_iterator()); + !iter.done(); + iter.increment()) { + SGraphEdge edge = iter.current(); + SGraphEdge bb_edge(bb_pred->eval(edge.from()), + bb_pred->eval(edge.to())); + if ((bb_edge.from() != bb_edge.to()) + || (edge.from() == edge.to())) + bb_graph->add_edge(bb_edge); + }} +} + +void SGraphAlgsHelper::find_entries_exits(const SGraph *the_sgraph, + SGraphNodeList &entries, + SGraphNodeList &exits) { + for (SNodeIter iter(the_sgraph->get_node_iterator()); + !iter.done(); + iter.increment()) { + SGraphNode node = iter.current(); + if (!the_sgraph->node_has_predecessors(node)) { + entries.push_back(node); + } + if (!the_sgraph->node_has_successors(node)) { + exits.push_back(node); + } + } +} -class SuifEnv; extern "C" void init_sgraph_algs(SuifEnv *s) { - s->require_module("sgraph"); + s->require_DLL("sgraph"); } diff -Nur nci/suif/suif2b/extratypes/sgraph_algs/sgraph_algs.h nci-latest/suif/suif2b/extratypes/sgraph_algs/sgraph_algs.h --- nci/suif/suif2b/extratypes/sgraph_algs/sgraph_algs.h Tue Jun 27 17:53:59 2000 +++ nci-latest/suif/suif2b/extratypes/sgraph_algs/sgraph_algs.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef GRAPH_ALGS_H #define GRAPH_ALGS_H @@ -28,7 +29,7 @@ ordered_sgraph_visitor(const SGraph *the_sgraph, bool do_forward); virtual ~ordered_sgraph_visitor(); - void reset(const SGraph *the_sgraph, bool do_forward); + void reset(const SGraph *the_sgraph, bool do_forward, bool reset_visited = true); // depth-first postorder void visit_postorder(SGraphNode node); @@ -93,12 +94,12 @@ SGraphNodeList * build_reverse_postorder_list(const SGraph *the_sgraph, SGraphNode node, - bool do_forward); + bool do_forward, bool reverse_list); SGraphNodeList * build_reverse_postorder_list(const SGraph *the_sgraph, const SGraphNodeList *entries, - bool do_forward); + bool do_forward, bool reverse_list); void build_dominators(SGraphBit *df, const SGraph *reachable, @@ -190,12 +191,37 @@ /** Export non-named dot, unlike the following two functions. */ +#if 0 void export_dot(const SGraph *the_sgraph, ion *out); void export_named_dot(const SGraph *the_sgraph, ion *out, - suif_vector *node_name_map); + suif_vector *node_name_map, String graph_name = ""); + +void export_named_dot(suif_list& graphs, ion *out, + suif_vector *node_name_map, suif_list& graph_names); void print_named(const SGraph *the_sgraph, ion *out, suif_vector *node_name_map); +#endif + +class SGraphAlgsHelper { +public: + /* Create a new graph bb_graph + * where the basic blocks are replaced by a single + * node + * The bb_pred will map the old node to a new node + */ + static void simplify_basic_blocks(const SGraph *the_sgraph, + SGraph *bb_graph, + SGraphLinkEval *bb_pred); + + + static void find_entries_exits(const SGraph *the_sgraph, + SGraphNodeList &entries, + SGraphNodeList &exits); + + + +}; #endif /* GRAPH_ALGS_H */ diff -Nur nci/suif/suif2b/extratypes/sgraph_algs/sgraph_algs_forwarders.h nci-latest/suif/suif2b/extratypes/sgraph_algs/sgraph_algs_forwarders.h --- nci/suif/suif2b/extratypes/sgraph_algs/sgraph_algs_forwarders.h Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/sgraph_algs/sgraph_algs_forwarders.h Wed Feb 13 10:26:07 2002 @@ -0,0 +1,10 @@ +#ifndef SGRAPH_ALGS_FORWARDERS_H +#define SGRAPH_ALGS_FORWARDERS_H + +class DFBuild; +class SuifEnv; +class TarjanDFBuild; + +extern "C" void init_sgraph_algs(SuifEnv *s); + +#endif /* SGRAPH_ALGS_FORWARDERS_H */ diff -Nur nci/suif/suif2b/extratypes/sgraph_algs/standard_main.cpp nci-latest/suif/suif2b/extratypes/sgraph_algs/standard_main.cpp --- nci/suif/suif2b/extratypes/sgraph_algs/standard_main.cpp Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/sgraph_algs/standard_main.cpp Wed Feb 13 10:26:07 2002 @@ -0,0 +1,33 @@ +// This file was automatically build by +// /sow/16/16/livshits/work/src/nci/build_main.pl '-lsuifkernel -liokernel -lcommon -lion -lsgraph -lbit_vector' +// from the $(LIBS} variable in the Makefile +// +#include "suifkernel/suifkernel_forwarders.h" +#include "suifkernel/suif_env.h" +#include "suifkernel/module_subsystem.h" +#include "suifkernel/token_stream.h" +#include "suifpasses/suifpasses.h" + + +int main( int argc, char* argv[] ) { + // initialize the environment + SuifEnv* suif = new SuifEnv; + suif->init(); + + // import and initialize the necessary libraries + suif->require_DLL("ion"); + suif->require_DLL("sgraph"); + suif->require_DLL("bit_vector"); + + // transform the input arguments into a stream of + // input tokens + TokenStream token_stream( argc, argv ); + + // execute the Module "execute" + ModuleSubSystem* mSubSystem = suif->get_module_subsystem(); + mSubSystem -> execute( "execute", &token_stream ); + + delete suif; + + return 0; +} diff -Nur nci/suif/suif2b/extratypes/sgraph_algs/tarjan_dominator.cpp nci-latest/suif/suif2b/extratypes/sgraph_algs/tarjan_dominator.cpp --- nci/suif/suif2b/extratypes/sgraph_algs/tarjan_dominator.cpp Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/sgraph_algs/tarjan_dominator.cpp Wed Feb 13 10:26:07 2002 @@ -0,0 +1,450 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +#include "tarjan_dominator.h" +#include +#include +#include +#include +#include +#include +#include "sgraph/sgraph_bit_subgraph.h" +#include +#include "sgraph_algs.h" +#include + +SGraphForest *TarjanDominator::build_immed_dominators(const SGraph *reachable, + SGraphNodeList *entries, + bool do_forward) +{ + DFSBuilder dfs_builder(reachable, entries, do_forward); + return(build_immed_dominators(&dfs_builder, + reachable, entries, do_forward)); +} + +static void t_compress(suif_vector &path_min, + SGraphForest &forest, + suif_vector &semi_dom_dfs, + DFSId dfs_id); + + +static DFSId t_eval(suif_vector &path_min, + SGraphForest &forest, + // const DFSBuilder *forestdfs_builder, + // SGraphLinkEval &min_dfs_id, + suif_vector &semi_dom_dfs, + DFSId dfs_id) { + if (!forest.is_root(dfs_id.get_value())) { + t_compress(path_min, forest, semi_dom_dfs, dfs_id); + } + return(path_min[dfs_id.get_value()]); +} + +static void t_compress(suif_vector &path_min, + SGraphForest &forest, + suif_vector &semi_dom_dfs, + DFSId dfs_id) { + DFSId parent_id = (DFSId)forest.get_parent(dfs_id.get_value()); + + if (!forest.is_root(parent_id.get_value())) { + t_compress(path_min, forest, semi_dom_dfs, parent_id); + if (semi_dom_dfs[path_min[parent_id.get_value()].get_value()] < + semi_dom_dfs[path_min[dfs_id.get_value()].get_value()]) { + path_min[dfs_id.get_value()] = path_min[parent_id.get_value()]; + } + + forest.set_parent(dfs_id.get_value(), forest.get_parent(parent_id.get_value())); + } + +} + +static void t_link(SGraphForest &forest, + DFSId dfs_id, DFSId parent_id) { + forest.set_parent(dfs_id.get_value(), parent_id.get_value()); +} + + +SGraphForest *TarjanDominator::build_immed_dominators(const DFSBuilder *dfs_builder, + const SGraph *reachable, + SGraphNodeList *entries, + bool do_forward) +{ + // Ignore do_forward for now... + + + size_t node_cnt = dfs_builder->get_dfs_count(); + // build the dfs order. + + // Build the semi-dom map to compute semi-dom with: + suif_vector dom_dfs(node_cnt, (DFSId)0); + suif_vector semi_dom_dfs(node_cnt, (DFSId)0); + for (size_t cnt = 0; cnt < node_cnt; cnt++) { + semi_dom_dfs[cnt] = (DFSId)cnt; + } + + // Keep the DFS ID-> Min DFS number computation + // SGraphLinkEval min_dfs_id; + SGraphForest forest; + + suif_vector path_min(node_cnt, (DFSId)0); + {for (size_t i = 0; i < node_cnt; i++) { + path_min[i] = (DFSId)i; + }} + + suif_vector *> bucket(node_cnt, NULL); + // build as needed + + // walk in reverse DFS order + for (size_t r_cnt = 0; r_cnt < node_cnt; r_cnt++) { + DFSId w_id = (DFSId)(node_cnt - r_cnt - 1); + // foreach predecessor + // If the predecessor sdom DFS number is + SGraphNode w = dfs_builder->get_node(w_id); + SNodeIter pred_iter(reachable->get_node_predecessor_iterator(w, do_forward)); + for (;!pred_iter.done(); pred_iter.increment()) { + SGraphNode v = pred_iter.get(); + DFSId v_id = dfs_builder->get_dfs(v); + + DFSId u_id = t_eval(path_min, forest, semi_dom_dfs, v_id); + + if (semi_dom_dfs[u_id.get_value()] < semi_dom_dfs[w_id.get_value()]) { + semi_dom_dfs[w_id.get_value()] = semi_dom_dfs[u_id.get_value()]; + } + + DFSId nd = semi_dom_dfs[w_id.get_value()]; + if (bucket[nd.get_value()] == NULL) { + bucket[nd.get_value()] = new suif_list; + } + bucket[nd.get_value()]->push_back(w_id); + + if (!dfs_builder->is_dfs_root(w_id)) { + t_link(forest, + w_id, + dfs_builder->get_dfs_parent_dfs(w_id)); + + } + } + DFSId w_parent = w_id; + if (!dfs_builder->is_dfs_root(w_id)) { + w_parent = dfs_builder->get_dfs_parent_dfs(w_id); + } + { + suif_list *blst = bucket[w_parent.get_value()]; + if (blst) { + while (!blst->empty()) { + DFSId v_id = blst->back(); + blst->pop_back(); + DFSId u_id = t_eval(path_min, forest, semi_dom_dfs, v_id); + if (semi_dom_dfs[u_id.get_value()] < semi_dom_dfs[v_id.get_value()]) + dom_dfs[v_id.get_value()] = u_id; + else + dom_dfs[v_id.get_value()] = w_parent; + } + } + } + } + SGraphForest *idom = new SGraphForest; + {for (size_t i = 0; i < node_cnt; i++) { + DFSId i_id = (DFSId)i; + if (dom_dfs[i] != semi_dom_dfs[i]) { + dom_dfs[i] = dom_dfs[dom_dfs[i].get_value()]; + } + // translate back to nodes. + if (dfs_builder->get_node(i_id) == + dfs_builder->get_node(dom_dfs[i])) { + idom->set_root(dfs_builder->get_node(i_id)); + } else { + idom->set_parent(dfs_builder->get_node(i_id), + dfs_builder->get_node(dom_dfs[i])); + } + }} + delete_list_elements(&bucket); + return(idom); + // We have idom! +} + +SGraph *TarjanDominator:: +build_dominance_frontier(const SGraph *reachable, + //const SGraphNodeList *entries, + const DFSBuilder *dfs_builder, + const SGraphForest *idom, + bool do_forward) { + SGraphList *fast_idom = new SGraphList; + SGraphHelper::copy_graph(idom, fast_idom); // to get children quickly + + SGraphBit *df = new SGraphBit; + // relation is from node to its dominance frontier + size_t node_count = dfs_builder->get_dfs_count(); + for (size_t i = 0; i < node_count; ++i) { + DFSId dfs_node = (DFSId)(node_count - i - 1); + SGraphNode snode = dfs_builder->get_node(dfs_node); + df->add_node(snode); + + {for (SNodeIter succ_iter(reachable->get_node_successor_iterator(snode, do_forward)); + !succ_iter.done(); succ_iter.increment()) { + SGraphNode v = succ_iter.get(); + // 1) If I am not the idom of the successor + if (idom->get_parent(v) != snode) { + df->add_node(snode); + df->add_node(v); + df->add_edge(SGraphEdge(snode, v)); + } + }} + + // + {for (SNodeIter succ_iter(fast_idom->get_node_predecessor_iterator(snode)); + !succ_iter.done(); succ_iter.increment()) { + SGraphNode child = succ_iter.get(); + + for (SNodeIter child_iter(df->get_node_successor_iterator(child)); + !child_iter.done(); child_iter.increment()) { + SGraphNode v = child_iter.get(); + if (idom->get_parent(v) != snode) { + df->add_node(snode); + df->add_node(v); + // adding to df here is OK because + // the child + df->add_edge(SGraphEdge(snode, v)); + } + } + }} + } + delete fast_idom; + return(df); +} + +SGraph *TarjanDominator:: +build_dominators(const DFSBuilder *dfs_builder, + const SGraphForest *idom, + bool do_forward) { + SGraphBit *dom = new SGraphBit; + // relation is from node to its dominance frontier + size_t node_count = dfs_builder->get_dfs_count(); + for (size_t i = 0; i < node_count; ++i) { + DFSId dfs_node = (DFSId)(node_count - i - 1); + SGraphNode snode = dfs_builder->get_node(dfs_node); + SGraphNode parent = snode; + dom->add_node(snode); + + dom->add_edge(SGraphEdge(parent, snode)); + while (!idom->is_root(parent)) { + parent = idom->get_parent(parent); + dom->add_node(parent); + dom->add_edge(SGraphEdge(snode, parent)); + } + } + return(dom); +} + +DFSBuilder::DFSBuilder(const SGraph *the_sgraph, + const SGraphNodeList *entries, + bool do_forward) : + _the_sgraph(the_sgraph), + _entries(entries), + _do_forward(do_forward), + _dfs_to_node(new SGraphNodeMap(0)), + _node_to_dfs(new SGraphNodeMap((DFSId)0)), + _dfs_forest(new SGraphForest), + _visited(new BitVector), + _next_dfs_id(0) +{ + for (SGraphNodeList::const_iterator iter = entries->begin(); + iter != entries->end(); ++iter) { + SGraphNode node = *iter; + + if (_visited->get_bit(node)) + continue; + + add_root(node); + } +} + +DFSId DFSBuilder::get_dfs(SGraphNode node) const { + return(_node_to_dfs->get_value(node)); +} + +size_t DFSBuilder::get_dfs_count() const { + return(_next_dfs_id); +} + +void DFSBuilder::print(ion *the_ion) const { + _dfs_forest->print(the_ion); +} + +SGraphNode DFSBuilder::get_node(DFSId dfs_num) const { + return(_dfs_to_node->get_value(dfs_num.get_value())); +} + +DFSBuilder::~DFSBuilder() { + delete _dfs_forest; + delete _node_to_dfs; + delete _dfs_to_node; +} + + +bool DFSBuilder::is_dfs_root(DFSId dfs_num) const { + return(_dfs_forest->is_root(dfs_num.get_value())); +} + +DFSId DFSBuilder::get_dfs_parent_dfs(DFSId dfs_num) const { + return((DFSId)_dfs_forest->get_parent(dfs_num.get_value())); +} + +SGraphNode DFSBuilder::get_node_parent_node(SGraphNode node) const { + DFSId dfs_node = get_dfs(node); + DFSId dfs_parent_dfs = (DFSId)_dfs_forest->get_parent(dfs_node.get_value()); + SGraphNode parent_node = get_node(dfs_parent_dfs); + return(parent_node); +} + + +void DFSBuilder::add_root(SGraphNode node) +{ + suif_assert(!_visited->get_bit(node)); + _dfs_to_node->set_value(_next_dfs_id, node); + _node_to_dfs->set_value(node, (DFSId)_next_dfs_id); + _dfs_forest->set_root(node); + _next_dfs_id++; + _visited->set_bit(node, true); + + for (SNodeIter iter(_the_sgraph->get_node_successor_iterator(node)); + !iter.done(); iter.increment()) { + SGraphNode child = iter.get(); + if (_visited->get_bit(child)) + continue; + + add_child(node, child); + } +} + +void DFSBuilder::add_child(SGraphNode parent, SGraphNode child) +{ + suif_assert(!_visited->get_bit(child)); + + _dfs_to_node->set_value(_next_dfs_id, child); + _node_to_dfs->set_value(child, (DFSId)_next_dfs_id); + _dfs_forest->set_parent(_node_to_dfs->get_value(child).get_value(), + _node_to_dfs->get_value(parent).get_value()); + _next_dfs_id++; + _visited->set_bit(child, true); + + for (SNodeIter iter(_the_sgraph->get_node_successor_iterator(child)); + !iter.done(); iter.increment()) { + SGraphNode next_child = iter.get(); + if (_visited->get_bit(next_child)) + continue; + + add_child(child, next_child); + } +} + + +static void print_node_list(FILE *fp, SGraphNodeList *l) { + for (SGraphNodeList::iterator iter = l->begin(); + iter != l->end(); iter++) { + SGraphNode node = *iter; + fprintf(fp, "%d ", node); + } +} + +TarjanDFBuild::~TarjanDFBuild() { +} + +TarjanDFBuild::TarjanDFBuild(const SGraph *graph, + SGraphNode entry, + SGraphNode the_exit) : + DFBuild(graph, entry, the_exit), + _dfs_builder(NULL) +{ + +} + +void TarjanDFBuild::do_build_dominators() { + if (_dominators != NULL) return; + do_build_reachable(); + do_build_immediate_dominators(); + + _dominators = + TarjanDominator::build_dominators(_dfs_builder, + _immediate_dominators, + true); + + if (_verbose_level > 0) { + printf("BEGIN: TarjanDFBuild::_dominators\n"); + _dominators->print(stdout_ion); + printf("END: TarjanDFBuild::_dominators\n"); + } +} + + +void TarjanDFBuild::do_build_dominance_frontier() { + if (_dominance_frontier != NULL) return; + do_build_reachable(); + // do_build_dominators(); + do_build_immediate_dominators(); + + _dominance_frontier = + TarjanDominator::build_dominance_frontier(_reachable, + _dfs_builder, + _immediate_dominators, + true); + + if (_verbose_level > 0) { + printf("BEGIN: TarjanDFBuild::_dominance_frontier\n"); + _dominance_frontier->print(stdout_ion); + printf("END: TarjanDFBuild::_dominance_frontier\n"); + } +} + + +void TarjanDFBuild::do_build_iterated_dominance_frontier() { + if (_iterated_dominance_frontier != NULL) return; + do_build_dominance_frontier(); + + SGraphBit *idf = new SGraphBit; + idf->add_nodes_from_sgraph(_reachable); + + build_iterated_dominance_frontiers(idf, + _reachable, + _dominance_frontier); + _iterated_dominance_frontier = idf; + if (_verbose_level > 0) { + printf("BEGIN: TarjanDFBuild::_iterated_dominance_frontier\n"); + _iterated_dominance_frontier->print(stdout_ion); + printf("END: TarjanDFBuild::_iterated_dominance_frontier\n"); + } +} + +void TarjanDFBuild::do_build_immediate_dominators() { + // if (_dominators != NULL) return; + if (_immediate_dominators != NULL) return; + do_build_reachable(); + do_build_dfs(); + + _immediate_dominators = + TarjanDominator::build_immed_dominators(_dfs_builder, + _reachable, + _entries, + true); + + if (_verbose_level > 0) { + printf("BEGIN: TarjanDFBuild::_dominators\n"); + _immediate_dominators->print(stdout_ion); + printf("END: TarjanDFBuild::_dominators\n"); + } +} + +void TarjanDFBuild::do_build_dfs() { + if (_dfs_builder != NULL) return; + do_build_reachable(); + + _dfs_builder = + new DFSBuilder(_reachable, + _entries, + true); + + if (_verbose_level > 0) { + printf("BEGIN: TarjanDFBuild::_dfs_builder\n"); + //_dfs_builder->print(stdout_ion); + printf("END: TarjanDFBuild::_dfs_builder\n"); + } +} diff -Nur nci/suif/suif2b/extratypes/sgraph_algs/tarjan_dominator.h nci-latest/suif/suif2b/extratypes/sgraph_algs/tarjan_dominator.h --- nci/suif/suif2b/extratypes/sgraph_algs/tarjan_dominator.h Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/sgraph_algs/tarjan_dominator.h Wed Feb 13 10:26:07 2002 @@ -0,0 +1,131 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Implementation of Tarjan's algorithm for computing dominators + * This has been lifted pretty closely from + * "Computing Dominators and Dominance Frontiers" + * Preston Briggs and Tim Harvey. + * It has been modified to add many extra levels of indirection. + */ + + +#ifndef DOM_TARJAN_H +#define DOM_TARJAN_H + +#include +#include +#include +#include +#include +#include "cfgraph_algs.h" + +class DFSId { + size_t _val; +public: + DFSId() { + } + bool operator<(const DFSId &other) { + return(_val < other._val); + } + + explicit DFSId(size_t val) : + _val(val) + {} + + size_t get_value(void) const { + return(_val); + } + + DFSId &operator=(const DFSId &other) { + _val = other._val; + return(*this); + } + bool operator==(const DFSId &other) { + return(_val == other._val); + } + bool operator!=(const DFSId &other) { + return(_val != other._val); + } + + + DFSId(const DFSId &other) : + _val(other._val) + {} +}; + + +//typedef size_t DFSId; + +class DFSBuilder { + const SGraph *_the_sgraph; + const SGraphNodeList *_entries; + bool _do_forward; + + SGraphNodeMap *_dfs_to_node; + SGraphNodeMap *_node_to_dfs; + SGraphForest *_dfs_forest; // This uses the dfs number + +public: + DFSBuilder(const SGraph *the_sgraph, + const SGraphNodeList *entries, + bool do_forward); + ~DFSBuilder(); + + // dfs->node and node->dfs + DFSId get_dfs(SGraphNode node) const; + SGraphNode get_node(DFSId dfs_num) const; + + bool is_dfs_root(DFSId dfs_num) const; + DFSId get_dfs_parent_dfs(DFSId dfs_num) const; + SGraphNode get_node_parent_node(SGraphNode node) const; + + size_t get_dfs_count() const; + + void print(ion *the_ion) const; + +protected: + void add_root(SGraphNode node); + void add_child(SGraphNode parent, SGraphNode child); + // used for computing dfs + BitVector *_visited; + size_t _next_dfs_id; +}; + + +class TarjanDominator { +public: + static SGraphForest *build_immed_dominators(const SGraph *reachable, + SGraphNodeList *entries, + bool do_forward); + static SGraphForest *build_immed_dominators(const DFSBuilder *dfs_builder, + const SGraph *reachable, + SGraphNodeList *entries, + bool do_forward); + static SGraph *build_dominance_frontier(const SGraph *reachable, + // const SGraphNodeList *entries, + const DFSBuilder *dfs_builder, + const SGraphForest *idom, + bool do_forward); + static SGraph *build_dominators(//const SGraph *reachable, + const DFSBuilder *dfs_builder, + const SGraphForest *idom, + bool do_forward); +}; + + +class TarjanDFBuild : public DFBuild { + DFSBuilder *_dfs_builder; +public: + TarjanDFBuild(const SGraph *graph, SGraphNode entry, SGraphNode the_exit); + ~TarjanDFBuild(); + + void do_build_dfs(); + void do_build_dominators(); + void do_build_immediate_dominators(); + void do_build_dominance_frontier(); + void do_build_iterated_dominance_frontier(); + + SGraphNode get_immed_dom(SGraphNode node) const; +}; + + +#endif /* DOM_TARJAN_H */ diff -Nur nci/suif/suif2b/extratypes/sgraph_dot/Makefile nci-latest/suif/suif2b/extratypes/sgraph_dot/Makefile --- nci/suif/suif2b/extratypes/sgraph_dot/Makefile Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/sgraph_dot/Makefile Wed Feb 13 10:26:07 2002 @@ -0,0 +1,37 @@ +#PASS_DRIVER = dummy_sgraph_dot +PROGRAM = sgraph_dot_test +#MAIN_OBJ = standard_main.o +MAIN_OBJ = sdmain.o + +TARGET_LIB = sgraph_dot + +# The primary interfaces here are: +# sgraph and ngraph + +# These provide the interfaces +# ngraph.cpp is included because ngraph.h includes it. +HEADERS = sgraph_dot.h + +# implementations are sgraph_bit or sgraph_list +SRCS = sgraph_dot.cpp \ + sdmain.cpp +# standard_main.cpp + +#OBJ_FILES = $(SRCS:.cpp=.o) +OBJ_FILES = sgraph_dot.o + +LIBS += -lsuifkernel -liokernel -lcommon +LIBS += -lion -lbit_vector -lsgraph -lsgraph_algs + +EXTRA_CXXFLAGS += -DINLINE_ALL_TEMPLATES + +#EXTRA_CXXFLAGS += -Weffc++ + + +include $(NCIHOME)/Makefile.std + +testit: + $(PROGRAM) bdom.dot + $(PROGRAM) bdom2.dot + $(PROGRAM) bdom3.dot + $(PROGRAM) bdom4.dot diff -Nur nci/suif/suif2b/extratypes/sgraph_dot/Makefile.deps nci-latest/suif/suif2b/extratypes/sgraph_dot/Makefile.deps --- nci/suif/suif2b/extratypes/sgraph_dot/Makefile.deps Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/sgraph_dot/Makefile.deps Wed Feb 13 10:26:07 2002 @@ -0,0 +1,24 @@ +# Dependencies for C files + +# Dependencies for C files + +CPP_TO_O_RULE = defined +C_TO_O_RULE = defined + +%.o: %.cpp %.cxx %.cc + -echo Can not build $*.o from $< without explicit dependency + -echo The Makefile.deps file was incorrectly generated + -echo All .o dependencies should be explicit in that file + +$(OBJDIR)/$(TARGET_LIB)/sdmain.o: sdmain.cpp sgraph_dot.h /sow/16/16/livshits/work/src/nci/include/common/common_forwarders.h /sow/16/16/livshits/work/src/nci/include/sgraph/sgraph_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/machine_dependent.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h /sow/16/16/livshits/work/src/nci/include/sgraph_algs/sgraph_algs.h /sow/16/16/livshits/work/src/nci/include/bit_vector/bit_vector_forwarders.h /sow/16/16/livshits/work/src/nci/include/sgraph/sgraph.h /sow/16/16/livshits/work/src/nci/include/common/suif_copyright.h /sow/16/16/livshits/work/src/nci/include/ion/ion_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/suif_list.h /sow/16/16/livshits/work/src/nci/include/sgraph/sgraph_iter.h /sow/16/16/livshits/work/src/nci/include/sgraph/ngraph.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_messages.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_forwarders.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/MString.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h /sow/16/16/livshits/work/src/nci/include/common/simple_stack.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_messages.h /sow/16/16/livshits/work/src/nci/include/sgraph/sgraph_bit.h /sow/16/16/livshits/work/src/nci/include/sgraph/sgraph_list.h /sow/16/16/livshits/work/src/nci/include/common/suif_vector.h /usr/include/g++-2/cstddef /sow/16/16/livshits/work/src/nci/include/suifkernel/suif_env.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h /sow/16/16/livshits/work/src/nci/include/sgraph_algs/tarjan_dominator.h /sow/16/16/livshits/work/src/nci/include/sgraph_algs/sgraph_algs_forwarders.h /sow/16/16/livshits/work/src/nci/include/sgraph/sgraph_node_map.h /sow/16/16/livshits/work/src/nci/include/sgraph_algs/cfgraph_algs.h /sow/16/16/livshits/work/src/nci/include/sgraph/sgraph_helper.h /sow/16/16/livshits/work/src/nci/include/sgraph/sgraph_forest.h /sow/16/16/livshits/work/src/nci/include/ion/ion.h /usr/include/stdio.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/include/bits/stdio_lim.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/sdmain.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) sdmain.cpp + +$(OBJDIR)/$(TARGET_LIB)/sgraph_dot.o: sgraph_dot.cpp sgraph_dot.h /sow/16/16/livshits/work/src/nci/include/common/common_forwarders.h /sow/16/16/livshits/work/src/nci/include/sgraph/sgraph_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/machine_dependent.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h /sow/16/16/livshits/work/src/nci/include/common/MString.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h /sow/16/16/livshits/work/src/nci/include/common/simple_stack.h /sow/16/16/livshits/work/src/nci/include/common/i_integer.h /usr/include/stdio.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h /usr/include/bits/stdio_lim.h /sow/16/16/livshits/work/src/nci/include/common/suif_vector.h /usr/include/g++-2/cstddef /sow/16/16/livshits/work/src/nci/include/ion/ion.h /sow/16/16/livshits/work/src/nci/include/sgraph/sgraph_helper.h /sow/16/16/livshits/work/src/nci/include/ion/ion_forwarders.h /sow/16/16/livshits/work/src/nci/include/sgraph/sgraph.h /sow/16/16/livshits/work/src/nci/include/common/suif_copyright.h /sow/16/16/livshits/work/src/nci/include/common/suif_list.h /sow/16/16/livshits/work/src/nci/include/bit_vector/bit_vector_forwarders.h /sow/16/16/livshits/work/src/nci/include/sgraph/sgraph_iter.h /sow/16/16/livshits/work/src/nci/include/sgraph/sgraph_list.h /usr/include/unistd.h /usr/include/bits/posix_opt.h /usr/include/bits/confname.h /usr/include/getopt.h /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h /usr/include/endian.h /usr/include/bits/endian.h /usr/include/sys/select.h /usr/include/bits/select.h /usr/include/bits/sigset.h /usr/include/bits/time.h /usr/include/sys/sysmacros.h /usr/include/alloca.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/sgraph_dot.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) sgraph_dot.cpp + diff -Nur nci/suif/suif2b/extratypes/sgraph_dot/bad.dot nci-latest/suif/suif2b/extratypes/sgraph_dot/bad.dot --- nci/suif/suif2b/extratypes/sgraph_dot/bad.dot Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/sgraph_dot/bad.dot Wed Feb 13 10:26:07 2002 @@ -0,0 +1,12 @@ +digraph foo { +N0; +N1; +N2; +N3; +N4; +N0 -> N1; +N1 -> N2; +N2 -> N3; +N3 -> N4; +N3 -> N1; +} diff -Nur nci/suif/suif2b/extratypes/sgraph_dot/bdom.dot nci-latest/suif/suif2b/extratypes/sgraph_dot/bdom.dot --- nci/suif/suif2b/extratypes/sgraph_dot/bdom.dot Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/sgraph_dot/bdom.dot Wed Feb 13 10:26:07 2002 @@ -0,0 +1,15 @@ +digraph foo { +size = "8,10"; +label = getcodesgraph; +N0 [shape=box, label="N0"]; +N1 [shape=box, label="N1"]; +N2 [shape=box, label="N2"]; +N3 [shape=box, label="N3"]; +N4 [shape=box, label="N4"]; +N0 -> N1 +N0 -> N2 +N1 -> N2 +N1 -> N3 +N2 -> N4 +N3 -> N4 +} diff -Nur nci/suif/suif2b/extratypes/sgraph_dot/bdom2.dot nci-latest/suif/suif2b/extratypes/sgraph_dot/bdom2.dot --- nci/suif/suif2b/extratypes/sgraph_dot/bdom2.dot Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/sgraph_dot/bdom2.dot Wed Feb 13 10:26:07 2002 @@ -0,0 +1,199 @@ +digraph foo { +size = "8,10"; +label = getcodesgraph; +N2 [shape=box, label="N2"]; +N3 [shape=box, label="N3"]; +N4 [shape=box, label="N4"]; +N5 [shape=box, label="N5"]; +N6 [shape=box, label="N6"]; +N7 [shape=box, label="N7"]; +N8 [shape=box, label="N8"]; +N9 [shape=box, label="N9"]; +N10 [shape=box, label="N10"]; +N11 [shape=box, label="N11"]; +N12 [shape=box, label="N12"]; +N13 [shape=box, label="N13"]; +N14 [shape=box, label="N14"]; +N15 [shape=box, label="N15"]; +N16 [shape=box, label="N16"]; +N17 [shape=box, label="N17"]; +N18 [shape=box, label="N18"]; +N19 [shape=box, label="N19"]; +N20 [shape=box, label="N20"]; +N21 [shape=box, label="N21"]; +N22 [shape=box, label="N22"]; +N23 [shape=box, label="N23"]; +N24 [shape=box, label="N24"]; +N25 [shape=box, label="N25"]; +N26 [shape=box, label="N26"]; +N27 [shape=box, label="N27"]; +N28 [shape=box, label="N28"]; +N29 [shape=box, label="N29"]; +N30 [shape=box, label="N30"]; +N31 [shape=box, label="N31"]; +N32 [shape=box, label="N32"]; +N33 [shape=box, label="N33"]; +N34 [shape=box, label="N34"]; +N35 [shape=box, label="N35"]; +N36 [shape=box, label="N36"]; +N37 [shape=box, label="N37"]; +N38 [shape=box, label="N38"]; +N39 [shape=box, label="N39"]; +N40 [shape=box, label="N40"]; +N41 [shape=box, label="N41"]; +N42 [shape=box, label="N42"]; +N43 [shape=box, label="N43"]; +N44 [shape=box, label="N44"]; +N45 [shape=box, label="N45"]; +N46 [shape=box, label="N46"]; +N47 [shape=box, label="N47"]; +N48 [shape=box, label="N48"]; +N49 [shape=box, label="N49"]; +N50 [shape=box, label="N50"]; +N51 [shape=box, label="N51"]; +N52 [shape=box, label="N52"]; +N53 [shape=box, label="N53"]; +N54 [shape=box, label="N54"]; +N55 [shape=box, label="N55"]; +N56 [shape=box, label="N56"]; +N57 [shape=box, label="N57"]; +N58 [shape=box, label="N58"]; +N59 [shape=box, label="N59"]; +N60 [shape=box, label="N60"]; +N61 [shape=box, label="N61"]; +N62 [shape=box, label="N62"]; +N63 [shape=box, label="N63"]; +N64 [shape=box, label="N64"]; +N65 [shape=box, label="N65"]; +N66 [shape=box, label="N66"]; +N67 [shape=box, label="N67"]; +N68 [shape=box, label="N68"]; +N69 [shape=box, label="N69"]; +N70 [shape=box, label="N70"]; +N71 [shape=box, label="N71"]; +N72 [shape=box, label="N72"]; +N73 [shape=box, label="N73"]; +N74 [shape=box, label="N74"]; +N75 [shape=box, label="N75"]; +N76 [shape=box, label="N76"]; +N77 [shape=box, label="N77"]; +N78 [shape=box, label="N78"]; +N79 [shape=box, label="N79"]; +N80 [shape=box, label="N80"]; +N81 [shape=box, label="N81"]; +N82 [shape=box, label="N82"]; +N83 [shape=box, label="N83"]; +N84 [shape=box, label="N84"]; +N85 [shape=box, label="N85"]; +N86 [shape=box, label="N86"]; +N87 [shape=box, label="N87"]; +N88 [shape=box, label="N88"]; +N89 [shape=box, label="N89"]; +N90 [shape=box, label="N90"]; +N91 [shape=box, label="N91"]; +N92 [shape=box, label="N92"]; +N93 [shape=box, label="N93"]; +N94 [shape=box, label="N94"]; +N95 [shape=box, label="N95"]; +N2 -> N3 +N3 -> N4 +N4 -> N5 +N5 -> N6 +N6 -> N29 +N7 -> N8 +N8 -> N9 +N9 -> N10 +N10 -> N11 +N11 -> N12 +N12 -> N13 +N13 -> N14 +N14 -> N15 +N15 -> N16 +N16 -> N17 +N17 -> N18 +N18 -> N19 +N19 -> N20 +N20 -> N21 +N21 -> N22 +N22 -> N23 +N23 -> N35 +N24 -> N25 +N25 -> N26 +N26 -> N27 +N27 -> N28 +N28 -> N95 +N29 -> N30 +N29 -> N31 +N30 -> N38 +N31 -> N39 +N32 -> N33 +N32 -> N34 +N33 -> N42 +N34 -> N7 +N35 -> N36 +N35 -> N37 +N36 -> N63 +N37 -> N24 +N38 -> N32 +N39 -> N46 +N40 -> N32 +N41 -> N7 +N42 -> N49 +N43 -> N44 +N44 -> N45 +N45 -> N41 +N46 -> N47 +N46 -> N48 +N47 -> N64 +N48 -> N65 +N49 -> N50 +N49 -> N51 +N50 -> N66 +N51 -> N52 +N52 -> N53 +N53 -> N54 +N53 -> N55 +N54 -> N71 +N55 -> N70 +N56 -> N57 +N57 -> N59 +N58 -> N56 +N59 -> N60 +N59 -> N61 +N60 -> N43 +N61 -> N78 +N62 -> N24 +N63 -> N80 +N64 -> N40 +N65 -> N40 +N66 -> N67 +N67 -> N68 +N68 -> N87 +N69 -> N70 +N70 -> N75 +N71 -> N72 +N72 -> N73 +N73 -> N74 +N74 -> N69 +N75 -> N76 +N76 -> N58 +N77 -> N95 +N78 -> N77 +N79 -> N62 +N80 -> N81 +N81 -> N82 +N82 -> N83 +N83 -> N84 +N84 -> N85 +N85 -> N86 +N86 -> N79 +N87 -> N88 +N87 -> N89 +N88 -> N91 +N89 -> N93 +N90 -> N52 +N91 -> N90 +N92 -> N52 +N93 -> N92 +N94 -> N2 +} diff -Nur nci/suif/suif2b/extratypes/sgraph_dot/bdom3.dot nci-latest/suif/suif2b/extratypes/sgraph_dot/bdom3.dot --- nci/suif/suif2b/extratypes/sgraph_dot/bdom3.dot Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/sgraph_dot/bdom3.dot Wed Feb 13 10:26:07 2002 @@ -0,0 +1,15 @@ +digraph foo { +size = "8,10"; +label = getcodesgraph; +N0 [shape=box, label="N0"]; +N1 [shape=box, label="N1"]; +N2 [shape=box, label="N2"]; +N3 [shape=box, label="N3"]; +N4 [shape=box, label="N4"]; +N0 -> N2 +N0 -> N1 +N1 -> N4 +N2 -> N4 +N3 -> N0 +N3 -> N1 +} diff -Nur nci/suif/suif2b/extratypes/sgraph_dot/bdom4.dot nci-latest/suif/suif2b/extratypes/sgraph_dot/bdom4.dot --- nci/suif/suif2b/extratypes/sgraph_dot/bdom4.dot Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/sgraph_dot/bdom4.dot Wed Feb 13 10:26:07 2002 @@ -0,0 +1,15 @@ +digraph foo { +size = "8,10"; +label = getcodesgraph; +N0 [shape=box, label="N0"]; +N1 [shape=box, label="N1"]; +N2 [shape=box, label="N2"]; +N3 [shape=box, label="N3"]; +N4 [shape=box, label="N4"]; +N0 -> N1 +N0 -> N4 +N1 -> N2 +N1 -> N4 +N2 -> N3 +N4 -> N3 +} diff -Nur nci/suif/suif2b/extratypes/sgraph_dot/cfg.dot nci-latest/suif/suif2b/extratypes/sgraph_dot/cfg.dot --- nci/suif/suif2b/extratypes/sgraph_dot/cfg.dot Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/sgraph_dot/cfg.dot Wed Feb 13 10:26:07 2002 @@ -0,0 +1,30 @@ +digraph foo { +size = "8,10"; +label = "main"; +N0 [shape=box]; +N1 [shape=box]; +N2 [shape=box]; +N3 [shape=box]; +N4 [shape=box]; +N5 [shape=box]; +N6 [shape=box]; +N7 [shape=box]; +N8 [shape=box]; +N9 [shape=box]; +N10 [shape=box]; +N11 [shape=box]; +N12 [shape=box]; +N0 -> N1 [id=1]; +N1 -> N11 [id=1]; +N2 -> N3 [id=1]; +N3 -> N0 [id=1]; +N4 -> N2 [id=1]; +N5 -> N6 [id=1]; +N5 -> N4 [id=1]; +N6 -> N12 [id=1]; +N7 -> N5 [id=1]; +N8 -> N7 [id=1]; +N9 -> N10 [id=1]; +N10 -> N12 [id=1]; +N12 -> N8 [id=1]; +} diff -Nur nci/suif/suif2b/extratypes/sgraph_dot/sdmain.cpp nci-latest/suif/suif2b/extratypes/sgraph_dot/sdmain.cpp --- nci/suif/suif2b/extratypes/sgraph_dot/sdmain.cpp Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/sgraph_dot/sdmain.cpp Wed Feb 13 10:26:07 2002 @@ -0,0 +1,234 @@ +#include "sgraph_dot.h" +#include +#include +#include +#include +#include +#include +#include +#include + +static bool test_idom(const SGraph *g, + SGraphNode the_entry, + SGraphNode the_exit) { + SimpleDFBuild df_build(g, the_entry, the_exit); + df_build.do_build_immediate_dominators(); + SGraph *df_idom = df_build.get_immediate_dominators(); + + TarjanDFBuild t_build(g, the_entry, the_exit); + t_build.do_build_immediate_dominators(); + SGraph *t_idom = t_build.get_immediate_dominators(); + + bool success = SGraphHelper::is_same_graph(t_idom, df_idom); + return(success); +} + +static bool test_df(const SGraph *g, + SGraphNode the_entry, + SGraphNode the_exit) { + SimpleDFBuild df_build(g, the_entry, the_exit); + df_build.do_build_dominance_frontier(); + SGraph *df_idom = df_build.get_dominance_frontier(); + + TarjanDFBuild t_build(g, the_entry, the_exit); + t_build.do_build_dominance_frontier(); + SGraph *t_idom = t_build.get_dominance_frontier(); + + bool success = SGraphHelper::is_same_graph(t_idom, df_idom); + return(success); +} + +static bool get_entry_exit(const SGraph *g, + SGraphNode &the_entry, + SGraphNode &the_exit) { + + + SGraphNodeList entries; + SGraphNodeList exits; + + SGraphAlgsHelper::find_entries_exits(g, entries, exits); + if (entries.size() == 0) { + fprintf(stderr, "No entry\n"); + return(false); + } + if (exits.size() == 0) { + fprintf(stderr, "No exits\n"); + return(false); + } + + if (entries.size() != 1) { + fprintf(stderr, "Too many entries: "); + for (SGraphNodeList::iterator iter = entries.begin(); + iter != entries.end(); ++iter) { + fprintf(stderr, " %d", *iter); + } + fprintf(stderr, "\n"); + return(false); + } + + if (exits.size() != 1) { + fprintf(stderr, "Too many exits\n"); + for (SGraphNodeList::iterator iter = exits.begin(); + iter != exits.end(); ++iter) { + fprintf(stderr, " %d", *iter); + } + fprintf(stderr, "\n"); + return(false); + } + the_entry = *entries.begin(); + the_exit = *exits.begin(); + return(true); +} + +int main(int argc, const char *argv[]) { + SuifEnv *env = create_suif_env(); + env->require_DLL("bit_vector"); + env->require_DLL("sgraph"); + env->require_DLL("sgraph_algs"); + + if (argc < 2) { + fprintf(stdout, "Usage: %s dotfile\n", argv[0]); + exit(1); + } + + bool success = true; + + String filename = argv[1]; + + DotGraph dg; + dg.read(filename); + const SGraph *g = dg.get_graph(); + SGraphNode the_entry; + SGraphNode the_exit; + + if (get_entry_exit(g, the_entry, the_exit) == false) { + exit(1); + } + + if (test_idom(g, the_entry, the_exit) == false) { + + SGraph *bad_g = new SGraphList; + SGraphHelper::copy_graph(g, bad_g); + + + bool changed = true; + while (changed) { + changed = false; + + SGraphNodeList *nlist = bad_g->new_node_list(); + for (SGraphNodeList::iterator iter = nlist->begin(); + iter != nlist->end(); ++iter) { + SGraphNode node = *iter; + if ((node == the_entry) || (node == the_exit)) { + continue; + } + SGraph *test_g = new SGraphList; + SGraphHelper::copy_graph(bad_g, test_g); + SGraphHelper::eliminate(test_g, node); + + if (test_idom(test_g, the_entry, the_exit) == false) { + delete bad_g; + bad_g = test_g; + //fprintf(stderr, "eliminate %d\n", node); + changed = true; + + if (get_entry_exit(g, the_entry, the_exit) == false) { + exit(1); + } + + } else { + delete test_g; + } + } + delete nlist; + } + // Now we have eliminated as many nodes as we can + fprintf(stderr, "Bad idom\n"); + bad_g->print(stdout_ion); + success = false; + } + + if (success) { + if (test_df(g, the_entry, the_exit) == false) { + + SGraph *bad_g = new SGraphList; + SGraphHelper::copy_graph(g, bad_g); + + bool changed = true; + while (changed) { + changed = false; + + SGraphNodeList *nlist = bad_g->new_node_list(); + for (SGraphNodeList::iterator iter = nlist->begin(); + iter != nlist->end(); ++iter) { + SGraphNode node = *iter; + if ((node == the_entry) || (node == the_exit)) { + continue; + } + SGraph *test_g = new SGraphList; + SGraphHelper::copy_graph(bad_g, test_g); + SGraphHelper::eliminate(test_g, node); + + if (test_df(test_g, the_entry, the_exit) == false) { + delete bad_g; + bad_g = test_g; + //fprintf(stderr, "eliminate %d\n", node); + changed = true; + + if (get_entry_exit(g, the_entry, the_exit) == false) { + exit(1); + } + + } else { + delete test_g; + } + } + delete nlist; + } + // Now we have eliminated as many nodes as we can + fprintf(stderr, "Bad dominance frontier\n"); + bad_g->print(stdout_ion); + success = false; + } + } + + +#if 0 + + DFBuild df_build(g, the_entry, the_exit); + df_build.do_build_immediate_dominators(); + SGraph *df_idom = df_build.get_immediate_dominators(); + + TarjanDFBuild t_build(g, the_entry, the_exit); + t_build.do_build_immediate_dominators(); + SGraphForest *t_idom = t_build.get_immediate_dominators(); + + if (!SGraphHelper::is_same_graph(t_idom, df_idom)) + { + String name = "testing"; + // stdout_ion->put_s(name.c_str()); + stdout_ion->put_s(": IDom not the same\n"); + stdout_ion->put_s("graph\n"); + g->print(stdout_ion); + stdout_ion->put_s("idom\n"); + df_idom->print(stdout_ion); + stdout_ion->put_s("tarjan idom\n"); + t_idom->print(stdout_ion); + SGraphHelper::print_graph_diff(stdout_ion, t_idom, df_idom); + fprintf(stderr, "FAIL\n"); +#if 0 + SGraphDot::xprint_sgraph(df_idom, (name + "normal Dom").c_str(), 0); + SGraphDot::xprint_sgraph(t_idom, (name + "tarjan Dom").c_str(), 0); + SGraphDot::xprint_sgraph(g, (name + "sgraph").c_str(), 1); +#endif + } +#endif + + if (!success) { + fprintf(stderr, "FAIL\n"); + } else { + fprintf(stderr, "PASS\n"); + } + return(!success); +} + diff -Nur nci/suif/suif2b/extratypes/sgraph_dot/sgraph_dot.cpp nci-latest/suif/suif2b/extratypes/sgraph_dot/sgraph_dot.cpp --- nci/suif/suif2b/extratypes/sgraph_dot/sgraph_dot.cpp Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/sgraph_dot/sgraph_dot.cpp Wed Feb 13 10:26:07 2002 @@ -0,0 +1,208 @@ +#include "sgraph_dot.h" +#include +#include +#include +#include +#include +#include +#include + +/* This needs to be ported to other platforms + * for it to work + */ +#include +#include +#include + +int SGraphDot::exe_it(String exe) { + //fprintf(stderr, "%s\n", exe.c_str()); + int rv = system(exe.c_str()); + if (rv) { + fprintf(stderr, "Error: %s", exe.c_str()); + perror("Execution failed: "); + } + return(rv); +} + + + +int SGraphDot::xprint_dot(String filename, String psfile) { +#ifdef DOTEXE + String exe = String(DOTEXE); +#else + String exe = "dot"; +#endif + exe += String(" -Tps ") + filename + " > " + psfile; + return(exe_it(exe)); +} +int SGraphDot::xdisplay_dot(String psfile) { +#ifdef GVEXE + String exe = String(GVEXE); +#else + String exe = "gv"; +#endif + exe += String(" ") + psfile; + return(exe_it(exe)); +} +int SGraphDot::rm_file(String psfile) { +#ifdef RMEXE + String exe = String(GVEXE); +#else + String exe = "/bin/rm"; +#endif + exe += String(" ") + psfile; + return(exe_it(exe)); +} + +int SGraphDot::xprint_sgraph(const SGraph *the_sgraph, + const char *graph_name, + bool wait) { + return(xprint_named_sgraph(the_sgraph, NULL, graph_name, wait)); +} + +/* return 0 on success */ +/* use a const char * instead of a string to make it easier to + * call this from a debugger + */ +int SGraphDot::xprint_named_sgraph(const SGraph *the_sgraph, + const suif_vector *node_name_map, + const char *graph_name, + bool wait) { + + // fprintf(stderr, "print a relation\n"); + if (!wait) { + pid_t pid = fork(); + if (pid == -1) + return(1); + + if (pid != 0) // parent process + return(0); + } + + + /* child process if no-wait */ + pid_t pid = getpid(); + + String file = String("/tmp/sgraph-print-") + IInteger(pid).to_String(); + String psfile = file + ".ps"; + + // Should be checked!! + { + FILE *fp = fopen(file.c_str(), "w"); + if (fp == NULL) { + perror(file.c_str()); + return(-1); + } + + file_ion *out = new file_ion(fp); + SGraphHelper::export_named_dot(the_sgraph, + out, + node_name_map, + graph_name); + delete out; + fclose(fp); + } + + int rv; + rv = xprint_dot(file, psfile); + if (!rv) + rv = xdisplay_dot(psfile); + if (!rv) + rm_file(file); + if (!rv) + rm_file(psfile); + + + // If no-wait, then kill this child process + if (!wait) + exit(rv); + + return(rv); +} + + +DotGraph::DotGraph() : + _the_graph(new SGraphList), + _node_map(new suif_vector), + _graph_name(new String()) +{} + +DotGraph::~DotGraph() { + delete _the_graph; + delete _node_map; + delete _graph_name; +} + +static String read_line(FILE *fp) { + int c; + String line; + while ((c = fgetc(fp)) != -1) { + line += (char)c; + if (c == '\n') + return(line); + } + return(line); +} + +bool DotGraph::read(String filename) { + FILE *fp = fopen(filename.c_str(), "r"); + if (fp == NULL) { + perror(filename.c_str()); + return(false); + } + String graph_name; + // find the digraph .* { + // forget it. Read until the line starts with N + while (!feof(fp)) { + String line = read_line(fp); + const char *c_line = line.c_str(); + if (line.starts_with("label = ")) { + String graph_name = String(c_line + 8); + graph_name.trim_to_first(';'); + (*_graph_name) = graph_name; + } + if (line.starts_with("N")) { + String node_str = String(c_line + 1); + + // node_str.trim_to_first(' '); + const char *c_node_str = node_str.c_str(); + IInteger node_ii; + node_ii.read(c_node_str); + + size_t node = node_ii.c_size_t(); + + int where = line.find("-> N"); + if (where != -1) { + String other_node_str = (c_line + where + 4); + // other_node_str.trim_to_first('\n'); + const char *c_other_node_str = other_node_str.c_str(); + IInteger other_node_ii; + other_node_ii.read(c_other_node_str); + size_t other_node = other_node_ii.c_size_t(); + _the_graph->add_edge(SGraphEdge(node, other_node)); + } else { + _the_graph->add_node(node); +#if 0 + int where = line.find("label=\""); + if (where != -1) { + String label = (c_line + where + 7); + label.trim_to_first('\"'); + while (_node_map->size() <= node) { + _node_map->push_back(""); + } + (*_node_map)[node] = label; + } +#endif + } + } + } + if (0) { + _the_graph->print(stdout_ion); + } + return(true); +} + + +extern "C" void init_sgraph_dot(SuifEnv *s) { + +} diff -Nur nci/suif/suif2b/extratypes/sgraph_dot/sgraph_dot.h nci-latest/suif/suif2b/extratypes/sgraph_dot/sgraph_dot.h --- nci/suif/suif2b/extratypes/sgraph_dot/sgraph_dot.h Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/sgraph_dot/sgraph_dot.h Wed Feb 13 10:26:07 2002 @@ -0,0 +1,48 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +#ifndef SGRAPH_DOT +#define SGRAPH_DOT + +#include +#include + +class SGraphDot { +public: + static int exe_it(String exe); + static int rm_file(String psfile); + + static int xprint_dot(String filename, String psfile); + static int xdisplay_dot(String psfile); + + // use const char * instead of String + // so it can be easily called from a debugger + static int xprint_sgraph(const SGraph *the_sgraph, + const char *title, + bool wait); + + static int xprint_named_sgraph(const SGraph *the_sgraph, + const suif_vector *node_name_map, + const char *title, + bool wait); + +}; + + +class DotGraph { + SGraph *_the_graph; + suif_vector *_node_map; + String *_graph_name; +public: + DotGraph(); + DotGraph(const DotGraph &); + const SGraph *get_graph() const { return (_the_graph); } + DotGraph &operator=(const DotGraph &); + ~DotGraph(); + // return success + bool read(String filename); +}; + + + + + +#endif /* SGRAPH_DOT */ diff -Nur nci/suif/suif2b/extratypes/string_enum/Makefile.deps nci-latest/suif/suif2b/extratypes/string_enum/Makefile.deps --- nci/suif/suif2b/extratypes/string_enum/Makefile.deps Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/string_enum/Makefile.deps Wed Feb 13 10:26:07 2002 @@ -0,0 +1,18 @@ +# Dependencies for C files + +# Dependencies for C files + +CPP_TO_O_RULE = defined +C_TO_O_RULE = defined + +%.o: %.cpp %.cxx %.cc + -echo Can not build $*.o from $< without explicit dependency + -echo The Makefile.deps file was incorrectly generated + -echo All .o dependencies should be explicit in that file + +$(OBJDIR)/$(TARGET_LIB)/string_enum.o: string_enum.cpp /sow/16/16/livshits/work/src/nci/include/common/suif_copyright.h /sow/16/16/livshits/work/src/nci/include/common/machine_dependent.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h /sow/16/16/livshits/work/src/nci/include/common/suif_list.h /sow/16/16/livshits/work/src/nci/include/common/common_forwarders.h string_enum.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/string_enum.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) string_enum.cpp + diff -Nur nci/suif/suif2b/extratypes/string_enum/string_enum.cpp nci-latest/suif/suif2b/extratypes/string_enum/string_enum.cpp --- nci/suif/suif2b/extratypes/string_enum/string_enum.cpp Wed Feb 13 10:27:00 2002 +++ nci-latest/suif/suif2b/extratypes/string_enum/string_enum.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* file "string_enum.cc" */ diff -Nur nci/suif/suif2b/extratypes/string_enum/string_enum.h nci-latest/suif/suif2b/extratypes/string_enum/string_enum.h --- nci/suif/suif2b/extratypes/string_enum/string_enum.h Thu Sep 2 08:34:04 1999 +++ nci-latest/suif/suif2b/extratypes/string_enum/string_enum.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* file "string_enum.h" */ diff -Nur nci/suif/suif2b/extratypes/tos/Makefile.deps nci-latest/suif/suif2b/extratypes/tos/Makefile.deps --- nci/suif/suif2b/extratypes/tos/Makefile.deps Thu Jan 1 01:00:00 1970 +++ nci-latest/suif/suif2b/extratypes/tos/Makefile.deps Wed Feb 13 10:26:07 2002 @@ -0,0 +1,96 @@ +# Dependencies for C files + +# Dependencies for C files + +CPP_TO_O_RULE = defined +C_TO_O_RULE = defined + +%.o: %.cpp %.cxx %.cc + -echo Can not build $*.o from $< without explicit dependency + -echo The Makefile.deps file was incorrectly generated + -echo All .o dependencies should be explicit in that file + +$(OBJDIR)/$(TARGET_LIB)/ts_ptr_index.o: ts_ptr_index.cpp /sow/16/16/livshits/work/src/nci/include/common/suif_copyright.h /sow/16/16/livshits/work/src/nci/include/common/machine_dependent.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h referenced_item.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_forwarders.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/common_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/MString.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h /sow/16/16/livshits/work/src/nci/include/common/simple_stack.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_messages.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_messages.h /sow/16/16/livshits/work/src/nci/include/ion/ion.h /usr/include/stdio.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h /usr/include/bits/stdio_lim.h /sow/16/16/livshits/work/src/nci/include/common/i_integer.h index.h tree_string_index.h zero.h tree_string_index.cpp /usr/include/string.h ts_ptr_index.h ts_ptr_index.cpp + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/ts_ptr_index.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) ts_ptr_index.cpp + +$(OBJDIR)/$(TARGET_LIB)/slist_tos.o: slist_tos.cpp /sow/16/16/livshits/work/src/nci/include/common/suif_copyright.h zero.h const_cast.h referenced_item.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_forwarders.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_forwarders.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /sow/16/16/livshits/work/src/nci/include/common/common_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/MString.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h /sow/16/16/livshits/work/src/nci/include/common/simple_stack.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_messages.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_messages.h /sow/16/16/livshits/work/src/nci/include/ion/ion.h /usr/include/stdio.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h /usr/include/bits/stdio_lim.h /sow/16/16/livshits/work/src/nci/include/common/i_integer.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h tos.h /sow/16/16/livshits/work/src/nci/include/common/machine_dependent.h slist_tos.h slist_tos.cpp + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/slist_tos.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) slist_tos.cpp + +$(OBJDIR)/$(TARGET_LIB)/alist_index.o: alist_index.cpp /sow/16/16/livshits/work/src/nci/include/common/suif_copyright.h /sow/16/16/livshits/work/src/nci/include/common/machine_dependent.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h const_cast.h referenced_item.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_forwarders.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/common_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/MString.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h /sow/16/16/livshits/work/src/nci/include/common/simple_stack.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_messages.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_messages.h /sow/16/16/livshits/work/src/nci/include/ion/ion.h /usr/include/stdio.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h /usr/include/bits/stdio_lim.h /sow/16/16/livshits/work/src/nci/include/common/i_integer.h tos.h zero.h dlist_tos.h dlist_tos.cpp index.h alist_index.h alist_index.cpp + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/alist_index.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) alist_index.cpp + +$(OBJDIR)/$(TARGET_LIB)/cdlist_tos.o: cdlist_tos.cpp /sow/16/16/livshits/work/src/nci/include/common/suif_copyright.h const_cast.h referenced_item.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_forwarders.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_forwarders.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /sow/16/16/livshits/work/src/nci/include/common/common_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/MString.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h /sow/16/16/livshits/work/src/nci/include/common/simple_stack.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_messages.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_messages.h /sow/16/16/livshits/work/src/nci/include/ion/ion.h /usr/include/stdio.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h /usr/include/bits/stdio_lim.h /sow/16/16/livshits/work/src/nci/include/common/i_integer.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h tos.h /sow/16/16/livshits/work/src/nci/include/common/machine_dependent.h zero.h cdlist_tos.h cdlist_tos.cpp + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/cdlist_tos.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) cdlist_tos.cpp + +$(OBJDIR)/$(TARGET_LIB)/index.o: index.cpp /sow/16/16/livshits/work/src/nci/include/common/suif_copyright.h /sow/16/16/livshits/work/src/nci/include/common/machine_dependent.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h const_cast.h referenced_item.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_forwarders.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/common_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/MString.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h /sow/16/16/livshits/work/src/nci/include/common/simple_stack.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_messages.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_messages.h /sow/16/16/livshits/work/src/nci/include/ion/ion.h /usr/include/stdio.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h /usr/include/bits/stdio_lim.h /sow/16/16/livshits/work/src/nci/include/common/i_integer.h tos.h zero.h slist_tos.h slist_tos.cpp dlist_tos.h dlist_tos.cpp cdlist_tos.h cdlist_tos.cpp adlist_tos.h adlist_tos.cpp special_ro_tos.h array_tos.h array_tos.cpp index.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/index.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) index.cpp + +$(OBJDIR)/$(TARGET_LIB)/tos.o: tos.cpp /sow/16/16/livshits/work/src/nci/include/common/suif_copyright.h const_cast.h referenced_item.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_forwarders.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_forwarders.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /sow/16/16/livshits/work/src/nci/include/common/common_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/MString.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h /sow/16/16/livshits/work/src/nci/include/common/simple_stack.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_messages.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_messages.h /sow/16/16/livshits/work/src/nci/include/ion/ion.h /usr/include/stdio.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h /usr/include/bits/stdio_lim.h /sow/16/16/livshits/work/src/nci/include/common/i_integer.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h tos.h /sow/16/16/livshits/work/src/nci/include/common/machine_dependent.h zero.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/tos.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) tos.cpp + +$(OBJDIR)/$(TARGET_LIB)/brick.o: brick.cpp brick.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_forwarders.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /sow/16/16/livshits/work/src/nci/include/common/common_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/MString.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h /sow/16/16/livshits/work/src/nci/include/common/simple_stack.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_messages.h /sow/16/16/livshits/work/src/nci/include/common/i_integer.h /usr/include/stdio.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h /usr/include/bits/stdio_lim.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h /sow/16/16/livshits/work/src/nci/include/common/formatted.h /sow/16/16/livshits/work/src/nci/include/basicnodes/basic_forwarders.h /sow/16/16/livshits/work/src/nci/include/basicnodes/basic_factory.h /sow/16/16/livshits/work/src/nci/include/common/suif_list.h /sow/16/16/livshits/work/src/nci/include/iokernel/meta_class.h /sow/16/16/livshits/work/src/nci/include/iokernel/object.h /sow/16/16/livshits/work/src/nci/include/iokernel/walker.h /sow/16/16/livshits/work/src/nci/include/iokernel/meta_class_iter.h /sow/16/16/livshits/work/src/nci/include/iokernel/object_wrapper.h /sow/16/16/livshits/work/src/nci/include/iokernel/field_wrapper.h /sow/16/16/livshits/work/src/nci/include/suifkernel/real_object_factory.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_forwarders.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_messages.h /sow/16/16/livshits/work/src/nci/include/iokernel/stl_meta_class.h /sow/16/16/livshits/work/src/nci/include/iokernel/list_meta_class.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/new.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/new /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/exception /sow/16/16/livshits/work/src/nci/include/basicnodes/basic.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suif_object.h /sow/16/16/livshits/work/src/nci/include/common/suif_vector.h /usr/include/g++-2/cstddef /sow/16/16/livshits/work/src/nci/include/common/suif_indexed_list.h /sow/16/16/livshits/work/src/nci/include/suifkernel/iter.h /sow/16/16/livshits/work/src/nci/include/iokernel/cast.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/brick.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) brick.cpp + +$(OBJDIR)/$(TARGET_LIB)/adlist_tos.o: adlist_tos.cpp /sow/16/16/livshits/work/src/nci/include/common/suif_copyright.h const_cast.h referenced_item.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_forwarders.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_forwarders.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /sow/16/16/livshits/work/src/nci/include/common/common_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/MString.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h /sow/16/16/livshits/work/src/nci/include/common/simple_stack.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_messages.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_messages.h /sow/16/16/livshits/work/src/nci/include/ion/ion.h /usr/include/stdio.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h /usr/include/bits/stdio_lim.h /sow/16/16/livshits/work/src/nci/include/common/i_integer.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h tos.h /sow/16/16/livshits/work/src/nci/include/common/machine_dependent.h zero.h adlist_tos.h adlist_tos.cpp + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/adlist_tos.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) adlist_tos.cpp + +$(OBJDIR)/$(TARGET_LIB)/array_tos.o: array_tos.cpp /sow/16/16/livshits/work/src/nci/include/common/suif_copyright.h zero.h const_cast.h referenced_item.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_forwarders.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_forwarders.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /sow/16/16/livshits/work/src/nci/include/common/common_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/MString.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h /sow/16/16/livshits/work/src/nci/include/common/simple_stack.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_messages.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_messages.h /sow/16/16/livshits/work/src/nci/include/ion/ion.h /usr/include/stdio.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h /usr/include/bits/stdio_lim.h /sow/16/16/livshits/work/src/nci/include/common/i_integer.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h tos.h /sow/16/16/livshits/work/src/nci/include/common/machine_dependent.h special_ro_tos.h array_tos.h array_tos.cpp + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/array_tos.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) array_tos.cpp + +$(OBJDIR)/$(TARGET_LIB)/dlist_tos.o: dlist_tos.cpp /sow/16/16/livshits/work/src/nci/include/common/suif_copyright.h const_cast.h referenced_item.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_forwarders.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_forwarders.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /sow/16/16/livshits/work/src/nci/include/common/common_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/MString.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h /sow/16/16/livshits/work/src/nci/include/common/simple_stack.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_messages.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_messages.h /sow/16/16/livshits/work/src/nci/include/ion/ion.h /usr/include/stdio.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h /usr/include/bits/stdio_lim.h /sow/16/16/livshits/work/src/nci/include/common/i_integer.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h tos.h /sow/16/16/livshits/work/src/nci/include/common/machine_dependent.h zero.h dlist_tos.h dlist_tos.cpp + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/dlist_tos.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) dlist_tos.cpp + +$(OBJDIR)/$(TARGET_LIB)/referenced_item.o: referenced_item.cpp /sow/16/16/livshits/work/src/nci/include/common/suif_copyright.h const_cast.h referenced_item.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_forwarders.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_forwarders.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /sow/16/16/livshits/work/src/nci/include/common/common_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/MString.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h /sow/16/16/livshits/work/src/nci/include/common/simple_stack.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_messages.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_messages.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/referenced_item.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) referenced_item.cpp + +$(OBJDIR)/$(TARGET_LIB)/hash_index.o: hash_index.cpp /sow/16/16/livshits/work/src/nci/include/common/suif_copyright.h /sow/16/16/livshits/work/src/nci/include/common/machine_dependent.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h const_cast.h referenced_item.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_forwarders.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/common_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/MString.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h /sow/16/16/livshits/work/src/nci/include/common/simple_stack.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_messages.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_messages.h /sow/16/16/livshits/work/src/nci/include/ion/ion.h /usr/include/stdio.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h /usr/include/bits/stdio_lim.h /sow/16/16/livshits/work/src/nci/include/common/i_integer.h tos.h zero.h index.h hash_index.h hash_index.cpp + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/hash_index.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) hash_index.cpp + +$(OBJDIR)/$(TARGET_LIB)/tree_string_index.o: tree_string_index.cpp /sow/16/16/livshits/work/src/nci/include/common/suif_copyright.h /usr/include/string.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h /sow/16/16/livshits/work/src/nci/include/common/machine_dependent.h /usr/include/assert.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h referenced_item.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_forwarders.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/common_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/MString.h /sow/16/16/livshits/work/src/nci/include/common/simple_stack.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_messages.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_messages.h /sow/16/16/livshits/work/src/nci/include/ion/ion.h /usr/include/stdio.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h /usr/include/bits/stdio_lim.h /sow/16/16/livshits/work/src/nci/include/common/i_integer.h index.h tree_string_index.h zero.h tree_string_index.cpp + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/tree_string_index.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) tree_string_index.cpp + +$(OBJDIR)/$(TARGET_LIB)/special_ro_tos.o: special_ro_tos.cpp /sow/16/16/livshits/work/src/nci/include/common/suif_copyright.h const_cast.h referenced_item.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_forwarders.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_forwarders.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h /sow/16/16/livshits/work/src/nci/include/common/common_forwarders.h /sow/16/16/livshits/work/src/nci/include/common/MString.h /sow/16/16/livshits/work/src/nci/include/common/lstring.h /sow/16/16/livshits/work/src/nci/include/common/system_specific.h /sow/16/16/livshits/work/src/nci/include/common/simple_stack.h /usr/include/assert.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h /sow/16/16/livshits/work/src/nci/include/iokernel/iokernel_messages.h /sow/16/16/livshits/work/src/nci/include/suifkernel/suifkernel_messages.h /sow/16/16/livshits/work/src/nci/include/ion/ion.h /usr/include/stdio.h /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h /usr/include/bits/stdio_lim.h /sow/16/16/livshits/work/src/nci/include/common/i_integer.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/syslimits.h /usr/include/limits.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/bits/posix2_lim.h tos.h /sow/16/16/livshits/work/src/nci/include/common/machine_dependent.h zero.h special_ro_tos.h + $(MKDIR) -p $(OBJDIR)/$(TARGET_LIB) + $(CXX) $(EXTRA_CXXFLAGS) -c -o $(OBJDIR)/$(TARGET_LIB)/special_ro_tos.o $(PROFILE_COMPILE) $(COMPILER_SPECIFIC_CXXFLAGS) \ + $(CCFLAGS) $(INCLDIRS) $(SYSINCLDIRS) $(PREPROCESSORFLAGS) \ +$(SUIF_MODULE) special_ro_tos.cpp + diff -Nur nci/suif/suif2b/extratypes/tos/adlist_tos.cpp nci-latest/suif/suif2b/extratypes/tos/adlist_tos.cpp --- nci/suif/suif2b/extratypes/tos/adlist_tos.cpp Thu Sep 23 10:22:56 1999 +++ nci-latest/suif/suif2b/extratypes/tos/adlist_tos.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* file "adlist_tos.cc" */ diff -Nur nci/suif/suif2b/extratypes/tos/adlist_tos.h nci-latest/suif/suif2b/extratypes/tos/adlist_tos.h --- nci/suif/suif2b/extratypes/tos/adlist_tos.h Thu Jun 3 11:51:14 1999 +++ nci-latest/suif/suif2b/extratypes/tos/adlist_tos.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* file "adlist_tos.h" */ diff -Nur nci/suif/suif2b/extratypes/tos/alist_index.cpp nci-latest/suif/suif2b/extratypes/tos/alist_index.cpp --- nci/suif/suif2b/extratypes/tos/alist_index.cpp Thu Sep 23 10:22:56 1999 +++ nci-latest/suif/suif2b/extratypes/tos/alist_index.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* file "alist_index.cc" */ diff -Nur nci/suif/suif2b/extratypes/tos/alist_index.h nci-latest/suif/suif2b/extratypes/tos/alist_index.h --- nci/suif/suif2b/extratypes/tos/alist_index.h Thu Jun 3 11:51:14 1999 +++ nci-latest/suif/suif2b/extratypes/tos/alist_index.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* file "alist_index.h" */ diff -Nur nci/suif/suif2b/extratypes/tos/array_tos.cpp nci-latest/suif/suif2b/extratypes/tos/array_tos.cpp --- nci/suif/suif2b/extratypes/tos/array_tos.cpp Thu Sep 23 10:22:56 1999 +++ nci-latest/suif/suif2b/extratypes/tos/array_tos.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* file "array_tos.cc" */ diff -Nur nci/suif/suif2b/extratypes/tos/array_tos.h nci-latest/suif/suif2b/extratypes/tos/array_tos.h --- nci/suif/suif2b/extratypes/tos/array_tos.h Thu Jun 3 11:51:14 1999 +++ nci-latest/suif/suif2b/extratypes/tos/array_tos.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* file "array_tos.h" */ diff -Nur nci/suif/suif2b/extratypes/tos/brick.cpp nci-latest/suif/suif2b/extratypes/tos/brick.cpp --- nci/suif/suif2b/extratypes/tos/brick.cpp Tue Jun 1 01:26:31 1999 +++ nci-latest/suif/suif2b/extratypes/tos/brick.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #include "brick.h" #include "basicnodes/basic_factory.h" #include "basicnodes/basic.h" diff -Nur nci/suif/suif2b/extratypes/tos/brick.h nci-latest/suif/suif2b/extratypes/tos/brick.h --- nci/suif/suif2b/extratypes/tos/brick.h Thu Jun 3 11:51:15 1999 +++ nci-latest/suif/suif2b/extratypes/tos/brick.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef BASICNODES__BRICK_H #define BASICNODES__BRICK_H diff -Nur nci/suif/suif2b/extratypes/tos/cdlist_tos.cpp nci-latest/suif/suif2b/extratypes/tos/cdlist_tos.cpp --- nci/suif/suif2b/extratypes/tos/cdlist_tos.cpp Thu Sep 23 10:22:56 1999 +++ nci-latest/suif/suif2b/extratypes/tos/cdlist_tos.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* file "cdlist_tos.cc" */ diff -Nur nci/suif/suif2b/extratypes/tos/cdlist_tos.h nci-latest/suif/suif2b/extratypes/tos/cdlist_tos.h --- nci/suif/suif2b/extratypes/tos/cdlist_tos.h Thu Jun 3 11:51:15 1999 +++ nci-latest/suif/suif2b/extratypes/tos/cdlist_tos.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* file "cdlist_tos.h" */ diff -Nur nci/suif/suif2b/extratypes/tos/const_cast.h nci-latest/suif/suif2b/extratypes/tos/const_cast.h --- nci/suif/suif2b/extratypes/tos/const_cast.h Thu Jun 3 11:51:15 1999 +++ nci-latest/suif/suif2b/extratypes/tos/const_cast.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* file "const_cast.h" */ diff -Nur nci/suif/suif2b/extratypes/tos/dlist_tos.cpp nci-latest/suif/suif2b/extratypes/tos/dlist_tos.cpp --- nci/suif/suif2b/extratypes/tos/dlist_tos.cpp Thu Sep 23 10:22:56 1999 +++ nci-latest/suif/suif2b/extratypes/tos/dlist_tos.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* file "dlist_tos.cc" */ diff -Nur nci/suif/suif2b/extratypes/tos/dlist_tos.h nci-latest/suif/suif2b/extratypes/tos/dlist_tos.h --- nci/suif/suif2b/extratypes/tos/dlist_tos.h Thu Jun 3 11:51:16 1999 +++ nci-latest/suif/suif2b/extratypes/tos/dlist_tos.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* file "dlist_tos.h" */ diff -Nur nci/suif/suif2b/extratypes/tos/hash_index.cpp nci-latest/suif/suif2b/extratypes/tos/hash_index.cpp --- nci/suif/suif2b/extratypes/tos/hash_index.cpp Thu Sep 23 10:22:56 1999 +++ nci-latest/suif/suif2b/extratypes/tos/hash_index.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* file "hash_index.cc" */ diff -Nur nci/suif/suif2b/extratypes/tos/hash_index.h nci-latest/suif/suif2b/extratypes/tos/hash_index.h --- nci/suif/suif2b/extratypes/tos/hash_index.h Thu Jun 3 11:51:16 1999 +++ nci-latest/suif/suif2b/extratypes/tos/hash_index.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* file "hash_index.h" */ diff -Nur nci/suif/suif2b/extratypes/tos/index.cpp nci-latest/suif/suif2b/extratypes/tos/index.cpp --- nci/suif/suif2b/extratypes/tos/index.cpp Thu Sep 23 10:22:56 1999 +++ nci-latest/suif/suif2b/extratypes/tos/index.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* file "index.cc" */ diff -Nur nci/suif/suif2b/extratypes/tos/index.h nci-latest/suif/suif2b/extratypes/tos/index.h --- nci/suif/suif2b/extratypes/tos/index.h Thu Jun 3 11:51:16 1999 +++ nci-latest/suif/suif2b/extratypes/tos/index.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* file "index.h" */ diff -Nur nci/suif/suif2b/extratypes/tos/index_forwarders.h nci-latest/suif/suif2b/extratypes/tos/index_forwarders.h --- nci/suif/suif2b/extratypes/tos/index_forwarders.h Tue Mar 2 04:27:35 1999 +++ nci-latest/suif/suif2b/extratypes/tos/index_forwarders.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef STY_INDEX_H #define STY_INDEX_H template class Index; diff -Nur nci/suif/suif2b/extratypes/tos/referenced_item.cpp nci-latest/suif/suif2b/extratypes/tos/referenced_item.cpp --- nci/suif/suif2b/extratypes/tos/referenced_item.cpp Thu Sep 23 10:22:56 1999 +++ nci-latest/suif/suif2b/extratypes/tos/referenced_item.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* file "referenced_item.cc" */ diff -Nur nci/suif/suif2b/extratypes/tos/referenced_item.h nci-latest/suif/suif2b/extratypes/tos/referenced_item.h --- nci/suif/suif2b/extratypes/tos/referenced_item.h Thu Jun 3 11:51:16 1999 +++ nci-latest/suif/suif2b/extratypes/tos/referenced_item.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* file "referenced_item.h" */ diff -Nur nci/suif/suif2b/extratypes/tos/slist_tos.cpp nci-latest/suif/suif2b/extratypes/tos/slist_tos.cpp --- nci/suif/suif2b/extratypes/tos/slist_tos.cpp Thu Sep 23 10:22:56 1999 +++ nci-latest/suif/suif2b/extratypes/tos/slist_tos.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* file "slist_tos.cc" */ diff -Nur nci/suif/suif2b/extratypes/tos/slist_tos.h nci-latest/suif/suif2b/extratypes/tos/slist_tos.h --- nci/suif/suif2b/extratypes/tos/slist_tos.h Thu Sep 23 10:22:56 1999 +++ nci-latest/suif/suif2b/extratypes/tos/slist_tos.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* file "slist_tos.h" */ diff -Nur nci/suif/suif2b/extratypes/tos/special_ro_tos.cpp nci-latest/suif/suif2b/extratypes/tos/special_ro_tos.cpp --- nci/suif/suif2b/extratypes/tos/special_ro_tos.cpp Thu Sep 23 10:22:56 1999 +++ nci-latest/suif/suif2b/extratypes/tos/special_ro_tos.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* file "special_ro_tos.cc" */ diff -Nur nci/suif/suif2b/extratypes/tos/special_ro_tos.h nci-latest/suif/suif2b/extratypes/tos/special_ro_tos.h --- nci/suif/suif2b/extratypes/tos/special_ro_tos.h Thu Jun 3 11:51:17 1999 +++ nci-latest/suif/suif2b/extratypes/tos/special_ro_tos.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* file "special_ro_tos.h" */ diff -Nur nci/suif/suif2b/extratypes/tos/tos.cpp nci-latest/suif/suif2b/extratypes/tos/tos.cpp --- nci/suif/suif2b/extratypes/tos/tos.cpp Thu Sep 23 10:22:56 1999 +++ nci-latest/suif/suif2b/extratypes/tos/tos.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* file "tos.cc" */ diff -Nur nci/suif/suif2b/extratypes/tos/tos.h nci-latest/suif/suif2b/extratypes/tos/tos.h --- nci/suif/suif2b/extratypes/tos/tos.h Thu Sep 23 10:22:56 1999 +++ nci-latest/suif/suif2b/extratypes/tos/tos.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* file "tos.h" */ diff -Nur nci/suif/suif2b/extratypes/tos/tos_forwarders.h nci-latest/suif/suif2b/extratypes/tos/tos_forwarders.h --- nci/suif/suif2b/extratypes/tos/tos_forwarders.h Tue Mar 2 04:27:35 1999 +++ nci-latest/suif/suif2b/extratypes/tos/tos_forwarders.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef TOS_FORWARDERS_H #define TOS_FORWARDERS_H diff -Nur nci/suif/suif2b/extratypes/tos/tree_string_index.cpp nci-latest/suif/suif2b/extratypes/tos/tree_string_index.cpp --- nci/suif/suif2b/extratypes/tos/tree_string_index.cpp Thu Sep 23 10:22:56 1999 +++ nci-latest/suif/suif2b/extratypes/tos/tree_string_index.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* file "tree_string_index.cc" */ diff -Nur nci/suif/suif2b/extratypes/tos/tree_string_index.h nci-latest/suif/suif2b/extratypes/tos/tree_string_index.h --- nci/suif/suif2b/extratypes/tos/tree_string_index.h Thu Jun 3 11:51:18 1999 +++ nci-latest/suif/suif2b/extratypes/tos/tree_string_index.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* file "tree_string_index.h" */ diff -Nur nci/suif/suif2b/extratypes/tos/ts_ptr_index.cpp nci-latest/suif/suif2b/extratypes/tos/ts_ptr_index.cpp --- nci/suif/suif2b/extratypes/tos/ts_ptr_index.cpp Thu Sep 23 10:22:56 1999 +++ nci-latest/suif/suif2b/extratypes/tos/ts_ptr_index.cpp Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* file "ts_ptr_index.cc" */ diff -Nur nci/suif/suif2b/extratypes/tos/ts_ptr_index.h nci-latest/suif/suif2b/extratypes/tos/ts_ptr_index.h --- nci/suif/suif2b/extratypes/tos/ts_ptr_index.h Thu Jun 3 11:51:18 1999 +++ nci-latest/suif/suif2b/extratypes/tos/ts_ptr_index.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* file "ts_ptr_index.h" */ diff -Nur nci/suif/suif2b/extratypes/tos/zero.h nci-latest/suif/suif2b/extratypes/tos/zero.h --- nci/suif/suif2b/extratypes/tos/zero.h Thu Jun 3 11:51:18 1999 +++ nci-latest/suif/suif2b/extratypes/tos/zero.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* file "zero.h" */ diff -Nur nci/suif/suif2b/extratypes/tree_bit_vector/tree_bit_vector.h nci-latest/suif/suif2b/extratypes/tree_bit_vector/tree_bit_vector.h --- nci/suif/suif2b/extratypes/tree_bit_vector/tree_bit_vector.h Thu Apr 6 00:11:24 2000 +++ nci-latest/suif/suif2b/extratypes/tree_bit_vector/tree_bit_vector.h Wed Feb 13 10:26:07 2002 @@ -1,3 +1,4 @@ +/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ #ifndef __TREE_BIT_VECTOR__ #define __TREE_BIT_VECTOR__ //#include