[llvm] 3ab7b7f - TableGen/GlobalISel: Don't reconstruct CodeGenRegBank

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 15 05:59:05 PST 2020


Author: Matt Arsenault
Date: 2020-01-15T08:58:57-05:00
New Revision: 3ab7b7f53552a0969bd89db3317eb5a3ddf31d8f

URL: https://github.com/llvm/llvm-project/commit/3ab7b7f53552a0969bd89db3317eb5a3ddf31d8f
DIFF: https://github.com/llvm/llvm-project/commit/3ab7b7f53552a0969bd89db3317eb5a3ddf31d8f.diff

LOG: TableGen/GlobalISel: Don't reconstruct CodeGenRegBank

The maps for dealing with the relationships between different register
classes and subregister indexes rely on unique pointers for every
class/index. By constructing a second copy of CodeGenRegBank, two
different pointer values existed for a given subregister depending on
where you were querying.

Use the existing CodeGenRegBank owned by the CodeGenTarget instead of
constructing a second copy. This avoids incorrectly failing map
lookups in a future change.

Added: 
    

Modified: 
    llvm/utils/TableGen/GlobalISelEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/GlobalISelEmitter.cpp b/llvm/utils/TableGen/GlobalISelEmitter.cpp
index c14294951cc1..ff88186c8856 100644
--- a/llvm/utils/TableGen/GlobalISelEmitter.cpp
+++ b/llvm/utils/TableGen/GlobalISelEmitter.cpp
@@ -3269,7 +3269,7 @@ class GlobalISelEmitter {
   const RecordKeeper &RK;
   const CodeGenDAGPatterns CGP;
   const CodeGenTarget &Target;
-  CodeGenRegBank CGRegs;
+  CodeGenRegBank &CGRegs;
 
   /// Keep track of the equivalence between SDNodes and Instruction by mapping
   /// SDNodes to the GINodeEquiv mapping. We need to map to the GINodeEquiv to
@@ -3477,7 +3477,7 @@ GlobalISelEmitter::getEquivNode(Record &Equiv, const TreePatternNode *N) const {
 
 GlobalISelEmitter::GlobalISelEmitter(RecordKeeper &RK)
     : RK(RK), CGP(RK), Target(CGP.getTargetInfo()),
-      CGRegs(RK, Target.getHwModes()) {}
+      CGRegs(Target.getRegBank()) {}
 
 //===- Emitter ------------------------------------------------------------===//
 


        


More information about the llvm-commits mailing list