Debian Codegraph @

media_softlet/agnostic/common/vp/cm_fc_ld/DepGraph.h

raw
1 /*
2 * Copyright (c) 2019, Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22
23 #pragma once
24
25 #ifndef __CM_FC_DEPGRAPH_H__
26 #define __CM_FC_DEPGRAPH_H__
27
28 #include <list>
29 #include <map>
30 #include <tuple>
31 #include <utility>
32
33 #include "PatchInfoRecord.h"
34
35 namespace cm {
36 namespace patch {
37
38 class DepGraph {
39 Collection &C;
40
41 unsigned Policy;
42
43 std::list<DepNode> Nodes;
44 std::list<DepEdge> Edges;
45
46 std::map<std::tuple<Binary *, unsigned, bool>, DepNode *> NodeMap;
47 std::map<std::pair<DepNode *, DepNode *>, DepEdge *> EdgeMap;
48
49 public:
50 enum {
51 SWSB_POLICY_0,
52 SWSB_POLICY_1,
53 SWSB_POLICY_2
54 };
55 DepGraph(Collection &_C, unsigned P) : C(_C), Policy(P) {};
56 void build();
57 void resolve();
58
59 protected:
60 DepNode *getDepNode(Binary *B, unsigned R, bool Barrier);
61 DepEdge *getDepEdge(DepNode *From, DepNode *To, bool FromDef);
62 MEDIA_CLASS_DEFINE_END(cm__patch__DepGraph)
63 };
64
65 } // End namespace patch
66 } // End namespace cm
67
68 #endif // __CM_FC_DEPGRAPH_H__