IPCPConstants.hGo to the documentation of this file.00001
00002 #ifndef _IPCP_CONSTANTS_H
00003 #define _IPCP_CONSTANTS_H
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "../Listable.h"
00021 #include "../Collection/Map.h"
00022 #include "../Collection/Set.h"
00023 #include "../Collection/RefSet.h"
00024 #include "../Symbol/Symbol.h"
00025 #include "../Expression/Expression.h"
00026 #include "../String.h"
00027 #include "../Array.h"
00028
00029 class AliasSets;
00030 class IPCPConstants;
00031 class IPCPProcData;
00032
00033 class CallSite : public Listable {
00034 public:
00035 CallSite(const IPCPConstants *caller_consts_ref, const char *call_tag);
00036 CallSite(const CallSite &other);
00037 virtual ~CallSite();
00038
00039 inline const IPCPConstants *caller_consts_ref() const;
00040
00041
00042 inline const String &call_tag() const;
00043
00044
00045
00046 virtual Listable *listable_clone() const;
00047 virtual void print(ostream &o) const;
00048 virtual int structures_OK() const;
00049
00050
00051 private:
00052 const IPCPConstants *_caller_consts_ref;
00053 String _call_tag;
00054 };
00055
00056 class IPCPConstants : public Listable {
00057 public:
00058 IPCPProcData *proc_data_ref;
00059
00060
00061 IPCPConstants();
00062 IPCPConstants(Map<Symbol, Expression> *constants, AliasSets *alias_sets);
00063 IPCPConstants(const IPCPConstants &other);
00064 virtual ~IPCPConstants();
00065
00066 int operator == (const IPCPConstants &other) const;
00067 inline int operator != (const IPCPConstants &other) const;
00068
00069
00070
00071 inline const Map<Symbol,Expression> &constants() const;
00072
00073
00074 inline AliasSets &alias_sets();
00075
00076
00077
00078 inline const Set<CallSite> &invocation_sites() const;
00079
00080
00081
00082 void add_invocation_site(CallSite *invocation_site);
00083
00084
00085 void merge_invocation_sites(IPCPConstants *other);
00086
00087
00088
00089 void filter_out_vars_not_in_set(const RefSet<Symbol> &keepable_lhs_vars,
00090 const RefSet<Symbol> &keepable_rhs_vars);
00091
00092
00093
00094 virtual void print(ostream &o) const;
00095
00096
00097 virtual void print_constants(ostream &o) const;
00098
00099
00100 virtual Listable *listable_clone() const;
00101 virtual int structures_OK() const;
00102
00103
00104 private:
00105 Map<Symbol,Expression> *_constants;
00106 AliasSets *_alias_sets;
00107 Set<CallSite> _invocation_sites;
00108 IPCPProcData *_proc_data;
00109
00110 void _add_used_vars_to_set(RefSet<Symbol> &vars,
00111 const Expression &expr);
00112 void _const_order1(Map<Symbol,IntElem> &const_order,
00113 int &num_labeled_consts, const Symbol &var) const;
00114 void _const_order1(Map<Symbol,IntElem> &const_order,
00115 int &num_labeled_consts, const Expression &expr) const;
00116 };
00117
00118
00119
00120
00121
00122 inline const IPCPConstants *
00123 CallSite::caller_consts_ref() const
00124 {
00125 return _caller_consts_ref;
00126 }
00127
00128 inline const String &
00129 CallSite::call_tag() const
00130 {
00131 return _call_tag;
00132 }
00133
00134 inline int
00135 IPCPConstants::operator != (const IPCPConstants &other) const
00136 {
00137 return ! (*this == other);
00138 }
00139
00140 inline const Map<Symbol,Expression> &
00141 IPCPConstants::constants() const
00142 {
00143 return *_constants;
00144 }
00145
00146 inline AliasSets &
00147 IPCPConstants::alias_sets()
00148 {
00149 return *_alias_sets;
00150 }
00151
00152 inline const Set<CallSite> &
00153 IPCPConstants::invocation_sites() const
00154 {
00155 return _invocation_sites;
00156 }
00157
00158 #endif
|