00001 #ifndef CONFLICT_TABLE_H_INCLUDED_
00002 #define CONFLICT_TABLE_H_INCLUDED_
00003
00004 #include<utility>
00005
00006 #include "rose.h"
00007
00008 #include "segment_graph.h"
00009 #include "mapped_variable.h"
00010
00011 namespace risc {
00012
00013 class PathInstanceMapper;
00014
00015 namespace sg {
00016
00017 class ConflictTable {
00018
00019 public:
00020
00024 ConflictTable(
00025 SegmentGraph &segment_graph,
00026 PathInstanceMapper *path_instance_mapper,
00027 bool debugging = false);
00028
00032 ~ConflictTable();
00033
00039 VertexDescriptor *vertex_lookup_;
00040
00045 int size_of_conflict_table_;
00046
00050 int *conflicts_per_instance_;
00051
00056 int max_instances_with_thread_;
00057
00063 int max_instances_;
00064
00070 int number_of_segments_;
00071
00076 int **instance_id_to_index_lookup_;
00077
00081 bool **conflict_table_;
00082
00087 void print_conflict_table(std::string filename);
00088
00093 void print_lookup_table(std::string filename);
00094
00100 int segment_and_instance_id_to_index(int segment_id, int instance_id);
00101
00108 std::pair<int, int> index_to_segment_and_instance_id(int index);
00109
00115 bool has_conflict(int segment_id_1, int instance_id_1, int segment_id_2,
00116 int instance_id_2);
00117
00123 void print_instance_id_to_index_lookup_table();
00124
00129 void set_conflict(int segment_id_1, int instance_id_1,
00130 int segment_id_2, int instance_id_2);
00131
00137 virtual void determine_conflict_table();
00138
00144 VertexDescriptor segment_id_to_vertex_descriptor(int id);
00145
00150 MappedVariableList
00151 get_mapped_variable(SgVariableSymbol *variable, int instance_id,
00152 bool dynamic_analysis);
00153
00161 MappedVariableList
00162 get_mapped_variable_statically(SgVariableSymbol *variable, int instance_id);
00163
00169 MappedVariableList
00170 get_mapped_variable_dynamically(SgVariableSymbol *variable, int instance_id);
00171
00177 int get_max_instances(int segment_id);
00178
00186 int
00187 get_channel_id(const SymbolWithPath &swp, int instance,
00188 bool dynamic_analysis);
00189
00197 int get_channel_id_statically(const SymbolWithPath &swp, int instance);
00198
00206 int get_channel_id_dynamically(const SymbolWithPath &swp, int instance);
00207
00212 void print_conflicts_per_instance();
00213
00214 PathInstanceMapper *path_instance_mapper_;
00215
00216 SegmentGraph &segment_graph_;
00217
00218
00219 struct ConflictInformation {
00220 std::set<Conflict> conflict_variables_;
00221 };
00222
00223 ConflictInformation **conflict_info_;
00224
00225 bool debugging_;
00226 };
00227
00228 };
00229
00230 };
00231
00232 #endif
00233
00234