1 /* -*- mesa-c++ -*- 2 * Copyright 2022 Collabora LTD 3 * Author: Gert Wollny <[email protected]> 4 * SPDX-License-Identifier: MIT 5 */ 6 7 #ifndef INTERFERENCE_H 8 #define INTERFERENCE_H 9 10 #include "sfn_valuefactory.h" 11 12 #include <vector> 13 14 namespace r600 { 15 16 class ComponentInterference { 17 public: 18 using Row = std::vector<int>; 19 20 void prepare_row(int row); 21 22 void add(size_t idx1, size_t idx2); 23 24 auto row(int idx) const -> const Row& 25 { 26 assert((size_t)idx < m_rows.size()); 27 return m_rows[idx]; 28 } 29 30 private: 31 std::vector<Row> m_rows; 32 }; 33 34 class Interference { 35 public: 36 Interference(LiveRangeMap& map); 37 row(int comp,int index)38 const auto& row(int comp, int index) const 39 { 40 assert(comp < 4); 41 return m_components_maps[comp].row(index); 42 } 43 44 private: 45 void initialize(); 46 void initialize(ComponentInterference& comp, LiveRangeMap::ChannelLiveRange& clr); 47 48 LiveRangeMap& m_map; 49 std::array<ComponentInterference, 4> m_components_maps; 50 }; 51 52 bool 53 register_allocation(LiveRangeMap& lrm); 54 55 } // namespace r600 56 57 #endif // INTERFERENCE_H 58