[llvm] r214780 - Reimplement the temporary non-const getSubtargetImpl routine so

Eric Christopher echristo at gmail.com
Mon Aug 4 14:24:08 PDT 2014


Author: echristo
Date: Mon Aug  4 16:24:07 2014
New Revision: 214780

URL: http://llvm.org/viewvc/llvm-project?rev=214780&view=rev
Log:
Reimplement the temporary non-const getSubtargetImpl routine so
that we can avoid implementing it on every target. Thanks to Richard
Smith for the suggestions!

Modified:
    llvm/trunk/include/llvm/Target/TargetMachine.h

Modified: llvm/trunk/include/llvm/Target/TargetMachine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetMachine.h?rev=214780&r1=214779&r2=214780&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetMachine.h (original)
+++ llvm/trunk/include/llvm/Target/TargetMachine.h Mon Aug  4 16:24:07 2014
@@ -100,7 +100,10 @@ public:
   virtual const TargetSubtargetInfo *getSubtargetImpl() const {
     return nullptr;
   }
-  virtual TargetSubtargetInfo *getSubtargetImpl() { return nullptr; }
+  virtual TargetSubtargetInfo *getSubtargetImpl() {
+    const TargetMachine *TM = this;
+    return const_cast<TargetSubtargetInfo *>(TM->getSubtargetImpl());
+  }
 
   mutable TargetOptions Options;
 





More information about the llvm-commits mailing list