Re: [Mesa-dev] [PATCH 1/3] nv50/ir: use C++11 standard std::unordered_map if possible

2015-10-15 Thread Ilia Mirkin
This patch and the nv30 one are both

Reviewed-by: Ilia Mirkin 

I guess adding a cc: stable makes sense for these too? Or are further
fixes required that would make building 11.0.x impractical?

On Thu, Oct 15, 2015 at 11:46 AM, Chih-Wei Huang
 wrote:
> Note Android version before Lollipop is not supported.
>
> Signed-off-by: Chih-Wei Huang 
> ---
>  src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp | 20 +---
>  1 file changed, 17 insertions(+), 3 deletions(-)
>
> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp 
> b/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
> index 400b9f0..7859c8e 100644
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
> @@ -25,10 +25,24 @@
>
>  #include 
>  #include 
> +#if __cplusplus >= 201103L
> +#include 
> +#else
>  #include 
> +#endif
>
>  namespace nv50_ir {
>
> +#if __cplusplus >= 201103L
> +using std::hash;
> +using std::unordered_map;
> +#elif !defined(ANDROID)
> +using std::tr1::hash;
> +using std::tr1::unordered_map;
> +#else
> +#error Android release before Lollipop is not supported!
> +#endif
> +
>  #define MAX_REGISTER_FILE_SIZE 256
>
>  class RegisterSet
> @@ -349,12 +363,12 @@ RegAlloc::PhiMovesPass::needNewElseBlock(BasicBlock *b, 
> BasicBlock *p)
>
>  struct PhiMapHash {
> size_t operator()(const std::pair& val) 
> const {
> -  return std::tr1::hash()(val.first) * 31 +
> - std::tr1::hash()(val.second);
> +  return hash()(val.first) * 31 +
> + hash()(val.second);
> }
>  };
>
> -typedef std::tr1::unordered_map<
> +typedef unordered_map<
> std::pair, Value *, PhiMapHash> PhiMap;
>
>  // Critical edges need to be split up so that work can be inserted along
> --
> 1.9.1
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/3] nv50/ir: use C++11 standard std::unordered_map if possible

2015-10-15 Thread Chih-Wei Huang
Note Android version before Lollipop is not supported.

Signed-off-by: Chih-Wei Huang 
---
 src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp | 20 +---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp 
b/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
index 400b9f0..7859c8e 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
@@ -25,10 +25,24 @@
 
 #include 
 #include 
+#if __cplusplus >= 201103L
+#include 
+#else
 #include 
+#endif
 
 namespace nv50_ir {
 
+#if __cplusplus >= 201103L
+using std::hash;
+using std::unordered_map;
+#elif !defined(ANDROID)
+using std::tr1::hash;
+using std::tr1::unordered_map;
+#else
+#error Android release before Lollipop is not supported!
+#endif
+
 #define MAX_REGISTER_FILE_SIZE 256
 
 class RegisterSet
@@ -349,12 +363,12 @@ RegAlloc::PhiMovesPass::needNewElseBlock(BasicBlock *b, 
BasicBlock *p)
 
 struct PhiMapHash {
size_t operator()(const std::pair& val) const {
-  return std::tr1::hash()(val.first) * 31 +
- std::tr1::hash()(val.second);
+  return hash()(val.first) * 31 +
+ hash()(val.second);
}
 };
 
-typedef std::tr1::unordered_map<
+typedef unordered_map<
std::pair, Value *, PhiMapHash> PhiMap;
 
 // Critical edges need to be split up so that work can be inserted along
-- 
1.9.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/3] nv50/ir: use C++11 standard std::unordered_map if possible

2015-10-15 Thread Chih-Wei Huang
2015-10-16 0:11 GMT+08:00 Ilia Mirkin :
> This patch and the nv30 one are both
>
> Reviewed-by: Ilia Mirkin 

Thank you for the review.

> I guess adding a cc: stable makes sense for these too? Or are further
> fixes required that would make building 11.0.x impractical?

Ah, yes. They apply to 11.0.x as well.
Thank you for reminding.


-- 
Chih-Wei
Android-x86 project
http://www.android-x86.org
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev