nouveau: Drop C++03 compat code
authorM Henning <drawoc@darkrefraction.com>
Sat, 18 Jun 2022 20:45:53 +0000 (16:45 -0400)
committerMarge Bot <emma+marge@anholt.net>
Tue, 5 Jul 2022 13:23:12 +0000 (13:23 +0000)
Mesa as a whole requires C++14 nowadays, so this isn't needed any more.

Reviewed-by: David Heidelberg <david.heidelberg@collabora.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17307>

src/nouveau/codegen/meson.build
src/nouveau/codegen/nv50_ir.h
src/nouveau/codegen/nv50_ir_from_nir.cpp
src/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
src/nouveau/codegen/nv50_ir_lowering_nvc0.h
src/nouveau/codegen/nv50_ir_ra.cpp
src/nouveau/codegen/nv50_ir_util.h
src/nouveau/codegen/unordered_set.h [deleted file]

index 58ac605..d67e375 100644 (file)
@@ -47,7 +47,6 @@ files_libnouveau_codegen = files(
   'nv50_ir_target_nv50.h',
   'nv50_ir_util.cpp',
   'nv50_ir_util.h',
-  'unordered_set.h',
   'nv50_ir_emit_gv100.cpp',
   'nv50_ir_emit_gv100.h',
   'nv50_ir_emit_gk110.cpp',
index ec28b79..0b29408 100644 (file)
@@ -28,9 +28,9 @@
 #include <stdint.h>
 #include <deque>
 #include <list>
+#include <unordered_set>
 #include <vector>
 
-#include "unordered_set.h"
 #include "nv50_ir_util.h"
 #include "nv50_ir_graph.h"
 
@@ -751,10 +751,10 @@ public:
 
    static inline Value *get(Iterator&);
 
-   unordered_set<ValueRef *> uses;
+   std::unordered_set<ValueRef *> uses;
    std::list<ValueDef *> defs;
-   typedef unordered_set<ValueRef *>::iterator UseIterator;
-   typedef unordered_set<ValueRef *>::const_iterator UseCIterator;
+   typedef std::unordered_set<ValueRef *>::iterator UseIterator;
+   typedef std::unordered_set<ValueRef *>::const_iterator UseCIterator;
    typedef std::list<ValueDef *>::iterator DefIterator;
    typedef std::list<ValueDef *>::const_iterator DefCIterator;
 
index 9f2f791..bc4ffeb 100644 (file)
 #include "nv50_ir_util.h"
 #include "tgsi/tgsi_from_mesa.h"
 
-#if __cplusplus >= 201103L
 #include <unordered_map>
-#else
-#include <tr1/unordered_map>
-#endif
 #include <cstring>
 #include <list>
 #include <vector>
 
 namespace {
 
-#if __cplusplus >= 201103L
-using std::hash;
-using std::unordered_map;
-#else
-using std::tr1::hash;
-using std::tr1::unordered_map;
-#endif
-
 using namespace nv50_ir;
 
 int
@@ -85,9 +73,9 @@ public:
    bool run();
 private:
    typedef std::vector<LValue*> LValues;
-   typedef unordered_map<unsigned, LValues> NirDefMap;
-   typedef unordered_map<unsigned, nir_load_const_instr*> ImmediateMap;
-   typedef unordered_map<unsigned, BasicBlock*> NirBlockMap;
+   typedef std::unordered_map<unsigned, LValues> NirDefMap;
+   typedef std::unordered_map<unsigned, nir_load_const_instr*> ImmediateMap;
+   typedef std::unordered_map<unsigned, BasicBlock*> NirBlockMap;
 
    CacheMode convert(enum gl_access_qualifier);
    TexTarget convert(glsl_sampler_dim, bool isArray, bool isShadow);
index 2891a1b..2655c71 100644 (file)
@@ -437,7 +437,7 @@ NVC0LegalizePostRA::findFirstUses(
    int minGPR = texi->def(0).rep()->reg.data.id;
    int maxGPR = minGPR + texi->def(0).rep()->reg.size / 4 - 1;
 
-   unordered_set<const BasicBlock *> visited;
+   std::unordered_set<const BasicBlock *> visited;
    findFirstUsesBB(minGPR, maxGPR, texi->next, texi, uses, visited);
 }
 
@@ -445,7 +445,7 @@ void
 NVC0LegalizePostRA::findFirstUsesBB(
    int minGPR, int maxGPR, Instruction *start,
    const Instruction *texi, std::list<TexUse> &uses,
-   unordered_set<const BasicBlock *> &visited)
+   std::unordered_set<const BasicBlock *> &visited)
 {
    const BasicBlock *bb = start->bb;
 
index 9534703..4df8a7c 100644 (file)
@@ -109,7 +109,7 @@ private:
    void findFirstUses(Instruction *texi, std::list<TexUse> &uses);
    void findFirstUsesBB(int minGPR, int maxGPR, Instruction *start,
                         const Instruction *texi, std::list<TexUse> &uses,
-                        unordered_set<const BasicBlock *> &visited);
+                        std::unordered_set<const BasicBlock *> &visited);
    void addTexUse(std::list<TexUse>&, Instruction *, const Instruction *);
    const Instruction *recurseDef(const Instruction *);
 
index ea45ff7..08aaac5 100644 (file)
 #include <algorithm>
 #include <stack>
 #include <limits>
-#if __cplusplus >= 201103L
 #include <unordered_map>
-#else
-#include <tr1/unordered_map>
-#endif
 
 namespace nv50_ir {
 
-#if __cplusplus >= 201103L
-using std::hash;
-using std::unordered_map;
-#else
-using std::tr1::hash;
-using std::tr1::unordered_map;
-#endif
-
 #define MAX_REGISTER_FILE_SIZE 256
 
 class RegisterSet
@@ -410,12 +398,12 @@ RegAlloc::PhiMovesPass::needNewElseBlock(BasicBlock *b, BasicBlock *p)
 
 struct PhiMapHash {
    size_t operator()(const std::pair<Instruction *, BasicBlock *>& val) const {
-      return hash<Instruction*>()(val.first) * 31 +
-         hash<BasicBlock*>()(val.second);
+      return std::hash<Instruction*>()(val.first) * 31 +
+         std::hash<BasicBlock*>()(val.second);
    }
 };
 
-typedef unordered_map<
+typedef std::unordered_map<
    std::pair<Instruction *, BasicBlock *>, Value *, PhiMapHash> PhiMap;
 
 // Critical edges need to be split up so that work can be inserted along
@@ -1837,7 +1825,7 @@ SpillCodeInserter::run(const std::list<ValuePair>& lst)
       // Keep track of which instructions to delete later. Deleting them
       // inside the loop is unsafe since a single instruction may have
       // multiple destinations that all need to be spilled (like OP_SPLIT).
-      unordered_set<Instruction *> to_del;
+      std::unordered_set<Instruction *> to_del;
 
       std::list<ValueDef *> &defs = mergedDefs(lval);
       for (Value::DefIterator d = defs.begin(); d != defs.end();
@@ -1887,7 +1875,7 @@ SpillCodeInserter::run(const std::list<ValuePair>& lst)
          }
       }
 
-      for (unordered_set<Instruction *>::const_iterator it = to_del.begin();
+      for (std::unordered_set<Instruction *>::const_iterator it = to_del.begin();
            it != to_del.end(); ++it) {
          mergedDefs.removeDefsOfInstruction(*it);
          delete_Instruction(func->getProgram(), *it);
index b1766f4..9ccf8d4 100644 (file)
@@ -94,11 +94,7 @@ public:
    virtual void reset() { assert(0); } // only for graph iterators
 };
 
-#if __cplusplus >= 201103L
 typedef std::unique_ptr<Iterator> IteratorRef;
-#else
-typedef std::auto_ptr<Iterator> IteratorRef;
-#endif
 
 class ManipIterator : public Iterator
 {
diff --git a/src/nouveau/codegen/unordered_set.h b/src/nouveau/codegen/unordered_set.h
deleted file mode 100644 (file)
index 0e2945f..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef __NV50_UNORDERED_SET_H__
-#define __NV50_UNORDERED_SET_H__
-
-#if (__cplusplus >= 201103L)
-#include <unordered_set>
-#else
-#include <tr1/unordered_set>
-#endif
-
-namespace nv50_ir {
-
-#if __cplusplus >= 201103L
-using std::unordered_set;
-#else
-using std::tr1::unordered_set;
-#endif
-
-} // namespace nv50_ir
-
-#endif // __NV50_UNORDERED_SET_H__