[PATCH] Replace another std::set in the core of CodeGenRegister, this time with sorted arrays.

Chandler Carruth chandlerc at gmail.com
Sat Jan 31 00:12:59 PST 2015


Change looks fine, but I'd really love to see this code cleaned up more if you're going to be here...

- Not using weird typedefs like Vec
- Using range based for loops rather than just auto.
- Use lambdas

Anyways, none of that cleanup should preclude making it go faster.


REPOSITORY
  rL LLVM

================
Comment at: utils/TableGen/CodeGenRegisters.cpp:645
@@ -644,1 +644,3 @@
 
+static void SortRegisterVector(CodeGenRegister::Vec &M) {
+  std::sort(M.begin(), M.end(), CodeGenRegister::Less());
----------------
This should be sortRegisterVector... but it doesn't just sort, it uniques as well. I would probably call it 'sortAndUniqueRegisters', but feel free to paint it a different shade.

================
Comment at: utils/TableGen/CodeGenRegisters.h:418-419
@@ -409,3 +417,4 @@
 
-      Key(const CodeGenRegister::Set *M, unsigned S = 0, unsigned A = 0)
+      Key(const CodeGenRegister::Vec *M,
+          unsigned S = 0, unsigned A = 0)
         : Members(M), SpillSize(S), SpillAlignment(A) {}
----------------
My clang format spidey sense says this line break isn't necessary.

http://reviews.llvm.org/D7313

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list