[llvm] r233412 - [AArch64InstPrinter] Use the feature bits of the subtarget passed to the print

Akira Hatanaka ahatanaka at apple.com
Fri Mar 27 13:37:20 PDT 2015


Author: ahatanak
Date: Fri Mar 27 15:37:20 2015
New Revision: 233412

URL: http://llvm.org/viewvc/llvm-project?rev=233412&view=rev
Log:
[AArch64InstPrinter] Use the feature bits of the subtarget passed to the print
method.

This enables the instprinter to print a different system register name based on
the feature bits of the per-function subtarget. 

Differential Revision: http://reviews.llvm.org/D8668 

Added:
    llvm/trunk/test/CodeGen/AArch64/print-mrs-system-register.ll
Modified:
    llvm/trunk/lib/Target/AArch64/InstPrinter/AArch64InstPrinter.cpp

Modified: llvm/trunk/lib/Target/AArch64/InstPrinter/AArch64InstPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/InstPrinter/AArch64InstPrinter.cpp?rev=233412&r1=233411&r2=233412&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/InstPrinter/AArch64InstPrinter.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/InstPrinter/AArch64InstPrinter.cpp Fri Mar 27 15:37:20 2015
@@ -36,10 +36,7 @@ AArch64InstPrinter::AArch64InstPrinter(c
                                        const MCInstrInfo &MII,
                                        const MCRegisterInfo &MRI,
                                        const MCSubtargetInfo &STI)
-    : MCInstPrinter(MAI, MII, MRI) {
-  // Initialize the set of available features.
-  setAvailableFeatures(STI.getFeatureBits());
-}
+    : MCInstPrinter(MAI, MII, MRI) {}
 
 AArch64AppleInstPrinter::AArch64AppleInstPrinter(const MCAsmInfo &MAI,
                                                  const MCInstrInfo &MII,
@@ -1305,7 +1302,7 @@ void AArch64InstPrinter::printMRSSystemR
   unsigned Val = MI->getOperand(OpNo).getImm();
 
   auto Mapper = AArch64SysReg::MRSMapper();
-  std::string Name = Mapper.toString(Val, getAvailableFeatures());
+  std::string Name = Mapper.toString(Val, STI.getFeatureBits());
 
   O << StringRef(Name).upper();
 }
@@ -1316,7 +1313,7 @@ void AArch64InstPrinter::printMSRSystemR
   unsigned Val = MI->getOperand(OpNo).getImm();
 
   auto Mapper = AArch64SysReg::MSRMapper();
-  std::string Name = Mapper.toString(Val, getAvailableFeatures());
+  std::string Name = Mapper.toString(Val, STI.getFeatureBits());
 
   O << StringRef(Name).upper();
 }

Added: llvm/trunk/test/CodeGen/AArch64/print-mrs-system-register.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/print-mrs-system-register.ll?rev=233412&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/print-mrs-system-register.ll (added)
+++ llvm/trunk/test/CodeGen/AArch64/print-mrs-system-register.ll Fri Mar 27 15:37:20 2015
@@ -0,0 +1,11 @@
+; RUN: llc -mtriple=arm64-apple-darwin %s -o - | FileCheck %s
+
+; CHECK: mrs x0, CPM_IOACC_CTL_EL3
+
+define void @foo1() #0 {
+entry:
+  tail call void asm sideeffect "mrs x0, cpm_ioacc_ctl_el3", ""()
+  ret void
+}
+
+attributes #0 = { "target-cpu"="cyclone" }





More information about the llvm-commits mailing list