[PATCH] D15614: TargetRegisterInfo: Add getRegAsmName()

Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 11 09:26:53 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL265955: TargetRegisterInfo: Add getRegAsmName() (authored by tstellar).

Changed prior to commit:
  http://reviews.llvm.org/D15614?vs=43145&id=53259#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D15614

Files:
  llvm/trunk/include/llvm/Target/TargetRegisterInfo.h
  llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp

Index: llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -2330,7 +2330,7 @@
 
     for (TargetRegisterClass::iterator I = RC->begin(), E = RC->end();
          I != E; ++I) {
-      if (RegName.equals_lower(RI->getName(*I))) {
+      if (RegName.equals_lower(RI->getRegAsmName(*I))) {
         std::pair<unsigned, const TargetRegisterClass*> S =
           std::make_pair(*I, RC);
 
Index: llvm/trunk/include/llvm/Target/TargetRegisterInfo.h
===================================================================
--- llvm/trunk/include/llvm/Target/TargetRegisterInfo.h
+++ llvm/trunk/include/llvm/Target/TargetRegisterInfo.h
@@ -880,6 +880,17 @@
                                    int SPAdj, unsigned FIOperandNum,
                                    RegScavenger *RS = nullptr) const = 0;
 
+  /// Return the assembly name for \p Reg.
+  virtual std::string getRegAsmName(unsigned Reg) const {
+    // FIXME: We are assuming that the assembly name is equal to the TableGen
+    // name converted to lower case
+    //
+    // The TableGen name is the name of the definition for this register in the
+    // target's tablegen files.  For example, the TableGen name of
+    // def EAX : Register <...>; is "EAX"
+    return StringRef(getName(Reg)).lower();
+  }
+
   //===--------------------------------------------------------------------===//
   /// Subtarget Hooks
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15614.53259.patch
Type: text/x-patch
Size: 1562 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160411/926925ad/attachment.bin>


More information about the llvm-commits mailing list