RangeDict.ccGo to the documentation of this file.00001
00002
00003 #include "../Program.h"
00004 #include "../Collection/Iterator.h"
00005 #include "../Symbol/Symbol.h"
00006 #include "../Symbol/FunctionSymbol.h"
00007 #include "../Symtab.h"
00008 #include "../Statement/Statement.h"
00009 #include "../StmtList.h"
00010 #include "StmtRanges.h"
00011
00012 #include "RangeDict.h"
00013
00014 void
00015 RangeDict::_add_intrinsic(const char *intrin_name)
00016 {
00017 if (! _symtab_ref->find_ref(intrin_name)) {
00018 Symbol *s = new FunctionSymbol(intrin_name, make_type(INTEGER_TYPE),
00019 NOT_EXTERNAL, IS_INTRINSIC, NOT_FORMAL);
00020 _symtab_ref->ins(s);
00021 }
00022 }
00023
00024 RangeDict::RangeDict(Symtab &symtab)
00025 {
00026 _symtab_ref = &symtab;
00027 _add_intrinsic("MIN");
00028 _add_intrinsic("MAX");
00029 _add_intrinsic("MOD");
00030 }
00031
00032 RangeDict::RangeDict(const RangeDict &other)
00033 {
00034 _symtab_ref = other._symtab_ref;
00035 }
00036
00037 RangeDict::~RangeDict()
00038 {
00039
00040 }
00041
00042 RangeDict &
00043 RangeDict::operator = (const RangeDict &other)
00044 {
00045 _symtab_ref = other._symtab_ref;
00046 return *this;
00047 }
00048
00049 const Symtab &
00050 RangeDict::symtab() const
00051 {
00052 return *_symtab_ref;
00053 }
00054
00055 StmtRanges &
00056 RangeDict::_s_ranges(String & tag)
00057 {
00058 p_abort("pure function RangeDict::_s_ranges called - must call derived function instead");
00059 }
00060
00061 void
00062 RangeDict::pretty_print(ostream & o, const StmtList &stmts) const
00063 {
00064 for (Iterator<Statement> iter = stmts.iterator(); iter.valid(); ++iter) {
00065 o << " ";
00066 pretty_print(o, iter.current());
00067 o << endl;
00068 int zero = 0;
00069 iter.current().write(o, zero);
00070 }
00071 }
00072
00073 template class TypedBaseMap<Program,RangeDict>;
00074 template class TypedBaseMap<ProgramUnit,RangeDict>;
00075 template class ProtoMap<ProgramUnit,RangeDict>;
00076 template class Map<ProgramUnit,RangeDict>;
00077 template class KeyIterator<ProgramUnit,RangeDict>;
|