Get the cached subtarget off the MachineFunction rather than
authorEric Christopher <echristo@gmail.com>
Fri, 20 Feb 2015 08:39:06 +0000 (08:39 +0000)
committerEric Christopher <echristo@gmail.com>
Fri, 20 Feb 2015 08:39:06 +0000 (08:39 +0000)
inquiring for a new one from the TargetMachine.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230000 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/AArch64/AArch64SelectionDAGInfo.cpp
lib/Target/Mips/MipsAsmPrinter.cpp

index 0cfd5826aadf9056a0c0332bf41b2a78d0428867..b9c53998752a282247d1a90d8b6b5bf49b9f0e65 100644 (file)
@@ -28,15 +28,14 @@ SDValue AArch64SelectionDAGInfo::EmitTargetCodeForMemset(
   // Check to see if there is a specialized entry-point for memory zeroing.
   ConstantSDNode *V = dyn_cast<ConstantSDNode>(Src);
   ConstantSDNode *SizeValue = dyn_cast<ConstantSDNode>(Size);
+  const AArch64Subtarget &STI =
+      DAG.getMachineFunction().getSubtarget<AArch64Subtarget>();
   const char *bzeroEntry =
-      (V && V->isNullValue())
-          ? DAG.getTarget().getSubtarget<AArch64Subtarget>().getBZeroEntry()
-          : nullptr;
+      (V && V->isNullValue()) ? STI.getBZeroEntry() : nullptr;
   // For small size (< 256), it is not beneficial to use bzero
   // instead of memset.
   if (bzeroEntry && (!SizeValue || SizeValue->getZExtValue() > 256)) {
-    const AArch64TargetLowering &TLI =
-        *DAG.getTarget().getSubtarget<AArch64Subtarget>().getTargetLowering();
+    const AArch64TargetLowering &TLI = *STI.getTargetLowering();
 
     EVT IntPtr = TLI.getPointerTy();
     Type *IntPtrTy = getDataLayout()->getIntPtrType(*DAG.getContext());
index d1d24e03e92027eaff02d2c6ffce70696062a594..30350a93e3ab9392cdd1c799653d4c76b5040952 100644 (file)
@@ -59,7 +59,7 @@ MipsTargetStreamer &MipsAsmPrinter::getTargetStreamer() const {
 }
 
 bool MipsAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
-  Subtarget = &TM.getSubtarget<MipsSubtarget>();
+  Subtarget = &MF.getSubtarget<MipsSubtarget>();
 
   // Initialize TargetLoweringObjectFile.
   const_cast<TargetLoweringObjectFile &>(getObjFileLowering())