mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-06 20:32:19 +00:00
Updating MBlaze .mask and .frame directives to match GCC's output and fixing regression introduced in 120095 by checking MCStreamer::hasRawTextSupport.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120097 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
82dc040d06
commit
42e75a3cf1
@ -60,7 +60,7 @@ namespace {
|
|||||||
return "MBlaze Assembly Printer";
|
return "MBlaze Assembly Printer";
|
||||||
}
|
}
|
||||||
|
|
||||||
void printSavedRegsBitmask(raw_ostream &O);
|
void printSavedRegsBitmask();
|
||||||
void emitFrameDirective();
|
void emitFrameDirective();
|
||||||
virtual void EmitFunctionBodyStart();
|
virtual void EmitFunctionBodyStart();
|
||||||
virtual void EmitFunctionBodyEnd();
|
virtual void EmitFunctionBodyEnd();
|
||||||
@ -124,10 +124,9 @@ static void printHex32(unsigned int Value, raw_ostream &O) {
|
|||||||
|
|
||||||
// Create a bitmask with all callee saved registers for CPU or Floating Point
|
// Create a bitmask with all callee saved registers for CPU or Floating Point
|
||||||
// registers. For CPU registers consider RA, GP and FP for saving if necessary.
|
// registers. For CPU registers consider RA, GP and FP for saving if necessary.
|
||||||
void MBlazeAsmPrinter::printSavedRegsBitmask(raw_ostream &O) {
|
void MBlazeAsmPrinter::printSavedRegsBitmask() {
|
||||||
const TargetFrameInfo *TFI = TM.getFrameInfo();
|
const TargetFrameInfo *TFI = TM.getFrameInfo();
|
||||||
const TargetRegisterInfo &RI = *TM.getRegisterInfo();
|
const TargetRegisterInfo &RI = *TM.getRegisterInfo();
|
||||||
const MBlazeFunctionInfo *MBlazeFI = MF->getInfo<MBlazeFunctionInfo>();
|
|
||||||
|
|
||||||
// CPU Saved Registers Bitmasks
|
// CPU Saved Registers Bitmasks
|
||||||
unsigned int CPUBitmask = 0;
|
unsigned int CPUBitmask = 0;
|
||||||
@ -152,17 +151,19 @@ void MBlazeAsmPrinter::printSavedRegsBitmask(raw_ostream &O) {
|
|||||||
getRegisterNumbering(RI.getRARegister()));
|
getRegisterNumbering(RI.getRARegister()));
|
||||||
|
|
||||||
// Print CPUBitmask
|
// Print CPUBitmask
|
||||||
O << "\t.mask \t"; printHex32(CPUBitmask, O); O << ','
|
OutStreamer.EmitRawText("\t.mask\t0x" + Twine::utohexstr(CPUBitmask));
|
||||||
<< MBlazeFI->getCPUTopSavedRegOff() << '\n';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Frame Directive
|
/// Frame Directive
|
||||||
void MBlazeAsmPrinter::emitFrameDirective() {
|
void MBlazeAsmPrinter::emitFrameDirective() {
|
||||||
const TargetRegisterInfo &RI = *TM.getRegisterInfo();
|
if (!OutStreamer.hasRawTextSupport())
|
||||||
|
return;
|
||||||
|
|
||||||
|
const TargetRegisterInfo &RI = *TM.getRegisterInfo();
|
||||||
unsigned stkReg = RI.getFrameRegister(*MF);
|
unsigned stkReg = RI.getFrameRegister(*MF);
|
||||||
unsigned retReg = RI.getRARegister();
|
unsigned retReg = RI.getRARegister();
|
||||||
unsigned stkSze = MF->getFrameInfo()->getStackSize();
|
unsigned stkSze = MF->getFrameInfo()->getStackSize();
|
||||||
|
if (stkSze < 28 && MF->getFrameInfo()->adjustsStack()) stkSze = 28;
|
||||||
|
|
||||||
OutStreamer.EmitRawText("\t.frame\t" +
|
OutStreamer.EmitRawText("\t.frame\t" +
|
||||||
Twine(MBlazeInstPrinter::getRegisterName(stkReg)) +
|
Twine(MBlazeInstPrinter::getRegisterName(stkReg)) +
|
||||||
@ -171,21 +172,27 @@ void MBlazeAsmPrinter::emitFrameDirective() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MBlazeAsmPrinter::EmitFunctionEntryLabel() {
|
void MBlazeAsmPrinter::EmitFunctionEntryLabel() {
|
||||||
OutStreamer.EmitRawText("\t.ent\t" + Twine(CurrentFnSym->getName()));
|
if (OutStreamer.hasRawTextSupport())
|
||||||
|
OutStreamer.EmitRawText("\t.ent\t" + Twine(CurrentFnSym->getName()));
|
||||||
AsmPrinter::EmitFunctionEntryLabel();
|
AsmPrinter::EmitFunctionEntryLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MBlazeAsmPrinter::EmitFunctionBodyStart() {
|
void MBlazeAsmPrinter::EmitFunctionBodyStart() {
|
||||||
emitFrameDirective();
|
if (!OutStreamer.hasRawTextSupport())
|
||||||
|
return;
|
||||||
|
|
||||||
SmallString<128> Str;
|
emitFrameDirective();
|
||||||
raw_svector_ostream OS(Str);
|
printSavedRegsBitmask();
|
||||||
printSavedRegsBitmask(OS);
|
|
||||||
OutStreamer.EmitRawText(OS.str());
|
// SmallString<128> Str;
|
||||||
|
// raw_svector_ostream OS(Str);
|
||||||
|
// printSavedRegsBitmask(OS);
|
||||||
|
// OutStreamer.EmitRawText(OS.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MBlazeAsmPrinter::EmitFunctionBodyEnd() {
|
void MBlazeAsmPrinter::EmitFunctionBodyEnd() {
|
||||||
OutStreamer.EmitRawText("\t.end\t" + Twine(CurrentFnSym->getName()));
|
if (OutStreamer.hasRawTextSupport())
|
||||||
|
OutStreamer.EmitRawText("\t.end\t" + Twine(CurrentFnSym->getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
Loading…
Reference in New Issue
Block a user