mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-11-04 05:17:07 +00:00 
			
		
		
		
	[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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233412 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
		@@ -36,10 +36,7 @@ AArch64InstPrinter::AArch64InstPrinter(const MCAsmInfo &MAI,
 | 
				
			|||||||
                                       const MCInstrInfo &MII,
 | 
					                                       const MCInstrInfo &MII,
 | 
				
			||||||
                                       const MCRegisterInfo &MRI,
 | 
					                                       const MCRegisterInfo &MRI,
 | 
				
			||||||
                                       const MCSubtargetInfo &STI)
 | 
					                                       const MCSubtargetInfo &STI)
 | 
				
			||||||
    : MCInstPrinter(MAI, MII, MRI) {
 | 
					    : MCInstPrinter(MAI, MII, MRI) {}
 | 
				
			||||||
  // Initialize the set of available features.
 | 
					 | 
				
			||||||
  setAvailableFeatures(STI.getFeatureBits());
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
AArch64AppleInstPrinter::AArch64AppleInstPrinter(const MCAsmInfo &MAI,
 | 
					AArch64AppleInstPrinter::AArch64AppleInstPrinter(const MCAsmInfo &MAI,
 | 
				
			||||||
                                                 const MCInstrInfo &MII,
 | 
					                                                 const MCInstrInfo &MII,
 | 
				
			||||||
@@ -1305,7 +1302,7 @@ void AArch64InstPrinter::printMRSSystemRegister(const MCInst *MI, unsigned OpNo,
 | 
				
			|||||||
  unsigned Val = MI->getOperand(OpNo).getImm();
 | 
					  unsigned Val = MI->getOperand(OpNo).getImm();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  auto Mapper = AArch64SysReg::MRSMapper();
 | 
					  auto Mapper = AArch64SysReg::MRSMapper();
 | 
				
			||||||
  std::string Name = Mapper.toString(Val, getAvailableFeatures());
 | 
					  std::string Name = Mapper.toString(Val, STI.getFeatureBits());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  O << StringRef(Name).upper();
 | 
					  O << StringRef(Name).upper();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -1316,7 +1313,7 @@ void AArch64InstPrinter::printMSRSystemRegister(const MCInst *MI, unsigned OpNo,
 | 
				
			|||||||
  unsigned Val = MI->getOperand(OpNo).getImm();
 | 
					  unsigned Val = MI->getOperand(OpNo).getImm();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  auto Mapper = AArch64SysReg::MSRMapper();
 | 
					  auto Mapper = AArch64SysReg::MSRMapper();
 | 
				
			||||||
  std::string Name = Mapper.toString(Val, getAvailableFeatures());
 | 
					  std::string Name = Mapper.toString(Val, STI.getFeatureBits());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  O << StringRef(Name).upper();
 | 
					  O << StringRef(Name).upper();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										11
									
								
								test/CodeGen/AArch64/print-mrs-system-register.ll
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								test/CodeGen/AArch64/print-mrs-system-register.ll
									
									
									
									
									
										Normal file
									
								
							@@ -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" }
 | 
				
			||||||
		Reference in New Issue
	
	Block a user