[PATCH] [MCInstPrinter] Enable MCInstPrinter to change its behavior based on the per-function subtarget

Akira Hatanaka ahatanak at gmail.com
Fri Mar 27 13:40:11 PDT 2015


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D8668

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

Index: llvm/trunk/lib/Target/AArch64/InstPrinter/AArch64InstPrinter.cpp
===================================================================
--- llvm/trunk/lib/Target/AArch64/InstPrinter/AArch64InstPrinter.cpp
+++ llvm/trunk/lib/Target/AArch64/InstPrinter/AArch64InstPrinter.cpp
@@ -36,10 +36,7 @@
                                        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 @@
   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 @@
   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();
 }
Index: llvm/trunk/test/CodeGen/AArch64/print-mrs-system-register.ll
===================================================================
--- llvm/trunk/test/CodeGen/AArch64/print-mrs-system-register.ll
+++ llvm/trunk/test/CodeGen/AArch64/print-mrs-system-register.ll
@@ -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" }

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8668.22817.patch
Type: text/x-patch
Size: 1947 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150327/30c7974a/attachment.bin>


More information about the llvm-commits mailing list