[PATCH] D60936: [Mips][CodeGen] Remove MachineFunction::setSubtarget. Change Mips to just copy the subtarget from the MachineFunction instead of recalculating it.

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 23 23:47:37 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL359071: [Mips][CodeGen] Remove MachineFunction::setSubtarget. Change Mips to just copy… (authored by ctopper, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D60936?vs=195970&id=196389#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60936/new/

https://reviews.llvm.org/D60936

Files:
  llvm/trunk/include/llvm/CodeGen/MachineFunction.h
  llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp
  llvm/trunk/lib/Target/Mips/MipsTargetMachine.h


Index: llvm/trunk/include/llvm/CodeGen/MachineFunction.h
===================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineFunction.h
+++ llvm/trunk/include/llvm/CodeGen/MachineFunction.h
@@ -439,7 +439,6 @@
   /// getSubtarget - Return the subtarget for which this machine code is being
   /// compiled.
   const TargetSubtargetInfo &getSubtarget() const { return *STI; }
-  void setSubtarget(const TargetSubtargetInfo *ST) { STI = ST; }
 
   /// getSubtarget - This method returns a pointer to the specified type of
   /// TargetSubtargetInfo.  In debug builds, it verifies that the object being
Index: llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp
===================================================================
--- llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp
+++ llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp
@@ -204,8 +204,7 @@
 void MipsTargetMachine::resetSubtarget(MachineFunction *MF) {
   LLVM_DEBUG(dbgs() << "resetSubtarget\n");
 
-  Subtarget = const_cast<MipsSubtarget *>(getSubtargetImpl(MF->getFunction()));
-  MF->setSubtarget(Subtarget);
+  Subtarget = &MF->getSubtarget<MipsSubtarget>();
 }
 
 namespace {
Index: llvm/trunk/lib/Target/Mips/MipsTargetMachine.h
===================================================================
--- llvm/trunk/lib/Target/Mips/MipsTargetMachine.h
+++ llvm/trunk/lib/Target/Mips/MipsTargetMachine.h
@@ -29,7 +29,7 @@
   std::unique_ptr<TargetLoweringObjectFile> TLOF;
   // Selected ABI
   MipsABIInfo ABI;
-  MipsSubtarget *Subtarget;
+  const MipsSubtarget *Subtarget;
   MipsSubtarget DefaultSubtarget;
   MipsSubtarget NoMips16Subtarget;
   MipsSubtarget Mips16Subtarget;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60936.196389.patch
Type: text/x-patch
Size: 1686 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190424/869d21b6/attachment.bin>


More information about the llvm-commits mailing list