forked from OSchip/llvm-project
This patch adds a flag in MCAsmInfo that indicates whether dwarf register
numbers should be printed instead of symbolic register names in MCAsmStreamer::EmitRegisterName. This is necessary because some versions of GNU assembler won't accept code in which symbolic register names are used in cfi directives. There is no change in behavior unless the flag is explicitly set to true by a backend. llvm-svn: 134635
This commit is contained in:
parent
d755e6ac48
commit
2f2d9cbb22
|
@ -284,6 +284,10 @@ namespace llvm {
|
|||
// use EmitLabelOffsetDifference.
|
||||
bool DwarfUsesLabelOffsetForRanges;
|
||||
|
||||
/// DwarfRegNumForCFI - True if dwarf register numbers are printed
|
||||
/// instead of symbolic register names in .cfi_* directives.
|
||||
bool DwarfRegNumForCFI; // Defaults to false;
|
||||
|
||||
//===--- CBE Asm Translation Table -----------------------------------===//
|
||||
|
||||
const char *const *AsmTransCBE; // Defaults to empty
|
||||
|
@ -475,6 +479,9 @@ namespace llvm {
|
|||
bool doesDwarfUsesLabelOffsetForRanges() const {
|
||||
return DwarfUsesLabelOffsetForRanges;
|
||||
}
|
||||
bool useDwarfRegNumForCFI() const {
|
||||
return DwarfRegNumForCFI;
|
||||
}
|
||||
const char *const *getAsmCBE() const {
|
||||
return AsmTransCBE;
|
||||
}
|
||||
|
|
|
@ -78,6 +78,7 @@ MCAsmInfo::MCAsmInfo() {
|
|||
DwarfRequiresRelocationForSectionOffset = true;
|
||||
DwarfSectionOffsetDirective = 0;
|
||||
DwarfUsesLabelOffsetForRanges = true;
|
||||
DwarfRegNumForCFI = false;
|
||||
HasMicrosoftFastStdCallMangling = false;
|
||||
|
||||
AsmTransCBE = 0;
|
||||
|
|
|
@ -825,7 +825,7 @@ void MCAsmStreamer::EmitCFIEndProc() {
|
|||
}
|
||||
|
||||
void MCAsmStreamer::EmitRegisterName(int64_t Register) {
|
||||
if (InstPrinter) {
|
||||
if (InstPrinter && !MAI.useDwarfRegNumForCFI()) {
|
||||
const TargetAsmInfo &asmInfo = getContext().getTargetAsmInfo();
|
||||
unsigned LLVMRegister = asmInfo.getLLVMRegNum(Register, true);
|
||||
InstPrinter->printRegName(OS, LLVMRegister);
|
||||
|
|
Loading…
Reference in New Issue