From: Chih-Wei Huang Date: Thu, 15 Oct 2015 15:46:30 +0000 (+0800) Subject: nv50/ir: use C++11 standard std::unordered_map if possible X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d31005e3e5588b20760c774f14ac0ea80375a181;p=mesa.git nv50/ir: use C++11 standard std::unordered_map if possible Note Android version before Lollipop is not supported. Signed-off-by: Chih-Wei Huang Reviewed-by: Ilia Mirkin Cc: mesa-stable@lists.freedesktop.org --- diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp index 400b9f09e51..7859c8e79bd 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