mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-17 06:33:21 +00:00
move EmitEncodingByte to AsmPrinter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100349 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7a101f45c1
commit
ca6190b108
@ -82,3 +82,47 @@ void AsmPrinter::EmitCFAByte(unsigned Val) const {
|
|||||||
OutStreamer.EmitIntValue(Val, 1, 0/*addrspace*/);
|
OutStreamer.EmitIntValue(Val, 1, 0/*addrspace*/);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *DecodeDWARFEncoding(unsigned Encoding) {
|
||||||
|
switch (Encoding) {
|
||||||
|
case dwarf::DW_EH_PE_absptr: return "absptr";
|
||||||
|
case dwarf::DW_EH_PE_omit: return "omit";
|
||||||
|
case dwarf::DW_EH_PE_pcrel: return "pcrel";
|
||||||
|
case dwarf::DW_EH_PE_udata4: return "udata4";
|
||||||
|
case dwarf::DW_EH_PE_udata8: return "udata8";
|
||||||
|
case dwarf::DW_EH_PE_sdata4: return "sdata4";
|
||||||
|
case dwarf::DW_EH_PE_sdata8: return "sdata8";
|
||||||
|
case dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_udata4: return "pcrel udata4";
|
||||||
|
case dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4: return "pcrel sdata4";
|
||||||
|
case dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_udata8: return "pcrel udata8";
|
||||||
|
case dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata8: return "pcrel sdata8";
|
||||||
|
case dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |dwarf::DW_EH_PE_udata4:
|
||||||
|
return "indirect pcrel udata4";
|
||||||
|
case dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |dwarf::DW_EH_PE_sdata4:
|
||||||
|
return "indirect pcrel sdata4";
|
||||||
|
case dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |dwarf::DW_EH_PE_udata8:
|
||||||
|
return "indirect pcrel udata8";
|
||||||
|
case dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |dwarf::DW_EH_PE_sdata8:
|
||||||
|
return "indirect pcrel sdata8";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "<unknown encoding>";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// EmitEncodingByte - Emit a .byte 42 directive that corresponds to an
|
||||||
|
/// encoding. If verbose assembly output is enabled, we output comments
|
||||||
|
/// describing the encoding. Desc is an optional string saying what the
|
||||||
|
/// encoding is specifying (e.g. "LSDA").
|
||||||
|
void AsmPrinter::EmitEncodingByte(unsigned Val, const char *Desc) {
|
||||||
|
if (isVerbose()) {
|
||||||
|
if (Desc != 0)
|
||||||
|
OutStreamer.AddComment(Twine(Desc)+" Encoding = " +
|
||||||
|
Twine(DecodeDWARFEncoding(Val)));
|
||||||
|
else
|
||||||
|
OutStreamer.AddComment(Twine("Encoding = ") +
|
||||||
|
DecodeDWARFEncoding(Val));
|
||||||
|
}
|
||||||
|
|
||||||
|
OutStreamer.EmitIntValue(Val, 1, 0/*addrspace*/);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -138,14 +138,14 @@ void DwarfException::EmitCIE(const Function *PersonalityFn, unsigned Index) {
|
|||||||
|
|
||||||
// If there is a personality, we need to indicate the function's location.
|
// If there is a personality, we need to indicate the function's location.
|
||||||
if (PersonalityFn) {
|
if (PersonalityFn) {
|
||||||
EmitEncodingByte(PerEncoding, "Personality");
|
Asm->EmitEncodingByte(PerEncoding, "Personality");
|
||||||
Asm->OutStreamer.AddComment("Personality");
|
Asm->OutStreamer.AddComment("Personality");
|
||||||
EmitReference(PersonalityFn, PerEncoding);
|
EmitReference(PersonalityFn, PerEncoding);
|
||||||
}
|
}
|
||||||
if (UsesLSDA[Index])
|
if (UsesLSDA[Index])
|
||||||
EmitEncodingByte(LSDAEncoding, "LSDA");
|
Asm->EmitEncodingByte(LSDAEncoding, "LSDA");
|
||||||
if (FDEEncoding != dwarf::DW_EH_PE_absptr)
|
if (FDEEncoding != dwarf::DW_EH_PE_absptr)
|
||||||
EmitEncodingByte(FDEEncoding, "FDE");
|
Asm->EmitEncodingByte(FDEEncoding, "FDE");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Indicate locations of general callee saved registers in frame.
|
// Indicate locations of general callee saved registers in frame.
|
||||||
@ -699,8 +699,8 @@ void DwarfException::EmitExceptionTable() {
|
|||||||
Asm->getFunctionNumber()));
|
Asm->getFunctionNumber()));
|
||||||
|
|
||||||
// Emit the LSDA header.
|
// Emit the LSDA header.
|
||||||
EmitEncodingByte(dwarf::DW_EH_PE_omit, "@LPStart");
|
Asm->EmitEncodingByte(dwarf::DW_EH_PE_omit, "@LPStart");
|
||||||
EmitEncodingByte(TTypeEncoding, "@TType");
|
Asm->EmitEncodingByte(TTypeEncoding, "@TType");
|
||||||
|
|
||||||
// The type infos need to be aligned. GCC does this by inserting padding just
|
// The type infos need to be aligned. GCC does this by inserting padding just
|
||||||
// before the type infos. However, this changes the size of the exception
|
// before the type infos. However, this changes the size of the exception
|
||||||
@ -743,7 +743,7 @@ void DwarfException::EmitExceptionTable() {
|
|||||||
|
|
||||||
// SjLj Exception handling
|
// SjLj Exception handling
|
||||||
if (IsSJLJ) {
|
if (IsSJLJ) {
|
||||||
EmitEncodingByte(dwarf::DW_EH_PE_udata4, "Call site");
|
Asm->EmitEncodingByte(dwarf::DW_EH_PE_udata4, "Call site");
|
||||||
|
|
||||||
// Add extra padding if it wasn't added to the TType base offset.
|
// Add extra padding if it wasn't added to the TType base offset.
|
||||||
Asm->EmitULEB128(CallSiteTableLength, "Call site table length", SizeAlign);
|
Asm->EmitULEB128(CallSiteTableLength, "Call site table length", SizeAlign);
|
||||||
@ -786,7 +786,7 @@ void DwarfException::EmitExceptionTable() {
|
|||||||
// supposed to throw.
|
// supposed to throw.
|
||||||
|
|
||||||
// Emit the landing pad call site table.
|
// Emit the landing pad call site table.
|
||||||
EmitEncodingByte(dwarf::DW_EH_PE_udata4, "Call site");
|
Asm->EmitEncodingByte(dwarf::DW_EH_PE_udata4, "Call site");
|
||||||
|
|
||||||
// Add extra padding if it wasn't added to the TType base offset.
|
// Add extra padding if it wasn't added to the TType base offset.
|
||||||
Asm->EmitULEB128(CallSiteTableLength, "Call site table length", SizeAlign);
|
Asm->EmitULEB128(CallSiteTableLength, "Call site table length", SizeAlign);
|
||||||
|
@ -57,49 +57,6 @@ unsigned DwarfPrinter::SizeOfEncodedValue(unsigned Encoding) const {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *DecodeDWARFEncoding(unsigned Encoding) {
|
|
||||||
switch (Encoding) {
|
|
||||||
case dwarf::DW_EH_PE_absptr: return "absptr";
|
|
||||||
case dwarf::DW_EH_PE_omit: return "omit";
|
|
||||||
case dwarf::DW_EH_PE_pcrel: return "pcrel";
|
|
||||||
case dwarf::DW_EH_PE_udata4: return "udata4";
|
|
||||||
case dwarf::DW_EH_PE_udata8: return "udata8";
|
|
||||||
case dwarf::DW_EH_PE_sdata4: return "sdata4";
|
|
||||||
case dwarf::DW_EH_PE_sdata8: return "sdata8";
|
|
||||||
case dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_udata4: return "pcrel udata4";
|
|
||||||
case dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4: return "pcrel sdata4";
|
|
||||||
case dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_udata8: return "pcrel udata8";
|
|
||||||
case dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata8: return "pcrel sdata8";
|
|
||||||
case dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |dwarf::DW_EH_PE_udata4:
|
|
||||||
return "indirect pcrel udata4";
|
|
||||||
case dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |dwarf::DW_EH_PE_sdata4:
|
|
||||||
return "indirect pcrel sdata4";
|
|
||||||
case dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |dwarf::DW_EH_PE_udata8:
|
|
||||||
return "indirect pcrel udata8";
|
|
||||||
case dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |dwarf::DW_EH_PE_sdata8:
|
|
||||||
return "indirect pcrel sdata8";
|
|
||||||
}
|
|
||||||
|
|
||||||
return "<unknown encoding>";
|
|
||||||
}
|
|
||||||
|
|
||||||
/// EmitEncodingByte - Emit a .byte 42 directive that corresponds to an
|
|
||||||
/// encoding. If verbose assembly output is enabled, we output comments
|
|
||||||
/// describing the encoding. Desc is an optional string saying what the
|
|
||||||
/// encoding is specifying (e.g. "LSDA").
|
|
||||||
void DwarfPrinter::EmitEncodingByte(unsigned Val, const char *Desc) {
|
|
||||||
if (Asm->isVerbose()) {
|
|
||||||
if (Desc != 0)
|
|
||||||
Asm->OutStreamer.AddComment(Twine(Desc)+" Encoding = " +
|
|
||||||
Twine(DecodeDWARFEncoding(Val)));
|
|
||||||
else
|
|
||||||
Asm->OutStreamer.AddComment(Twine("Encoding = ") +
|
|
||||||
DecodeDWARFEncoding(Val));
|
|
||||||
}
|
|
||||||
|
|
||||||
Asm->OutStreamer.EmitIntValue(Val, 1, 0/*addrspace*/);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DwarfPrinter::EmitReference(const MCSymbol *Sym, unsigned Encoding) const {
|
void DwarfPrinter::EmitReference(const MCSymbol *Sym, unsigned Encoding) const {
|
||||||
const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
|
const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user