Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

external-mesa: 提交

external/mesa


Commit MetaInfo

修订版d3e9661e8fa101f4159db70161dca0fe6033b7c4 (tree)
时间2015-07-16 22:48:42
作者Chih-Wei Huang <cwhuang@linu...>
CommiterChih-Wei Huang

Log Message

nv50/ir: support different unordered_set implementations

If build with C++11 standard, use std::unordered_set.

Otherwise if build on old Android version with stlport,
use std::tr1::unordered_set with a wrapper class.

Otherwise use std::tr1::unordered_set.

Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>

更改概述

差异

--- a/src/gallium/drivers/nouveau/codegen/nv50_ir.h
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir.h
@@ -29,8 +29,8 @@
2929 #include <deque>
3030 #include <list>
3131 #include <vector>
32-#include <tr1/unordered_set>
3332
33+#include "codegen/unordered_set.h"
3434 #include "codegen/nv50_ir_util.h"
3535 #include "codegen/nv50_ir_graph.h"
3636
@@ -582,10 +582,10 @@ public:
582582
583583 static inline Value *get(Iterator&);
584584
585- std::tr1::unordered_set<ValueRef *> uses;
585+ unordered_set<ValueRef *> uses;
586586 std::list<ValueDef *> defs;
587- typedef std::tr1::unordered_set<ValueRef *>::iterator UseIterator;
588- typedef std::tr1::unordered_set<ValueRef *>::const_iterator UseCIterator;
587+ typedef unordered_set<ValueRef *>::iterator UseIterator;
588+ typedef unordered_set<ValueRef *>::const_iterator UseCIterator;
589589 typedef std::list<ValueDef *>::iterator DefIterator;
590590 typedef std::list<ValueDef *>::const_iterator DefCIterator;
591591
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
@@ -201,7 +201,7 @@ NVC0LegalizePostRA::findFirstUses(
201201 const Instruction *texi,
202202 const Instruction *insn,
203203 std::list<TexUse> &uses,
204- std::tr1::unordered_set<const Instruction *>& visited)
204+ unordered_set<const Instruction *>& visited)
205205 {
206206 for (int d = 0; insn->defExists(d); ++d) {
207207 Value *v = insn->getDef(d);
@@ -300,7 +300,7 @@ NVC0LegalizePostRA::insertTextureBarriers(Function *fn)
300300 if (!uses)
301301 return false;
302302 for (size_t i = 0; i < texes.size(); ++i) {
303- std::tr1::unordered_set<const Instruction *> visited;
303+ unordered_set<const Instruction *> visited;
304304 findFirstUses(texes[i], texes[i], uses[i], visited);
305305 }
306306
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.h
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.h
@@ -20,8 +20,6 @@
2020 * OTHER DEALINGS IN THE SOFTWARE.
2121 */
2222
23-#include <tr1/unordered_set>
24-
2523 #include "codegen/nv50_ir.h"
2624 #include "codegen/nv50_ir_build_util.h"
2725
@@ -73,7 +71,7 @@ private:
7371 inline bool insnDominatedBy(const Instruction *, const Instruction *) const;
7472 void findFirstUses(const Instruction *tex, const Instruction *def,
7573 std::list<TexUse>&,
76- std::tr1::unordered_set<const Instruction *>&);
74+ unordered_set<const Instruction *>&);
7775 void findOverwritingDefs(const Instruction *tex, Instruction *insn,
7876 const BasicBlock *term,
7977 std::list<TexUse>&);
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
@@ -25,7 +25,6 @@
2525
2626 #include <stack>
2727 #include <limits>
28-#include <tr1/unordered_set>
2928
3029 namespace nv50_ir {
3130
@@ -1551,7 +1550,7 @@ SpillCodeInserter::run(const std::list<ValuePair>& lst)
15511550 // Keep track of which instructions to delete later. Deleting them
15521551 // inside the loop is unsafe since a single instruction may have
15531552 // multiple destinations that all need to be spilled (like OP_SPLIT).
1554- std::tr1::unordered_set<Instruction *> to_del;
1553+ unordered_set<Instruction *> to_del;
15551554
15561555 for (Value::DefIterator d = lval->defs.begin(); d != lval->defs.end();
15571556 ++d) {
@@ -1593,7 +1592,7 @@ SpillCodeInserter::run(const std::list<ValuePair>& lst)
15931592 }
15941593 }
15951594
1596- for (std::tr1::unordered_set<Instruction *>::const_iterator it = to_del.begin();
1595+ for (unordered_set<Instruction *>::const_iterator it = to_del.begin();
15971596 it != to_del.end(); ++it)
15981597 delete_Instruction(func->getProgram(), *it);
15991598 }
--- /dev/null
+++ b/src/gallium/drivers/nouveau/codegen/unordered_set.h
@@ -0,0 +1,48 @@
1+#ifndef __NV50_UNORDERED_SET_H__
2+#define __NV50_UNORDERED_SET_H__
3+
4+#if (__cplusplus >= 201103L) || defined(ANDROID)
5+#include <unordered_set>
6+#else
7+#include <tr1/unordered_set>
8+#endif
9+
10+namespace nv50_ir {
11+
12+#if __cplusplus >= 201103L
13+using std::unordered_set;
14+#elif !defined(ANDROID)
15+using std::tr1::unordered_set;
16+#else // Android release before lollipop
17+using std::isfinite;
18+typedef std::tr1::unordered_set<void *> voidptr_unordered_set;
19+
20+template <typename V>
21+class unordered_set : public voidptr_unordered_set {
22+ public:
23+ typedef voidptr_unordered_set _base;
24+ typedef _base::iterator _biterator;
25+ typedef _base::const_iterator const_biterator;
26+
27+ class iterator : public _biterator {
28+ public:
29+ iterator(const _biterator & i) : _biterator(i) {}
30+ V operator*() const { return reinterpret_cast<V>(*_biterator(*this)); }
31+ };
32+ class const_iterator : public const_biterator {
33+ public:
34+ const_iterator(const iterator & i) : const_biterator(i) {}
35+ const_iterator(const const_biterator & i) : const_biterator(i) {}
36+ const V operator*() const { return reinterpret_cast<const V>(*const_biterator(*this)); }
37+ };
38+
39+ iterator begin() { return _base::begin(); }
40+ iterator end() { return _base::end(); }
41+ const_iterator begin() const { return _base::begin(); }
42+ const_iterator end() const { return _base::end(); }
43+};
44+#endif
45+
46+} // namespace nv50_ir
47+
48+#endif // __NV50_UNORDERED_SET_H__
Show on old repository browser