mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-28 03:25:23 +00:00
Tidy up. 80 columns and trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128504 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -70,17 +70,17 @@ static unsigned getGVAlignmentLog2(const GlobalValue *GV, const TargetData &TD,
|
|||||||
unsigned NumBits = 0;
|
unsigned NumBits = 0;
|
||||||
if (const GlobalVariable *GVar = dyn_cast<GlobalVariable>(GV))
|
if (const GlobalVariable *GVar = dyn_cast<GlobalVariable>(GV))
|
||||||
NumBits = TD.getPreferredAlignmentLog(GVar);
|
NumBits = TD.getPreferredAlignmentLog(GVar);
|
||||||
|
|
||||||
// If InBits is specified, round it to it.
|
// If InBits is specified, round it to it.
|
||||||
if (InBits > NumBits)
|
if (InBits > NumBits)
|
||||||
NumBits = InBits;
|
NumBits = InBits;
|
||||||
|
|
||||||
// If the GV has a specified alignment, take it into account.
|
// If the GV has a specified alignment, take it into account.
|
||||||
if (GV->getAlignment() == 0)
|
if (GV->getAlignment() == 0)
|
||||||
return NumBits;
|
return NumBits;
|
||||||
|
|
||||||
unsigned GVAlign = Log2_32(GV->getAlignment());
|
unsigned GVAlign = Log2_32(GV->getAlignment());
|
||||||
|
|
||||||
// If the GVAlign is larger than NumBits, or if we are required to obey
|
// If the GVAlign is larger than NumBits, or if we are required to obey
|
||||||
// NumBits because the GV has an assigned section, obey it.
|
// NumBits because the GV has an assigned section, obey it.
|
||||||
if (GVAlign > NumBits || GV->hasSection())
|
if (GVAlign > NumBits || GV->hasSection())
|
||||||
@@ -104,16 +104,16 @@ AsmPrinter::AsmPrinter(TargetMachine &tm, MCStreamer &Streamer)
|
|||||||
|
|
||||||
AsmPrinter::~AsmPrinter() {
|
AsmPrinter::~AsmPrinter() {
|
||||||
assert(DD == 0 && DE == 0 && "Debug/EH info didn't get finalized");
|
assert(DD == 0 && DE == 0 && "Debug/EH info didn't get finalized");
|
||||||
|
|
||||||
if (GCMetadataPrinters != 0) {
|
if (GCMetadataPrinters != 0) {
|
||||||
gcp_map_type &GCMap = getGCMap(GCMetadataPrinters);
|
gcp_map_type &GCMap = getGCMap(GCMetadataPrinters);
|
||||||
|
|
||||||
for (gcp_map_type::iterator I = GCMap.begin(), E = GCMap.end(); I != E; ++I)
|
for (gcp_map_type::iterator I = GCMap.begin(), E = GCMap.end(); I != E; ++I)
|
||||||
delete I->second;
|
delete I->second;
|
||||||
delete &GCMap;
|
delete &GCMap;
|
||||||
GCMetadataPrinters = 0;
|
GCMetadataPrinters = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete &OutStreamer;
|
delete &OutStreamer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,9 +156,9 @@ bool AsmPrinter::doInitialization(Module &M) {
|
|||||||
// Initialize TargetLoweringObjectFile.
|
// Initialize TargetLoweringObjectFile.
|
||||||
const_cast<TargetLoweringObjectFile&>(getObjFileLowering())
|
const_cast<TargetLoweringObjectFile&>(getObjFileLowering())
|
||||||
.Initialize(OutContext, TM);
|
.Initialize(OutContext, TM);
|
||||||
|
|
||||||
Mang = new Mangler(OutContext, *TM.getTargetData());
|
Mang = new Mangler(OutContext, *TM.getTargetData());
|
||||||
|
|
||||||
// Allow the target to emit any magic that it wants at the start of the file.
|
// Allow the target to emit any magic that it wants at the start of the file.
|
||||||
EmitStartOfAsmFile(M);
|
EmitStartOfAsmFile(M);
|
||||||
|
|
||||||
@@ -255,7 +255,7 @@ void AsmPrinter::EmitLinkage(unsigned Linkage, MCSymbol *GVSym) const {
|
|||||||
void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
|
void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
|
||||||
if (!GV->hasInitializer()) // External globals require no code.
|
if (!GV->hasInitializer()) // External globals require no code.
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Check to see if this is a special global used by LLVM, if so, emit it.
|
// Check to see if this is a special global used by LLVM, if so, emit it.
|
||||||
if (EmitSpecialLLVMGlobal(GV))
|
if (EmitSpecialLLVMGlobal(GV))
|
||||||
return;
|
return;
|
||||||
@@ -265,44 +265,44 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
|
|||||||
/*PrintType=*/false, GV->getParent());
|
/*PrintType=*/false, GV->getParent());
|
||||||
OutStreamer.GetCommentOS() << '\n';
|
OutStreamer.GetCommentOS() << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
MCSymbol *GVSym = Mang->getSymbol(GV);
|
MCSymbol *GVSym = Mang->getSymbol(GV);
|
||||||
EmitVisibility(GVSym, GV->getVisibility());
|
EmitVisibility(GVSym, GV->getVisibility());
|
||||||
|
|
||||||
if (MAI->hasDotTypeDotSizeDirective())
|
if (MAI->hasDotTypeDotSizeDirective())
|
||||||
OutStreamer.EmitSymbolAttribute(GVSym, MCSA_ELF_TypeObject);
|
OutStreamer.EmitSymbolAttribute(GVSym, MCSA_ELF_TypeObject);
|
||||||
|
|
||||||
SectionKind GVKind = TargetLoweringObjectFile::getKindForGlobal(GV, TM);
|
SectionKind GVKind = TargetLoweringObjectFile::getKindForGlobal(GV, TM);
|
||||||
|
|
||||||
const TargetData *TD = TM.getTargetData();
|
const TargetData *TD = TM.getTargetData();
|
||||||
uint64_t Size = TD->getTypeAllocSize(GV->getType()->getElementType());
|
uint64_t Size = TD->getTypeAllocSize(GV->getType()->getElementType());
|
||||||
|
|
||||||
// If the alignment is specified, we *must* obey it. Overaligning a global
|
// If the alignment is specified, we *must* obey it. Overaligning a global
|
||||||
// with a specified alignment is a prompt way to break globals emitted to
|
// with a specified alignment is a prompt way to break globals emitted to
|
||||||
// sections and expected to be contiguous (e.g. ObjC metadata).
|
// sections and expected to be contiguous (e.g. ObjC metadata).
|
||||||
unsigned AlignLog = getGVAlignmentLog2(GV, *TD);
|
unsigned AlignLog = getGVAlignmentLog2(GV, *TD);
|
||||||
|
|
||||||
// Handle common and BSS local symbols (.lcomm).
|
// Handle common and BSS local symbols (.lcomm).
|
||||||
if (GVKind.isCommon() || GVKind.isBSSLocal()) {
|
if (GVKind.isCommon() || GVKind.isBSSLocal()) {
|
||||||
if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it.
|
if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it.
|
||||||
|
|
||||||
if (isVerbose()) {
|
if (isVerbose()) {
|
||||||
WriteAsOperand(OutStreamer.GetCommentOS(), GV,
|
WriteAsOperand(OutStreamer.GetCommentOS(), GV,
|
||||||
/*PrintType=*/false, GV->getParent());
|
/*PrintType=*/false, GV->getParent());
|
||||||
OutStreamer.GetCommentOS() << '\n';
|
OutStreamer.GetCommentOS() << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle common symbols.
|
// Handle common symbols.
|
||||||
if (GVKind.isCommon()) {
|
if (GVKind.isCommon()) {
|
||||||
unsigned Align = 1 << AlignLog;
|
unsigned Align = 1 << AlignLog;
|
||||||
if (!getObjFileLowering().getCommDirectiveSupportsAlignment())
|
if (!getObjFileLowering().getCommDirectiveSupportsAlignment())
|
||||||
Align = 0;
|
Align = 0;
|
||||||
|
|
||||||
// .comm _foo, 42, 4
|
// .comm _foo, 42, 4
|
||||||
OutStreamer.EmitCommonSymbol(GVSym, Size, Align);
|
OutStreamer.EmitCommonSymbol(GVSym, Size, Align);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle local BSS symbols.
|
// Handle local BSS symbols.
|
||||||
if (MAI->hasMachoZeroFillDirective()) {
|
if (MAI->hasMachoZeroFillDirective()) {
|
||||||
const MCSection *TheSection =
|
const MCSection *TheSection =
|
||||||
@@ -311,7 +311,7 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
|
|||||||
OutStreamer.EmitZerofill(TheSection, GVSym, Size, 1 << AlignLog);
|
OutStreamer.EmitZerofill(TheSection, GVSym, Size, 1 << AlignLog);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MAI->hasLCOMMDirective()) {
|
if (MAI->hasLCOMMDirective()) {
|
||||||
// .lcomm _foo, 42
|
// .lcomm _foo, 42
|
||||||
OutStreamer.EmitLocalCommonSymbol(GVSym, Size);
|
OutStreamer.EmitLocalCommonSymbol(GVSym, Size);
|
||||||
@@ -321,14 +321,14 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
|
|||||||
unsigned Align = 1 << AlignLog;
|
unsigned Align = 1 << AlignLog;
|
||||||
if (!getObjFileLowering().getCommDirectiveSupportsAlignment())
|
if (!getObjFileLowering().getCommDirectiveSupportsAlignment())
|
||||||
Align = 0;
|
Align = 0;
|
||||||
|
|
||||||
// .local _foo
|
// .local _foo
|
||||||
OutStreamer.EmitSymbolAttribute(GVSym, MCSA_Local);
|
OutStreamer.EmitSymbolAttribute(GVSym, MCSA_Local);
|
||||||
// .comm _foo, 42, 4
|
// .comm _foo, 42, 4
|
||||||
OutStreamer.EmitCommonSymbol(GVSym, Size, Align);
|
OutStreamer.EmitCommonSymbol(GVSym, Size, Align);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *TheSection =
|
const MCSection *TheSection =
|
||||||
getObjFileLowering().SectionForGlobal(GV, GVKind, Mang, TM);
|
getObjFileLowering().SectionForGlobal(GV, GVKind, Mang, TM);
|
||||||
|
|
||||||
@@ -336,14 +336,14 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
|
|||||||
// emission.
|
// emission.
|
||||||
if (GVKind.isBSSExtern() && MAI->hasMachoZeroFillDirective()) {
|
if (GVKind.isBSSExtern() && MAI->hasMachoZeroFillDirective()) {
|
||||||
if (Size == 0) Size = 1; // zerofill of 0 bytes is undefined.
|
if (Size == 0) Size = 1; // zerofill of 0 bytes is undefined.
|
||||||
|
|
||||||
// .globl _foo
|
// .globl _foo
|
||||||
OutStreamer.EmitSymbolAttribute(GVSym, MCSA_Global);
|
OutStreamer.EmitSymbolAttribute(GVSym, MCSA_Global);
|
||||||
// .zerofill __DATA, __common, _foo, 400, 5
|
// .zerofill __DATA, __common, _foo, 400, 5
|
||||||
OutStreamer.EmitZerofill(TheSection, GVSym, Size, 1 << AlignLog);
|
OutStreamer.EmitZerofill(TheSection, GVSym, Size, 1 << AlignLog);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle thread local data for mach-o which requires us to output an
|
// Handle thread local data for mach-o which requires us to output an
|
||||||
// additional structure of data and mangle the original symbol so that we
|
// additional structure of data and mangle the original symbol so that we
|
||||||
// can reference it later.
|
// can reference it later.
|
||||||
@@ -356,31 +356,31 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
|
|||||||
// specific code.
|
// specific code.
|
||||||
if (GVKind.isThreadLocal() && MAI->hasMachoTBSSDirective()) {
|
if (GVKind.isThreadLocal() && MAI->hasMachoTBSSDirective()) {
|
||||||
// Emit the .tbss symbol
|
// Emit the .tbss symbol
|
||||||
MCSymbol *MangSym =
|
MCSymbol *MangSym =
|
||||||
OutContext.GetOrCreateSymbol(GVSym->getName() + Twine("$tlv$init"));
|
OutContext.GetOrCreateSymbol(GVSym->getName() + Twine("$tlv$init"));
|
||||||
|
|
||||||
if (GVKind.isThreadBSS())
|
if (GVKind.isThreadBSS())
|
||||||
OutStreamer.EmitTBSSSymbol(TheSection, MangSym, Size, 1 << AlignLog);
|
OutStreamer.EmitTBSSSymbol(TheSection, MangSym, Size, 1 << AlignLog);
|
||||||
else if (GVKind.isThreadData()) {
|
else if (GVKind.isThreadData()) {
|
||||||
OutStreamer.SwitchSection(TheSection);
|
OutStreamer.SwitchSection(TheSection);
|
||||||
|
|
||||||
EmitAlignment(AlignLog, GV);
|
EmitAlignment(AlignLog, GV);
|
||||||
OutStreamer.EmitLabel(MangSym);
|
OutStreamer.EmitLabel(MangSym);
|
||||||
|
|
||||||
EmitGlobalConstant(GV->getInitializer());
|
EmitGlobalConstant(GV->getInitializer());
|
||||||
}
|
}
|
||||||
|
|
||||||
OutStreamer.AddBlankLine();
|
OutStreamer.AddBlankLine();
|
||||||
|
|
||||||
// Emit the variable struct for the runtime.
|
// Emit the variable struct for the runtime.
|
||||||
const MCSection *TLVSect
|
const MCSection *TLVSect
|
||||||
= getObjFileLowering().getTLSExtraDataSection();
|
= getObjFileLowering().getTLSExtraDataSection();
|
||||||
|
|
||||||
OutStreamer.SwitchSection(TLVSect);
|
OutStreamer.SwitchSection(TLVSect);
|
||||||
// Emit the linkage here.
|
// Emit the linkage here.
|
||||||
EmitLinkage(GV->getLinkage(), GVSym);
|
EmitLinkage(GV->getLinkage(), GVSym);
|
||||||
OutStreamer.EmitLabel(GVSym);
|
OutStreamer.EmitLabel(GVSym);
|
||||||
|
|
||||||
// Three pointers in size:
|
// Three pointers in size:
|
||||||
// - __tlv_bootstrap - used to make sure support exists
|
// - __tlv_bootstrap - used to make sure support exists
|
||||||
// - spare pointer, used when mapped by the runtime
|
// - spare pointer, used when mapped by the runtime
|
||||||
@@ -390,7 +390,7 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
|
|||||||
PtrSize, 0);
|
PtrSize, 0);
|
||||||
OutStreamer.EmitIntValue(0, PtrSize, 0);
|
OutStreamer.EmitIntValue(0, PtrSize, 0);
|
||||||
OutStreamer.EmitSymbolValue(MangSym, PtrSize, 0);
|
OutStreamer.EmitSymbolValue(MangSym, PtrSize, 0);
|
||||||
|
|
||||||
OutStreamer.AddBlankLine();
|
OutStreamer.AddBlankLine();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -407,7 +407,7 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
|
|||||||
if (MAI->hasDotTypeDotSizeDirective())
|
if (MAI->hasDotTypeDotSizeDirective())
|
||||||
// .size foo, 42
|
// .size foo, 42
|
||||||
OutStreamer.EmitELFSize(GVSym, MCConstantExpr::Create(Size, OutContext));
|
OutStreamer.EmitELFSize(GVSym, MCConstantExpr::Create(Size, OutContext));
|
||||||
|
|
||||||
OutStreamer.AddBlankLine();
|
OutStreamer.AddBlankLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -416,7 +416,7 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
|
|||||||
void AsmPrinter::EmitFunctionHeader() {
|
void AsmPrinter::EmitFunctionHeader() {
|
||||||
// Print out constants referenced by the function
|
// Print out constants referenced by the function
|
||||||
EmitConstantPool();
|
EmitConstantPool();
|
||||||
|
|
||||||
// Print the 'header' of function.
|
// Print the 'header' of function.
|
||||||
const Function *F = MF->getFunction();
|
const Function *F = MF->getFunction();
|
||||||
|
|
||||||
@@ -438,7 +438,7 @@ void AsmPrinter::EmitFunctionHeader() {
|
|||||||
// Emit the CurrentFnSym. This is a virtual function to allow targets to
|
// Emit the CurrentFnSym. This is a virtual function to allow targets to
|
||||||
// do their wild and crazy things as required.
|
// do their wild and crazy things as required.
|
||||||
EmitFunctionEntryLabel();
|
EmitFunctionEntryLabel();
|
||||||
|
|
||||||
// If the function had address-taken blocks that got deleted, then we have
|
// If the function had address-taken blocks that got deleted, then we have
|
||||||
// references to the dangling symbols. Emit them at the start of the function
|
// references to the dangling symbols. Emit them at the start of the function
|
||||||
// so that we don't get references to undefined symbols.
|
// so that we don't get references to undefined symbols.
|
||||||
@@ -448,17 +448,17 @@ void AsmPrinter::EmitFunctionHeader() {
|
|||||||
OutStreamer.AddComment("Address taken block that was later removed");
|
OutStreamer.AddComment("Address taken block that was later removed");
|
||||||
OutStreamer.EmitLabel(DeadBlockSyms[i]);
|
OutStreamer.EmitLabel(DeadBlockSyms[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add some workaround for linkonce linkage on Cygwin\MinGW.
|
// Add some workaround for linkonce linkage on Cygwin\MinGW.
|
||||||
if (MAI->getLinkOnceDirective() != 0 &&
|
if (MAI->getLinkOnceDirective() != 0 &&
|
||||||
(F->hasLinkOnceLinkage() || F->hasWeakLinkage())) {
|
(F->hasLinkOnceLinkage() || F->hasWeakLinkage())) {
|
||||||
// FIXME: What is this?
|
// FIXME: What is this?
|
||||||
MCSymbol *FakeStub =
|
MCSymbol *FakeStub =
|
||||||
OutContext.GetOrCreateSymbol(Twine("Lllvm$workaround$fake$stub$")+
|
OutContext.GetOrCreateSymbol(Twine("Lllvm$workaround$fake$stub$")+
|
||||||
CurrentFnSym->getName());
|
CurrentFnSym->getName());
|
||||||
OutStreamer.EmitLabel(FakeStub);
|
OutStreamer.EmitLabel(FakeStub);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Emit pre-function debug and/or EH information.
|
// Emit pre-function debug and/or EH information.
|
||||||
if (DE) {
|
if (DE) {
|
||||||
NamedRegionTimer T(EHTimerName, DWARFGroupName, TimePassesIsEnabled);
|
NamedRegionTimer T(EHTimerName, DWARFGroupName, TimePassesIsEnabled);
|
||||||
@@ -483,7 +483,7 @@ void AsmPrinter::EmitFunctionEntryLabel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void EmitDebugLoc(DebugLoc DL, const MachineFunction *MF,
|
static void EmitDebugLoc(DebugLoc DL, const MachineFunction *MF,
|
||||||
raw_ostream &CommentOS) {
|
raw_ostream &CommentOS) {
|
||||||
const LLVMContext &Ctx = MF->getFunction()->getContext();
|
const LLVMContext &Ctx = MF->getFunction()->getContext();
|
||||||
if (!DL.isUnknown()) { // Print source line info.
|
if (!DL.isUnknown()) { // Print source line info.
|
||||||
@@ -509,18 +509,18 @@ static void EmitDebugLoc(DebugLoc DL, const MachineFunction *MF,
|
|||||||
static void EmitComments(const MachineInstr &MI, raw_ostream &CommentOS) {
|
static void EmitComments(const MachineInstr &MI, raw_ostream &CommentOS) {
|
||||||
const MachineFunction *MF = MI.getParent()->getParent();
|
const MachineFunction *MF = MI.getParent()->getParent();
|
||||||
const TargetMachine &TM = MF->getTarget();
|
const TargetMachine &TM = MF->getTarget();
|
||||||
|
|
||||||
DebugLoc DL = MI.getDebugLoc();
|
DebugLoc DL = MI.getDebugLoc();
|
||||||
if (!DL.isUnknown()) { // Print source line info.
|
if (!DL.isUnknown()) { // Print source line info.
|
||||||
EmitDebugLoc(DL, MF, CommentOS);
|
EmitDebugLoc(DL, MF, CommentOS);
|
||||||
CommentOS << '\n';
|
CommentOS << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for spills and reloads
|
// Check for spills and reloads
|
||||||
int FI;
|
int FI;
|
||||||
|
|
||||||
const MachineFrameInfo *FrameInfo = MF->getFrameInfo();
|
const MachineFrameInfo *FrameInfo = MF->getFrameInfo();
|
||||||
|
|
||||||
// We assume a single instruction only has a spill or reload, not
|
// We assume a single instruction only has a spill or reload, not
|
||||||
// both.
|
// both.
|
||||||
const MachineMemOperand *MMO;
|
const MachineMemOperand *MMO;
|
||||||
@@ -541,7 +541,7 @@ static void EmitComments(const MachineInstr &MI, raw_ostream &CommentOS) {
|
|||||||
if (FrameInfo->isSpillSlotObjectIndex(FI))
|
if (FrameInfo->isSpillSlotObjectIndex(FI))
|
||||||
CommentOS << MMO->getSize() << "-byte Folded Spill\n";
|
CommentOS << MMO->getSize() << "-byte Folded Spill\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for spill-induced copies
|
// Check for spill-induced copies
|
||||||
if (MI.getAsmPrinterFlag(MachineInstr::ReloadReuse))
|
if (MI.getAsmPrinterFlag(MachineInstr::ReloadReuse))
|
||||||
CommentOS << " Reload Reuse\n";
|
CommentOS << " Reload Reuse\n";
|
||||||
@@ -615,7 +615,7 @@ static bool EmitDebugValueComment(const MachineInstr *MI, AsmPrinter &AP) {
|
|||||||
}
|
}
|
||||||
OS << AP.TM.getRegisterInfo()->getName(MI->getOperand(0).getReg());
|
OS << AP.TM.getRegisterInfo()->getName(MI->getOperand(0).getReg());
|
||||||
}
|
}
|
||||||
|
|
||||||
OS << '+' << MI->getOperand(1).getImm();
|
OS << '+' << MI->getOperand(1).getImm();
|
||||||
// NOTE: Want this comment at start of line, don't emit with AddComment.
|
// NOTE: Want this comment at start of line, don't emit with AddComment.
|
||||||
AP.OutStreamer.EmitRawText(OS.str());
|
AP.OutStreamer.EmitRawText(OS.str());
|
||||||
@@ -627,9 +627,9 @@ static bool EmitDebugValueComment(const MachineInstr *MI, AsmPrinter &AP) {
|
|||||||
void AsmPrinter::EmitFunctionBody() {
|
void AsmPrinter::EmitFunctionBody() {
|
||||||
// Emit target-specific gunk before the function body.
|
// Emit target-specific gunk before the function body.
|
||||||
EmitFunctionBodyStart();
|
EmitFunctionBodyStart();
|
||||||
|
|
||||||
bool ShouldPrintDebugScopes = DD && MMI->hasDebugInfo();
|
bool ShouldPrintDebugScopes = DD && MMI->hasDebugInfo();
|
||||||
|
|
||||||
// Print out code for the function.
|
// Print out code for the function.
|
||||||
bool HasAnyRealCode = false;
|
bool HasAnyRealCode = false;
|
||||||
const MachineInstr *LastMI = 0;
|
const MachineInstr *LastMI = 0;
|
||||||
@@ -652,7 +652,7 @@ void AsmPrinter::EmitFunctionBody() {
|
|||||||
NamedRegionTimer T(DbgTimerName, DWARFGroupName, TimePassesIsEnabled);
|
NamedRegionTimer T(DbgTimerName, DWARFGroupName, TimePassesIsEnabled);
|
||||||
DD->beginInstruction(II);
|
DD->beginInstruction(II);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isVerbose())
|
if (isVerbose())
|
||||||
EmitComments(*II, OutStreamer.GetCommentOS());
|
EmitComments(*II, OutStreamer.GetCommentOS());
|
||||||
|
|
||||||
@@ -681,7 +681,7 @@ void AsmPrinter::EmitFunctionBody() {
|
|||||||
EmitInstruction(II);
|
EmitInstruction(II);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ShouldPrintDebugScopes) {
|
if (ShouldPrintDebugScopes) {
|
||||||
NamedRegionTimer T(DbgTimerName, DWARFGroupName, TimePassesIsEnabled);
|
NamedRegionTimer T(DbgTimerName, DWARFGroupName, TimePassesIsEnabled);
|
||||||
DD->endInstruction(II);
|
DD->endInstruction(II);
|
||||||
@@ -708,10 +708,10 @@ void AsmPrinter::EmitFunctionBody() {
|
|||||||
} else // Target not mc-ized yet.
|
} else // Target not mc-ized yet.
|
||||||
OutStreamer.EmitRawText(StringRef("\tnop\n"));
|
OutStreamer.EmitRawText(StringRef("\tnop\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Emit target-specific gunk after the function body.
|
// Emit target-specific gunk after the function body.
|
||||||
EmitFunctionBodyEnd();
|
EmitFunctionBodyEnd();
|
||||||
|
|
||||||
// If the target wants a .size directive for the size of the function, emit
|
// If the target wants a .size directive for the size of the function, emit
|
||||||
// it.
|
// it.
|
||||||
if (MAI->hasDotTypeDotSizeDirective()) {
|
if (MAI->hasDotTypeDotSizeDirective()) {
|
||||||
@@ -719,14 +719,14 @@ void AsmPrinter::EmitFunctionBody() {
|
|||||||
// difference between the function label and the temp label.
|
// difference between the function label and the temp label.
|
||||||
MCSymbol *FnEndLabel = OutContext.CreateTempSymbol();
|
MCSymbol *FnEndLabel = OutContext.CreateTempSymbol();
|
||||||
OutStreamer.EmitLabel(FnEndLabel);
|
OutStreamer.EmitLabel(FnEndLabel);
|
||||||
|
|
||||||
const MCExpr *SizeExp =
|
const MCExpr *SizeExp =
|
||||||
MCBinaryExpr::CreateSub(MCSymbolRefExpr::Create(FnEndLabel, OutContext),
|
MCBinaryExpr::CreateSub(MCSymbolRefExpr::Create(FnEndLabel, OutContext),
|
||||||
MCSymbolRefExpr::Create(CurrentFnSym, OutContext),
|
MCSymbolRefExpr::Create(CurrentFnSym, OutContext),
|
||||||
OutContext);
|
OutContext);
|
||||||
OutStreamer.EmitELFSize(CurrentFnSym, SizeExp);
|
OutStreamer.EmitELFSize(CurrentFnSym, SizeExp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Emit post-function debug information.
|
// Emit post-function debug information.
|
||||||
if (DD) {
|
if (DD) {
|
||||||
NamedRegionTimer T(DbgTimerName, DWARFGroupName, TimePassesIsEnabled);
|
NamedRegionTimer T(DbgTimerName, DWARFGroupName, TimePassesIsEnabled);
|
||||||
@@ -737,16 +737,17 @@ void AsmPrinter::EmitFunctionBody() {
|
|||||||
DE->EndFunction();
|
DE->EndFunction();
|
||||||
}
|
}
|
||||||
MMI->EndFunction();
|
MMI->EndFunction();
|
||||||
|
|
||||||
// Print out jump tables referenced by the function.
|
// Print out jump tables referenced by the function.
|
||||||
EmitJumpTableInfo();
|
EmitJumpTableInfo();
|
||||||
|
|
||||||
OutStreamer.AddBlankLine();
|
OutStreamer.AddBlankLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getDebugValueLocation - Get location information encoded by DBG_VALUE
|
/// getDebugValueLocation - Get location information encoded by DBG_VALUE
|
||||||
/// operands.
|
/// operands.
|
||||||
MachineLocation AsmPrinter::getDebugValueLocation(const MachineInstr *MI) const {
|
MachineLocation AsmPrinter::
|
||||||
|
getDebugValueLocation(const MachineInstr *MI) const {
|
||||||
// Target specific DBG_VALUE instructions are handled by each target.
|
// Target specific DBG_VALUE instructions are handled by each target.
|
||||||
return MachineLocation();
|
return MachineLocation();
|
||||||
}
|
}
|
||||||
@@ -785,7 +786,7 @@ bool AsmPrinter::doFinalization(Module &M) {
|
|||||||
}
|
}
|
||||||
delete DD; DD = 0;
|
delete DD; DD = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the target wants to know about weak references, print them all.
|
// If the target wants to know about weak references, print them all.
|
||||||
if (MAI->getWeakRefDirective()) {
|
if (MAI->getWeakRefDirective()) {
|
||||||
// FIXME: This is not lazy, it would be nice to only print weak references
|
// FIXME: This is not lazy, it would be nice to only print weak references
|
||||||
@@ -799,7 +800,7 @@ bool AsmPrinter::doFinalization(Module &M) {
|
|||||||
if (!I->hasExternalWeakLinkage()) continue;
|
if (!I->hasExternalWeakLinkage()) continue;
|
||||||
OutStreamer.EmitSymbolAttribute(Mang->getSymbol(I), MCSA_WeakReference);
|
OutStreamer.EmitSymbolAttribute(Mang->getSymbol(I), MCSA_WeakReference);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Module::const_iterator I = M.begin(), E = M.end(); I != E; ++I) {
|
for (Module::const_iterator I = M.begin(), E = M.end(); I != E; ++I) {
|
||||||
if (!I->hasExternalWeakLinkage()) continue;
|
if (!I->hasExternalWeakLinkage()) continue;
|
||||||
OutStreamer.EmitSymbolAttribute(Mang->getSymbol(I), MCSA_WeakReference);
|
OutStreamer.EmitSymbolAttribute(Mang->getSymbol(I), MCSA_WeakReference);
|
||||||
@@ -825,7 +826,7 @@ bool AsmPrinter::doFinalization(Module &M) {
|
|||||||
EmitVisibility(Name, I->getVisibility());
|
EmitVisibility(Name, I->getVisibility());
|
||||||
|
|
||||||
// Emit the directives as assignments aka .set:
|
// Emit the directives as assignments aka .set:
|
||||||
OutStreamer.EmitAssignment(Name,
|
OutStreamer.EmitAssignment(Name,
|
||||||
MCSymbolRefExpr::Create(Target, OutContext));
|
MCSymbolRefExpr::Create(Target, OutContext));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -842,14 +843,14 @@ bool AsmPrinter::doFinalization(Module &M) {
|
|||||||
if (!InitTrampolineIntrinsic || InitTrampolineIntrinsic->use_empty())
|
if (!InitTrampolineIntrinsic || InitTrampolineIntrinsic->use_empty())
|
||||||
if (const MCSection *S = MAI->getNonexecutableStackSection(OutContext))
|
if (const MCSection *S = MAI->getNonexecutableStackSection(OutContext))
|
||||||
OutStreamer.SwitchSection(S);
|
OutStreamer.SwitchSection(S);
|
||||||
|
|
||||||
// Allow the target to emit any magic that it wants at the end of the file,
|
// Allow the target to emit any magic that it wants at the end of the file,
|
||||||
// after everything else has gone out.
|
// after everything else has gone out.
|
||||||
EmitEndOfAsmFile(M);
|
EmitEndOfAsmFile(M);
|
||||||
|
|
||||||
delete Mang; Mang = 0;
|
delete Mang; Mang = 0;
|
||||||
MMI = 0;
|
MMI = 0;
|
||||||
|
|
||||||
OutStreamer.Finish();
|
OutStreamer.Finish();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -889,7 +890,7 @@ void AsmPrinter::EmitConstantPool() {
|
|||||||
for (unsigned i = 0, e = CP.size(); i != e; ++i) {
|
for (unsigned i = 0, e = CP.size(); i != e; ++i) {
|
||||||
const MachineConstantPoolEntry &CPE = CP[i];
|
const MachineConstantPoolEntry &CPE = CP[i];
|
||||||
unsigned Align = CPE.getAlignment();
|
unsigned Align = CPE.getAlignment();
|
||||||
|
|
||||||
SectionKind Kind;
|
SectionKind Kind;
|
||||||
switch (CPE.getRelocationInfo()) {
|
switch (CPE.getRelocationInfo()) {
|
||||||
default: llvm_unreachable("Unknown section kind");
|
default: llvm_unreachable("Unknown section kind");
|
||||||
@@ -907,7 +908,7 @@ void AsmPrinter::EmitConstantPool() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *S = getObjFileLowering().getSectionForConstant(Kind);
|
const MCSection *S = getObjFileLowering().getSectionForConstant(Kind);
|
||||||
|
|
||||||
// The number of sections are small, just do a linear search from the
|
// The number of sections are small, just do a linear search from the
|
||||||
// last section to the first.
|
// last section to the first.
|
||||||
bool Found = false;
|
bool Found = false;
|
||||||
@@ -956,7 +957,7 @@ void AsmPrinter::EmitConstantPool() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// EmitJumpTableInfo - Print assembly representations of the jump tables used
|
/// EmitJumpTableInfo - Print assembly representations of the jump tables used
|
||||||
/// by the current function to the current output stream.
|
/// by the current function to the current output stream.
|
||||||
///
|
///
|
||||||
void AsmPrinter::EmitJumpTableInfo() {
|
void AsmPrinter::EmitJumpTableInfo() {
|
||||||
const MachineJumpTableInfo *MJTI = MF->getJumpTableInfo();
|
const MachineJumpTableInfo *MJTI = MF->getJumpTableInfo();
|
||||||
@@ -965,7 +966,7 @@ void AsmPrinter::EmitJumpTableInfo() {
|
|||||||
const std::vector<MachineJumpTableEntry> &JT = MJTI->getJumpTables();
|
const std::vector<MachineJumpTableEntry> &JT = MJTI->getJumpTables();
|
||||||
if (JT.empty()) return;
|
if (JT.empty()) return;
|
||||||
|
|
||||||
// Pick the directive to use to print the jump table entries, and switch to
|
// Pick the directive to use to print the jump table entries, and switch to
|
||||||
// the appropriate section.
|
// the appropriate section.
|
||||||
const Function *F = MF->getFunction();
|
const Function *F = MF->getFunction();
|
||||||
bool JTInDiffSection = false;
|
bool JTInDiffSection = false;
|
||||||
@@ -981,18 +982,18 @@ void AsmPrinter::EmitJumpTableInfo() {
|
|||||||
OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F,Mang,TM));
|
OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F,Mang,TM));
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, drop it in the readonly section.
|
// Otherwise, drop it in the readonly section.
|
||||||
const MCSection *ReadOnlySection =
|
const MCSection *ReadOnlySection =
|
||||||
getObjFileLowering().getSectionForConstant(SectionKind::getReadOnly());
|
getObjFileLowering().getSectionForConstant(SectionKind::getReadOnly());
|
||||||
OutStreamer.SwitchSection(ReadOnlySection);
|
OutStreamer.SwitchSection(ReadOnlySection);
|
||||||
JTInDiffSection = true;
|
JTInDiffSection = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
EmitAlignment(Log2_32(MJTI->getEntryAlignment(*TM.getTargetData())));
|
EmitAlignment(Log2_32(MJTI->getEntryAlignment(*TM.getTargetData())));
|
||||||
|
|
||||||
for (unsigned JTI = 0, e = JT.size(); JTI != e; ++JTI) {
|
for (unsigned JTI = 0, e = JT.size(); JTI != e; ++JTI) {
|
||||||
const std::vector<MachineBasicBlock*> &JTBBs = JT[JTI].MBBs;
|
const std::vector<MachineBasicBlock*> &JTBBs = JT[JTI].MBBs;
|
||||||
|
|
||||||
// If this jump table was deleted, ignore it.
|
// If this jump table was deleted, ignore it.
|
||||||
if (JTBBs.empty()) continue;
|
if (JTBBs.empty()) continue;
|
||||||
|
|
||||||
// For the EK_LabelDifference32 entry, if the target supports .set, emit a
|
// For the EK_LabelDifference32 entry, if the target supports .set, emit a
|
||||||
@@ -1006,15 +1007,15 @@ void AsmPrinter::EmitJumpTableInfo() {
|
|||||||
for (unsigned ii = 0, ee = JTBBs.size(); ii != ee; ++ii) {
|
for (unsigned ii = 0, ee = JTBBs.size(); ii != ee; ++ii) {
|
||||||
const MachineBasicBlock *MBB = JTBBs[ii];
|
const MachineBasicBlock *MBB = JTBBs[ii];
|
||||||
if (!EmittedSets.insert(MBB)) continue;
|
if (!EmittedSets.insert(MBB)) continue;
|
||||||
|
|
||||||
// .set LJTSet, LBB32-base
|
// .set LJTSet, LBB32-base
|
||||||
const MCExpr *LHS =
|
const MCExpr *LHS =
|
||||||
MCSymbolRefExpr::Create(MBB->getSymbol(), OutContext);
|
MCSymbolRefExpr::Create(MBB->getSymbol(), OutContext);
|
||||||
OutStreamer.EmitAssignment(GetJTSetSymbol(JTI, MBB->getNumber()),
|
OutStreamer.EmitAssignment(GetJTSetSymbol(JTI, MBB->getNumber()),
|
||||||
MCBinaryExpr::CreateSub(LHS, Base, OutContext));
|
MCBinaryExpr::CreateSub(LHS, Base, OutContext));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// On some targets (e.g. Darwin) we want to emit two consecutive labels
|
// On some targets (e.g. Darwin) we want to emit two consecutive labels
|
||||||
// before each jump table. The first label is never referenced, but tells
|
// before each jump table. The first label is never referenced, but tells
|
||||||
// the assembler and linker the extents of the jump table object. The
|
// the assembler and linker the extents of the jump table object. The
|
||||||
@@ -1067,8 +1068,8 @@ void AsmPrinter::EmitJumpTableEntry(const MachineJumpTableInfo *MJTI,
|
|||||||
// If the .set directive is supported, this is emitted as:
|
// If the .set directive is supported, this is emitted as:
|
||||||
// .set L4_5_set_123, LBB123 - LJTI1_2
|
// .set L4_5_set_123, LBB123 - LJTI1_2
|
||||||
// .word L4_5_set_123
|
// .word L4_5_set_123
|
||||||
|
|
||||||
// If we have emitted set directives for the jump table entries, print
|
// If we have emitted set directives for the jump table entries, print
|
||||||
// them rather than the entries themselves. If we're emitting PIC, then
|
// them rather than the entries themselves. If we're emitting PIC, then
|
||||||
// emit the table entries as differences between two text section labels.
|
// emit the table entries as differences between two text section labels.
|
||||||
if (MAI->hasSetDirective()) {
|
if (MAI->hasSetDirective()) {
|
||||||
@@ -1084,9 +1085,9 @@ void AsmPrinter::EmitJumpTableEntry(const MachineJumpTableInfo *MJTI,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(Value && "Unknown entry kind!");
|
assert(Value && "Unknown entry kind!");
|
||||||
|
|
||||||
unsigned EntrySize = MJTI->getEntrySize(*TM.getTargetData());
|
unsigned EntrySize = MJTI->getEntrySize(*TM.getTargetData());
|
||||||
OutStreamer.EmitValue(Value, EntrySize, /*addrspace*/0);
|
OutStreamer.EmitValue(Value, EntrySize, /*addrspace*/0);
|
||||||
}
|
}
|
||||||
@@ -1106,18 +1107,18 @@ bool AsmPrinter::EmitSpecialLLVMGlobal(const GlobalVariable *GV) {
|
|||||||
if (GV->getSection() == "llvm.metadata" ||
|
if (GV->getSection() == "llvm.metadata" ||
|
||||||
GV->hasAvailableExternallyLinkage())
|
GV->hasAvailableExternallyLinkage())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!GV->hasAppendingLinkage()) return false;
|
if (!GV->hasAppendingLinkage()) return false;
|
||||||
|
|
||||||
assert(GV->hasInitializer() && "Not a special LLVM global!");
|
assert(GV->hasInitializer() && "Not a special LLVM global!");
|
||||||
|
|
||||||
const TargetData *TD = TM.getTargetData();
|
const TargetData *TD = TM.getTargetData();
|
||||||
unsigned Align = Log2_32(TD->getPointerPrefAlignment());
|
unsigned Align = Log2_32(TD->getPointerPrefAlignment());
|
||||||
if (GV->getName() == "llvm.global_ctors") {
|
if (GV->getName() == "llvm.global_ctors") {
|
||||||
OutStreamer.SwitchSection(getObjFileLowering().getStaticCtorSection());
|
OutStreamer.SwitchSection(getObjFileLowering().getStaticCtorSection());
|
||||||
EmitAlignment(Align);
|
EmitAlignment(Align);
|
||||||
EmitXXStructorList(GV->getInitializer());
|
EmitXXStructorList(GV->getInitializer());
|
||||||
|
|
||||||
if (TM.getRelocationModel() == Reloc::Static &&
|
if (TM.getRelocationModel() == Reloc::Static &&
|
||||||
MAI->hasStaticCtorDtorReferenceInStaticMode()) {
|
MAI->hasStaticCtorDtorReferenceInStaticMode()) {
|
||||||
StringRef Sym(".constructors_used");
|
StringRef Sym(".constructors_used");
|
||||||
@@ -1125,8 +1126,8 @@ bool AsmPrinter::EmitSpecialLLVMGlobal(const GlobalVariable *GV) {
|
|||||||
MCSA_Reference);
|
MCSA_Reference);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GV->getName() == "llvm.global_dtors") {
|
if (GV->getName() == "llvm.global_dtors") {
|
||||||
OutStreamer.SwitchSection(getObjFileLowering().getStaticDtorSection());
|
OutStreamer.SwitchSection(getObjFileLowering().getStaticDtorSection());
|
||||||
EmitAlignment(Align);
|
EmitAlignment(Align);
|
||||||
@@ -1140,7 +1141,7 @@ bool AsmPrinter::EmitSpecialLLVMGlobal(const GlobalVariable *GV) {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1151,7 +1152,7 @@ void AsmPrinter::EmitLLVMUsedList(Constant *List) {
|
|||||||
// Should be an array of 'i8*'.
|
// Should be an array of 'i8*'.
|
||||||
ConstantArray *InitList = dyn_cast<ConstantArray>(List);
|
ConstantArray *InitList = dyn_cast<ConstantArray>(List);
|
||||||
if (InitList == 0) return;
|
if (InitList == 0) return;
|
||||||
|
|
||||||
for (unsigned i = 0, e = InitList->getNumOperands(); i != e; ++i) {
|
for (unsigned i = 0, e = InitList->getNumOperands(); i != e; ++i) {
|
||||||
const GlobalValue *GV =
|
const GlobalValue *GV =
|
||||||
dyn_cast<GlobalValue>(InitList->getOperand(i)->stripPointerCasts());
|
dyn_cast<GlobalValue>(InitList->getOperand(i)->stripPointerCasts());
|
||||||
@@ -1160,7 +1161,7 @@ void AsmPrinter::EmitLLVMUsedList(Constant *List) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// EmitXXStructorList - Emit the ctor or dtor list. This just prints out the
|
/// EmitXXStructorList - Emit the ctor or dtor list. This just prints out the
|
||||||
/// function pointers, ignoring the init priority.
|
/// function pointers, ignoring the init priority.
|
||||||
void AsmPrinter::EmitXXStructorList(Constant *List) {
|
void AsmPrinter::EmitXXStructorList(Constant *List) {
|
||||||
// Should be an array of '{ int, void ()* }' structs. The first value is the
|
// Should be an array of '{ int, void ()* }' structs. The first value is the
|
||||||
@@ -1206,11 +1207,11 @@ void AsmPrinter::EmitInt32(int Value) const {
|
|||||||
void AsmPrinter::EmitLabelDifference(const MCSymbol *Hi, const MCSymbol *Lo,
|
void AsmPrinter::EmitLabelDifference(const MCSymbol *Hi, const MCSymbol *Lo,
|
||||||
unsigned Size) const {
|
unsigned Size) const {
|
||||||
// Get the Hi-Lo expression.
|
// Get the Hi-Lo expression.
|
||||||
const MCExpr *Diff =
|
const MCExpr *Diff =
|
||||||
MCBinaryExpr::CreateSub(MCSymbolRefExpr::Create(Hi, OutContext),
|
MCBinaryExpr::CreateSub(MCSymbolRefExpr::Create(Hi, OutContext),
|
||||||
MCSymbolRefExpr::Create(Lo, OutContext),
|
MCSymbolRefExpr::Create(Lo, OutContext),
|
||||||
OutContext);
|
OutContext);
|
||||||
|
|
||||||
if (!MAI->hasSetDirective()) {
|
if (!MAI->hasSetDirective()) {
|
||||||
OutStreamer.EmitValue(Diff, Size, 0/*AddrSpace*/);
|
OutStreamer.EmitValue(Diff, Size, 0/*AddrSpace*/);
|
||||||
return;
|
return;
|
||||||
@@ -1222,27 +1223,27 @@ void AsmPrinter::EmitLabelDifference(const MCSymbol *Hi, const MCSymbol *Lo,
|
|||||||
OutStreamer.EmitSymbolValue(SetLabel, Size, 0/*AddrSpace*/);
|
OutStreamer.EmitSymbolValue(SetLabel, Size, 0/*AddrSpace*/);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// EmitLabelOffsetDifference - Emit something like ".long Hi+Offset-Lo"
|
/// EmitLabelOffsetDifference - Emit something like ".long Hi+Offset-Lo"
|
||||||
/// where the size in bytes of the directive is specified by Size and Hi/Lo
|
/// where the size in bytes of the directive is specified by Size and Hi/Lo
|
||||||
/// specify the labels. This implicitly uses .set if it is available.
|
/// specify the labels. This implicitly uses .set if it is available.
|
||||||
void AsmPrinter::EmitLabelOffsetDifference(const MCSymbol *Hi, uint64_t Offset,
|
void AsmPrinter::EmitLabelOffsetDifference(const MCSymbol *Hi, uint64_t Offset,
|
||||||
const MCSymbol *Lo, unsigned Size)
|
const MCSymbol *Lo, unsigned Size)
|
||||||
const {
|
const {
|
||||||
|
|
||||||
// Emit Hi+Offset - Lo
|
// Emit Hi+Offset - Lo
|
||||||
// Get the Hi+Offset expression.
|
// Get the Hi+Offset expression.
|
||||||
const MCExpr *Plus =
|
const MCExpr *Plus =
|
||||||
MCBinaryExpr::CreateAdd(MCSymbolRefExpr::Create(Hi, OutContext),
|
MCBinaryExpr::CreateAdd(MCSymbolRefExpr::Create(Hi, OutContext),
|
||||||
MCConstantExpr::Create(Offset, OutContext),
|
MCConstantExpr::Create(Offset, OutContext),
|
||||||
OutContext);
|
OutContext);
|
||||||
|
|
||||||
// Get the Hi+Offset-Lo expression.
|
// Get the Hi+Offset-Lo expression.
|
||||||
const MCExpr *Diff =
|
const MCExpr *Diff =
|
||||||
MCBinaryExpr::CreateSub(Plus,
|
MCBinaryExpr::CreateSub(Plus,
|
||||||
MCSymbolRefExpr::Create(Lo, OutContext),
|
MCSymbolRefExpr::Create(Lo, OutContext),
|
||||||
OutContext);
|
OutContext);
|
||||||
|
|
||||||
if (!MAI->hasSetDirective())
|
if (!MAI->hasSetDirective())
|
||||||
OutStreamer.EmitValue(Diff, 4, 0/*AddrSpace*/);
|
OutStreamer.EmitValue(Diff, 4, 0/*AddrSpace*/);
|
||||||
else {
|
else {
|
||||||
// Otherwise, emit with .set (aka assignment).
|
// Otherwise, emit with .set (aka assignment).
|
||||||
@@ -1252,22 +1253,22 @@ void AsmPrinter::EmitLabelOffsetDifference(const MCSymbol *Hi, uint64_t Offset,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// EmitLabelPlusOffset - Emit something like ".long Label+Offset"
|
/// EmitLabelPlusOffset - Emit something like ".long Label+Offset"
|
||||||
/// where the size in bytes of the directive is specified by Size and Label
|
/// where the size in bytes of the directive is specified by Size and Label
|
||||||
/// specifies the label. This implicitly uses .set if it is available.
|
/// specifies the label. This implicitly uses .set if it is available.
|
||||||
void AsmPrinter::EmitLabelPlusOffset(const MCSymbol *Label, uint64_t Offset,
|
void AsmPrinter::EmitLabelPlusOffset(const MCSymbol *Label, uint64_t Offset,
|
||||||
unsigned Size)
|
unsigned Size)
|
||||||
const {
|
const {
|
||||||
|
|
||||||
// Emit Label+Offset
|
// Emit Label+Offset
|
||||||
const MCExpr *Plus =
|
const MCExpr *Plus =
|
||||||
MCBinaryExpr::CreateAdd(MCSymbolRefExpr::Create(Label, OutContext),
|
MCBinaryExpr::CreateAdd(MCSymbolRefExpr::Create(Label, OutContext),
|
||||||
MCConstantExpr::Create(Offset, OutContext),
|
MCConstantExpr::Create(Offset, OutContext),
|
||||||
OutContext);
|
OutContext);
|
||||||
|
|
||||||
OutStreamer.EmitValue(Plus, 4, 0/*AddrSpace*/);
|
OutStreamer.EmitValue(Plus, 4, 0/*AddrSpace*/);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
@@ -1279,9 +1280,9 @@ void AsmPrinter::EmitLabelPlusOffset(const MCSymbol *Label, uint64_t Offset,
|
|||||||
//
|
//
|
||||||
void AsmPrinter::EmitAlignment(unsigned NumBits, const GlobalValue *GV) const {
|
void AsmPrinter::EmitAlignment(unsigned NumBits, const GlobalValue *GV) const {
|
||||||
if (GV) NumBits = getGVAlignmentLog2(GV, *TM.getTargetData(), NumBits);
|
if (GV) NumBits = getGVAlignmentLog2(GV, *TM.getTargetData(), NumBits);
|
||||||
|
|
||||||
if (NumBits == 0) return; // 1-byte aligned: no need to emit alignment.
|
if (NumBits == 0) return; // 1-byte aligned: no need to emit alignment.
|
||||||
|
|
||||||
if (getCurrentSection()->getKind().isText())
|
if (getCurrentSection()->getKind().isText())
|
||||||
OutStreamer.EmitCodeAlignment(1 << NumBits);
|
OutStreamer.EmitCodeAlignment(1 << NumBits);
|
||||||
else
|
else
|
||||||
@@ -1296,25 +1297,25 @@ void AsmPrinter::EmitAlignment(unsigned NumBits, const GlobalValue *GV) const {
|
|||||||
///
|
///
|
||||||
static const MCExpr *LowerConstant(const Constant *CV, AsmPrinter &AP) {
|
static const MCExpr *LowerConstant(const Constant *CV, AsmPrinter &AP) {
|
||||||
MCContext &Ctx = AP.OutContext;
|
MCContext &Ctx = AP.OutContext;
|
||||||
|
|
||||||
if (CV->isNullValue() || isa<UndefValue>(CV))
|
if (CV->isNullValue() || isa<UndefValue>(CV))
|
||||||
return MCConstantExpr::Create(0, Ctx);
|
return MCConstantExpr::Create(0, Ctx);
|
||||||
|
|
||||||
if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV))
|
if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV))
|
||||||
return MCConstantExpr::Create(CI->getZExtValue(), Ctx);
|
return MCConstantExpr::Create(CI->getZExtValue(), Ctx);
|
||||||
|
|
||||||
if (const GlobalValue *GV = dyn_cast<GlobalValue>(CV))
|
if (const GlobalValue *GV = dyn_cast<GlobalValue>(CV))
|
||||||
return MCSymbolRefExpr::Create(AP.Mang->getSymbol(GV), Ctx);
|
return MCSymbolRefExpr::Create(AP.Mang->getSymbol(GV), Ctx);
|
||||||
|
|
||||||
if (const BlockAddress *BA = dyn_cast<BlockAddress>(CV))
|
if (const BlockAddress *BA = dyn_cast<BlockAddress>(CV))
|
||||||
return MCSymbolRefExpr::Create(AP.GetBlockAddressSymbol(BA), Ctx);
|
return MCSymbolRefExpr::Create(AP.GetBlockAddressSymbol(BA), Ctx);
|
||||||
|
|
||||||
const ConstantExpr *CE = dyn_cast<ConstantExpr>(CV);
|
const ConstantExpr *CE = dyn_cast<ConstantExpr>(CV);
|
||||||
if (CE == 0) {
|
if (CE == 0) {
|
||||||
llvm_unreachable("Unknown constant value to lower!");
|
llvm_unreachable("Unknown constant value to lower!");
|
||||||
return MCConstantExpr::Create(0, Ctx);
|
return MCConstantExpr::Create(0, Ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (CE->getOpcode()) {
|
switch (CE->getOpcode()) {
|
||||||
default:
|
default:
|
||||||
// If the code isn't optimized, there may be outstanding folding
|
// If the code isn't optimized, there may be outstanding folding
|
||||||
@@ -1342,21 +1343,21 @@ static const MCExpr *LowerConstant(const Constant *CV, AsmPrinter &AP) {
|
|||||||
SmallVector<Value*, 8> IdxVec(CE->op_begin()+1, CE->op_end());
|
SmallVector<Value*, 8> IdxVec(CE->op_begin()+1, CE->op_end());
|
||||||
int64_t Offset = TD.getIndexedOffset(PtrVal->getType(), &IdxVec[0],
|
int64_t Offset = TD.getIndexedOffset(PtrVal->getType(), &IdxVec[0],
|
||||||
IdxVec.size());
|
IdxVec.size());
|
||||||
|
|
||||||
const MCExpr *Base = LowerConstant(CE->getOperand(0), AP);
|
const MCExpr *Base = LowerConstant(CE->getOperand(0), AP);
|
||||||
if (Offset == 0)
|
if (Offset == 0)
|
||||||
return Base;
|
return Base;
|
||||||
|
|
||||||
// Truncate/sext the offset to the pointer size.
|
// Truncate/sext the offset to the pointer size.
|
||||||
if (TD.getPointerSizeInBits() != 64) {
|
if (TD.getPointerSizeInBits() != 64) {
|
||||||
int SExtAmount = 64-TD.getPointerSizeInBits();
|
int SExtAmount = 64-TD.getPointerSizeInBits();
|
||||||
Offset = (Offset << SExtAmount) >> SExtAmount;
|
Offset = (Offset << SExtAmount) >> SExtAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
return MCBinaryExpr::CreateAdd(Base, MCConstantExpr::Create(Offset, Ctx),
|
return MCBinaryExpr::CreateAdd(Base, MCConstantExpr::Create(Offset, Ctx),
|
||||||
Ctx);
|
Ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
case Instruction::Trunc:
|
case Instruction::Trunc:
|
||||||
// We emit the value and depend on the assembler to truncate the generated
|
// We emit the value and depend on the assembler to truncate the generated
|
||||||
// expression properly. This is important for differences between
|
// expression properly. This is important for differences between
|
||||||
@@ -1375,7 +1376,7 @@ static const MCExpr *LowerConstant(const Constant *CV, AsmPrinter &AP) {
|
|||||||
false/*ZExt*/);
|
false/*ZExt*/);
|
||||||
return LowerConstant(Op, AP);
|
return LowerConstant(Op, AP);
|
||||||
}
|
}
|
||||||
|
|
||||||
case Instruction::PtrToInt: {
|
case Instruction::PtrToInt: {
|
||||||
const TargetData &TD = *AP.TM.getTargetData();
|
const TargetData &TD = *AP.TM.getTargetData();
|
||||||
// Support only foldable casts to/from pointers that can be eliminated by
|
// Support only foldable casts to/from pointers that can be eliminated by
|
||||||
@@ -1397,7 +1398,7 @@ static const MCExpr *LowerConstant(const Constant *CV, AsmPrinter &AP) {
|
|||||||
const MCExpr *MaskExpr = MCConstantExpr::Create(~0ULL >> (64-InBits), Ctx);
|
const MCExpr *MaskExpr = MCConstantExpr::Create(~0ULL >> (64-InBits), Ctx);
|
||||||
return MCBinaryExpr::CreateAnd(OpExpr, MaskExpr, Ctx);
|
return MCBinaryExpr::CreateAnd(OpExpr, MaskExpr, Ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The MC library also has a right-shift operator, but it isn't consistently
|
// The MC library also has a right-shift operator, but it isn't consistently
|
||||||
// signed or unsigned between different targets.
|
// signed or unsigned between different targets.
|
||||||
case Instruction::Add:
|
case Instruction::Add:
|
||||||
@@ -1438,7 +1439,7 @@ static void EmitGlobalConstantArray(const ConstantArray *CA, unsigned AddrSpace,
|
|||||||
EmitGlobalConstantImpl(CA->getOperand(i), AddrSpace, AP);
|
EmitGlobalConstantImpl(CA->getOperand(i), AddrSpace, AP);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise, it can be emitted as .ascii.
|
// Otherwise, it can be emitted as .ascii.
|
||||||
SmallVector<char, 128> TmpVec;
|
SmallVector<char, 128> TmpVec;
|
||||||
TmpVec.reserve(CA->getNumOperands());
|
TmpVec.reserve(CA->getNumOperands());
|
||||||
@@ -1496,7 +1497,7 @@ static void EmitGlobalConstantFP(const ConstantFP *CFP, unsigned AddrSpace,
|
|||||||
AP.OutStreamer.EmitIntValue(Val, 8, AddrSpace);
|
AP.OutStreamer.EmitIntValue(Val, 8, AddrSpace);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CFP->getType()->isFloatTy()) {
|
if (CFP->getType()->isFloatTy()) {
|
||||||
if (AP.isVerbose()) {
|
if (AP.isVerbose()) {
|
||||||
float Val = CFP->getValueAPF().convertToFloat();
|
float Val = CFP->getValueAPF().convertToFloat();
|
||||||
@@ -1506,7 +1507,7 @@ static void EmitGlobalConstantFP(const ConstantFP *CFP, unsigned AddrSpace,
|
|||||||
AP.OutStreamer.EmitIntValue(Val, 4, AddrSpace);
|
AP.OutStreamer.EmitIntValue(Val, 4, AddrSpace);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CFP->getType()->isX86_FP80Ty()) {
|
if (CFP->getType()->isX86_FP80Ty()) {
|
||||||
// all long double variants are printed as hex
|
// all long double variants are printed as hex
|
||||||
// API needed to prevent premature destruction
|
// API needed to prevent premature destruction
|
||||||
@@ -1521,7 +1522,7 @@ static void EmitGlobalConstantFP(const ConstantFP *CFP, unsigned AddrSpace,
|
|||||||
AP.OutStreamer.GetCommentOS() << "x86_fp80 ~= "
|
AP.OutStreamer.GetCommentOS() << "x86_fp80 ~= "
|
||||||
<< DoubleVal.convertToDouble() << '\n';
|
<< DoubleVal.convertToDouble() << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AP.TM.getTargetData()->isBigEndian()) {
|
if (AP.TM.getTargetData()->isBigEndian()) {
|
||||||
AP.OutStreamer.EmitIntValue(p[1], 2, AddrSpace);
|
AP.OutStreamer.EmitIntValue(p[1], 2, AddrSpace);
|
||||||
AP.OutStreamer.EmitIntValue(p[0], 8, AddrSpace);
|
AP.OutStreamer.EmitIntValue(p[0], 8, AddrSpace);
|
||||||
@@ -1529,14 +1530,14 @@ static void EmitGlobalConstantFP(const ConstantFP *CFP, unsigned AddrSpace,
|
|||||||
AP.OutStreamer.EmitIntValue(p[0], 8, AddrSpace);
|
AP.OutStreamer.EmitIntValue(p[0], 8, AddrSpace);
|
||||||
AP.OutStreamer.EmitIntValue(p[1], 2, AddrSpace);
|
AP.OutStreamer.EmitIntValue(p[1], 2, AddrSpace);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Emit the tail padding for the long double.
|
// Emit the tail padding for the long double.
|
||||||
const TargetData &TD = *AP.TM.getTargetData();
|
const TargetData &TD = *AP.TM.getTargetData();
|
||||||
AP.OutStreamer.EmitZeros(TD.getTypeAllocSize(CFP->getType()) -
|
AP.OutStreamer.EmitZeros(TD.getTypeAllocSize(CFP->getType()) -
|
||||||
TD.getTypeStoreSize(CFP->getType()), AddrSpace);
|
TD.getTypeStoreSize(CFP->getType()), AddrSpace);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(CFP->getType()->isPPC_FP128Ty() &&
|
assert(CFP->getType()->isPPC_FP128Ty() &&
|
||||||
"Floating point constant type not handled");
|
"Floating point constant type not handled");
|
||||||
// All long double variants are printed as hex
|
// All long double variants are printed as hex
|
||||||
@@ -1591,10 +1592,10 @@ static void EmitGlobalConstantImpl(const Constant *CV, unsigned AddrSpace,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (const ConstantArray *CVA = dyn_cast<ConstantArray>(CV))
|
if (const ConstantArray *CVA = dyn_cast<ConstantArray>(CV))
|
||||||
return EmitGlobalConstantArray(CVA, AddrSpace, AP);
|
return EmitGlobalConstantArray(CVA, AddrSpace, AP);
|
||||||
|
|
||||||
if (const ConstantStruct *CVS = dyn_cast<ConstantStruct>(CV))
|
if (const ConstantStruct *CVS = dyn_cast<ConstantStruct>(CV))
|
||||||
return EmitGlobalConstantStruct(CVS, AddrSpace, AP);
|
return EmitGlobalConstantStruct(CVS, AddrSpace, AP);
|
||||||
|
|
||||||
@@ -1606,10 +1607,10 @@ static void EmitGlobalConstantImpl(const Constant *CV, unsigned AddrSpace,
|
|||||||
AP.OutStreamer.EmitIntValue(0, Size, AddrSpace);
|
AP.OutStreamer.EmitIntValue(0, Size, AddrSpace);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (const ConstantVector *V = dyn_cast<ConstantVector>(CV))
|
if (const ConstantVector *V = dyn_cast<ConstantVector>(CV))
|
||||||
return EmitGlobalConstantVector(V, AddrSpace, AP);
|
return EmitGlobalConstantVector(V, AddrSpace, AP);
|
||||||
|
|
||||||
// Otherwise, it must be a ConstantExpr. Lower it to an MCExpr, then emit it
|
// Otherwise, it must be a ConstantExpr. Lower it to an MCExpr, then emit it
|
||||||
// thread the streamer with EmitValue.
|
// thread the streamer with EmitValue.
|
||||||
AP.OutStreamer.EmitValue(LowerConstant(CV, AP),
|
AP.OutStreamer.EmitValue(LowerConstant(CV, AP),
|
||||||
@@ -1706,7 +1707,7 @@ MCSymbol *AsmPrinter::GetExternalSymbolSymbol(StringRef Sym) const {
|
|||||||
SmallString<60> NameStr;
|
SmallString<60> NameStr;
|
||||||
Mang->getNameWithPrefix(NameStr, Sym);
|
Mang->getNameWithPrefix(NameStr, Sym);
|
||||||
return OutContext.GetOrCreateSymbol(NameStr.str());
|
return OutContext.GetOrCreateSymbol(NameStr.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1743,10 +1744,10 @@ static void EmitBasicBlockLoopComments(const MachineBasicBlock &MBB,
|
|||||||
// Add loop depth information
|
// Add loop depth information
|
||||||
const MachineLoop *Loop = LI->getLoopFor(&MBB);
|
const MachineLoop *Loop = LI->getLoopFor(&MBB);
|
||||||
if (Loop == 0) return;
|
if (Loop == 0) return;
|
||||||
|
|
||||||
MachineBasicBlock *Header = Loop->getHeader();
|
MachineBasicBlock *Header = Loop->getHeader();
|
||||||
assert(Header && "No header for loop");
|
assert(Header && "No header for loop");
|
||||||
|
|
||||||
// If this block is not a loop header, just print out what is the loop header
|
// If this block is not a loop header, just print out what is the loop header
|
||||||
// and return.
|
// and return.
|
||||||
if (Header != &MBB) {
|
if (Header != &MBB) {
|
||||||
@@ -1756,21 +1757,21 @@ static void EmitBasicBlockLoopComments(const MachineBasicBlock &MBB,
|
|||||||
" Depth="+Twine(Loop->getLoopDepth()));
|
" Depth="+Twine(Loop->getLoopDepth()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise, it is a loop header. Print out information about child and
|
// Otherwise, it is a loop header. Print out information about child and
|
||||||
// parent loops.
|
// parent loops.
|
||||||
raw_ostream &OS = AP.OutStreamer.GetCommentOS();
|
raw_ostream &OS = AP.OutStreamer.GetCommentOS();
|
||||||
|
|
||||||
PrintParentLoopComment(OS, Loop->getParentLoop(), AP.getFunctionNumber());
|
PrintParentLoopComment(OS, Loop->getParentLoop(), AP.getFunctionNumber());
|
||||||
|
|
||||||
OS << "=>";
|
OS << "=>";
|
||||||
OS.indent(Loop->getLoopDepth()*2-2);
|
OS.indent(Loop->getLoopDepth()*2-2);
|
||||||
|
|
||||||
OS << "This ";
|
OS << "This ";
|
||||||
if (Loop->empty())
|
if (Loop->empty())
|
||||||
OS << "Inner ";
|
OS << "Inner ";
|
||||||
OS << "Loop Header: Depth=" + Twine(Loop->getLoopDepth()) << '\n';
|
OS << "Loop Header: Depth=" + Twine(Loop->getLoopDepth()) << '\n';
|
||||||
|
|
||||||
PrintChildLoopComment(OS, Loop, AP.getFunctionNumber());
|
PrintChildLoopComment(OS, Loop, AP.getFunctionNumber());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1791,7 +1792,7 @@ void AsmPrinter::EmitBasicBlockStart(const MachineBasicBlock *MBB) const {
|
|||||||
const BasicBlock *BB = MBB->getBasicBlock();
|
const BasicBlock *BB = MBB->getBasicBlock();
|
||||||
if (isVerbose())
|
if (isVerbose())
|
||||||
OutStreamer.AddComment("Block address taken");
|
OutStreamer.AddComment("Block address taken");
|
||||||
|
|
||||||
std::vector<MCSymbol*> Syms = MMI->getAddrLabelSymbolToEmit(BB);
|
std::vector<MCSymbol*> Syms = MMI->getAddrLabelSymbolToEmit(BB);
|
||||||
|
|
||||||
for (unsigned i = 0, e = Syms.size(); i != e; ++i)
|
for (unsigned i = 0, e = Syms.size(); i != e; ++i)
|
||||||
@@ -1804,9 +1805,9 @@ void AsmPrinter::EmitBasicBlockStart(const MachineBasicBlock *MBB) const {
|
|||||||
if (const BasicBlock *BB = MBB->getBasicBlock())
|
if (const BasicBlock *BB = MBB->getBasicBlock())
|
||||||
if (BB->hasName())
|
if (BB->hasName())
|
||||||
OutStreamer.AddComment("%" + BB->getName());
|
OutStreamer.AddComment("%" + BB->getName());
|
||||||
|
|
||||||
EmitBasicBlockLoopComments(*MBB, LI, *this);
|
EmitBasicBlockLoopComments(*MBB, LI, *this);
|
||||||
|
|
||||||
// NOTE: Want this comment at start of line, don't emit with AddComment.
|
// NOTE: Want this comment at start of line, don't emit with AddComment.
|
||||||
OutStreamer.EmitRawText(Twine(MAI->getCommentString()) + " BB#" +
|
OutStreamer.EmitRawText(Twine(MAI->getCommentString()) + " BB#" +
|
||||||
Twine(MBB->getNumber()) + ":");
|
Twine(MBB->getNumber()) + ":");
|
||||||
@@ -1826,7 +1827,7 @@ void AsmPrinter::EmitBasicBlockStart(const MachineBasicBlock *MBB) const {
|
|||||||
void AsmPrinter::EmitVisibility(MCSymbol *Sym, unsigned Visibility,
|
void AsmPrinter::EmitVisibility(MCSymbol *Sym, unsigned Visibility,
|
||||||
bool IsDefinition) const {
|
bool IsDefinition) const {
|
||||||
MCSymbolAttr Attr = MCSA_Invalid;
|
MCSymbolAttr Attr = MCSA_Invalid;
|
||||||
|
|
||||||
switch (Visibility) {
|
switch (Visibility) {
|
||||||
default: break;
|
default: break;
|
||||||
case GlobalValue::HiddenVisibility:
|
case GlobalValue::HiddenVisibility:
|
||||||
@@ -1853,23 +1854,23 @@ isBlockOnlyReachableByFallthrough(const MachineBasicBlock *MBB) const {
|
|||||||
// then nothing falls through to it.
|
// then nothing falls through to it.
|
||||||
if (MBB->isLandingPad() || MBB->pred_empty())
|
if (MBB->isLandingPad() || MBB->pred_empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// If there isn't exactly one predecessor, it can't be a fall through.
|
// If there isn't exactly one predecessor, it can't be a fall through.
|
||||||
MachineBasicBlock::const_pred_iterator PI = MBB->pred_begin(), PI2 = PI;
|
MachineBasicBlock::const_pred_iterator PI = MBB->pred_begin(), PI2 = PI;
|
||||||
++PI2;
|
++PI2;
|
||||||
if (PI2 != MBB->pred_end())
|
if (PI2 != MBB->pred_end())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// The predecessor has to be immediately before this block.
|
// The predecessor has to be immediately before this block.
|
||||||
const MachineBasicBlock *Pred = *PI;
|
const MachineBasicBlock *Pred = *PI;
|
||||||
|
|
||||||
if (!Pred->isLayoutSuccessor(MBB))
|
if (!Pred->isLayoutSuccessor(MBB))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// If the block is completely empty, then it definitely does fall through.
|
// If the block is completely empty, then it definitely does fall through.
|
||||||
if (Pred->empty())
|
if (Pred->empty())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Otherwise, check the last instruction.
|
// Otherwise, check the last instruction.
|
||||||
const MachineInstr &LastInst = Pred->back();
|
const MachineInstr &LastInst = Pred->back();
|
||||||
return !LastInst.getDesc().isBarrier();
|
return !LastInst.getDesc().isBarrier();
|
||||||
@@ -1885,9 +1886,9 @@ GCMetadataPrinter *AsmPrinter::GetOrCreateGCPrinter(GCStrategy *S) {
|
|||||||
gcp_map_type::iterator GCPI = GCMap.find(S);
|
gcp_map_type::iterator GCPI = GCMap.find(S);
|
||||||
if (GCPI != GCMap.end())
|
if (GCPI != GCMap.end())
|
||||||
return GCPI->second;
|
return GCPI->second;
|
||||||
|
|
||||||
const char *Name = S->getName().c_str();
|
const char *Name = S->getName().c_str();
|
||||||
|
|
||||||
for (GCMetadataPrinterRegistry::iterator
|
for (GCMetadataPrinterRegistry::iterator
|
||||||
I = GCMetadataPrinterRegistry::begin(),
|
I = GCMetadataPrinterRegistry::begin(),
|
||||||
E = GCMetadataPrinterRegistry::end(); I != E; ++I)
|
E = GCMetadataPrinterRegistry::end(); I != E; ++I)
|
||||||
@@ -1897,7 +1898,7 @@ GCMetadataPrinter *AsmPrinter::GetOrCreateGCPrinter(GCStrategy *S) {
|
|||||||
GCMap.insert(std::make_pair(S, GMP));
|
GCMap.insert(std::make_pair(S, GMP));
|
||||||
return GMP;
|
return GMP;
|
||||||
}
|
}
|
||||||
|
|
||||||
report_fatal_error("no GCMetadataPrinter registered for GC: " + Twine(Name));
|
report_fatal_error("no GCMetadataPrinter registered for GC: " + Twine(Name));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user