mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-09 11:25:55 +00:00
add new JumpTableSpecialLabelPrefix hook to asmprinter for jumptable emission.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33314 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -78,6 +78,10 @@ namespace llvm {
|
|||||||
/// have names in the .o file. This is often "." or "L".
|
/// have names in the .o file. This is often "." or "L".
|
||||||
const char *PrivateGlobalPrefix; // Defaults to "."
|
const char *PrivateGlobalPrefix; // Defaults to "."
|
||||||
|
|
||||||
|
/// JumpTableSpecialLabelPrefix - If not null, a extra (dead) label is
|
||||||
|
/// emitted before jump tables with the specified prefix.
|
||||||
|
const char *JumpTableSpecialLabelPrefix; // Default to null.
|
||||||
|
|
||||||
/// GlobalVarAddrPrefix/Suffix - If these are nonempty, these strings
|
/// GlobalVarAddrPrefix/Suffix - If these are nonempty, these strings
|
||||||
/// will enclose any GlobalVariable (that isn't a function)
|
/// will enclose any GlobalVariable (that isn't a function)
|
||||||
///
|
///
|
||||||
@@ -343,6 +347,9 @@ namespace llvm {
|
|||||||
const char *getPrivateGlobalPrefix() const {
|
const char *getPrivateGlobalPrefix() const {
|
||||||
return PrivateGlobalPrefix;
|
return PrivateGlobalPrefix;
|
||||||
}
|
}
|
||||||
|
const char *getJumpTableSpecialLabelPrefix() const {
|
||||||
|
return JumpTableSpecialLabelPrefix;
|
||||||
|
}
|
||||||
const char *getGlobalVarAddrPrefix() const {
|
const char *getGlobalVarAddrPrefix() const {
|
||||||
return GlobalVarAddrPrefix;
|
return GlobalVarAddrPrefix;
|
||||||
}
|
}
|
||||||
|
@@ -244,6 +244,13 @@ void AsmPrinter::EmitJumpTableInfo(MachineJumpTableInfo *MJTI,
|
|||||||
if (EmittedSets.insert(JTBBs[ii]).second)
|
if (EmittedSets.insert(JTBBs[ii]).second)
|
||||||
printSetLabel(i, JTBBs[ii]);
|
printSetLabel(i, JTBBs[ii]);
|
||||||
|
|
||||||
|
// On some targets (e.g. darwin) we want to emit two consequtive labels
|
||||||
|
// before each jump table. The first label is never referenced, but tells
|
||||||
|
// the assembler and linker the extents of the jump table object. The
|
||||||
|
// second label is actually referenced by the code.
|
||||||
|
if (const char *JTLabelPrefix = TAI->getJumpTableSpecialLabelPrefix())
|
||||||
|
O << JTLabelPrefix << "JTI" << getFunctionNumber() << '_' << i << ":\n";
|
||||||
|
|
||||||
O << TAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber()
|
O << TAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber()
|
||||||
<< '_' << i << ":\n";
|
<< '_' << i << ":\n";
|
||||||
|
|
||||||
@@ -259,7 +266,8 @@ void AsmPrinter::EmitJumpTableInfo(MachineJumpTableInfo *MJTI,
|
|||||||
<< '_' << i << "_set_" << JTBBs[ii]->getNumber();
|
<< '_' << i << "_set_" << JTBBs[ii]->getNumber();
|
||||||
} else if (IsPic) {
|
} else if (IsPic) {
|
||||||
printBasicBlockLabel(JTBBs[ii], false, false);
|
printBasicBlockLabel(JTBBs[ii], false, false);
|
||||||
//If the arch uses custom Jump Table directives, don't calc relative to JT
|
// If the arch uses custom Jump Table directives, don't calc relative to
|
||||||
|
// JT
|
||||||
if (!HadJTEntryDirective)
|
if (!HadJTEntryDirective)
|
||||||
O << '-' << TAI->getPrivateGlobalPrefix() << "JTI"
|
O << '-' << TAI->getPrivateGlobalPrefix() << "JTI"
|
||||||
<< getFunctionNumber() << '_' << i;
|
<< getFunctionNumber() << '_' << i;
|
||||||
|
@@ -28,6 +28,7 @@ TargetAsmInfo::TargetAsmInfo() :
|
|||||||
CommentString("#"),
|
CommentString("#"),
|
||||||
GlobalPrefix(""),
|
GlobalPrefix(""),
|
||||||
PrivateGlobalPrefix("."),
|
PrivateGlobalPrefix("."),
|
||||||
|
JumpTableSpecialLabelPrefix(0),
|
||||||
GlobalVarAddrPrefix(""),
|
GlobalVarAddrPrefix(""),
|
||||||
GlobalVarAddrSuffix(""),
|
GlobalVarAddrSuffix(""),
|
||||||
FunctionAddrPrefix(""),
|
FunctionAddrPrefix(""),
|
||||||
|
Reference in New Issue
Block a user