1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

Print a=b as an assignment.

In assembly the expression a=b is parsed as an assignment, so it should be
printed as one.

This remove a truly horrible hack for producing a label with "a=.". It would
be used by codegen but would never be reached by the asm parser. Sorry I
missed this when it was first committed.

llvm-svn: 211639
This commit is contained in:
Rafael Espindola 2014-06-24 22:45:16 +00:00
parent 37d6d91b5b
commit c0fea93ce8
17 changed files with 19 additions and 51 deletions

View File

@ -116,8 +116,8 @@ protected:
/// This is appended to emitted labels. Defaults to ":"
const char *LabelSuffix;
/// This is appended to emitted labels. Defaults to ":"
const char *DebugLabelSuffix;
// Print the EH begin symbol with an assignment. Defaults to false.
bool UseAssignmentForEHBegin;
/// This prefix is used for globals like constant pool entries that are
/// completely private to the .s file and should not have names in the .o
@ -415,7 +415,7 @@ public:
const char *getCommentString() const { return CommentString; }
const char *getLabelSuffix() const { return LabelSuffix; }
const char *getDebugLabelSuffix() const { return DebugLabelSuffix; }
bool useAssignmentForEHBegin() const { return UseAssignmentForEHBegin; }
const char *getPrivateGlobalPrefix() const { return PrivateGlobalPrefix; }
bool hasLinkerPrivateGlobalPrefix() const {
return LinkerPrivateGlobalPrefix[0] != '\0';

View File

@ -48,7 +48,6 @@ public:
void ChangeSection(const MCSection *Section,
const MCExpr *Subsection) override;
void EmitLabel(MCSymbol *Symbol) override;
void EmitDebugLabel(MCSymbol *Symbol) override;
void EmitAssemblerFlag(MCAssemblerFlag Flag) override;
void EmitThumbFunc(MCSymbol *Func) override;
void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override;

View File

@ -87,7 +87,6 @@ public:
/// @{
void EmitLabel(MCSymbol *Symbol) override;
void EmitDebugLabel(MCSymbol *Symbol) override;
void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) override;
void EmitValueImpl(const MCExpr *Value, unsigned Size,
const SMLoc &Loc = SMLoc()) override;

View File

@ -393,8 +393,6 @@ public:
// add the section we're emitting it to later.
virtual void EmitLabel(MCSymbol *Symbol);
virtual void EmitDebugLabel(MCSymbol *Symbol);
virtual void EmitEHSymAttributes(const MCSymbol *Symbol, MCSymbol *EHSymbol);
/// EmitAssemblerFlag - Note in the output the specified @p Flag.

View File

@ -35,7 +35,6 @@ public:
void InitSections() override;
void EmitLabel(MCSymbol *Symbol) override;
void EmitDebugLabel(MCSymbol *Symbol) override;
void EmitAssemblerFlag(MCAssemblerFlag Flag) override;
void EmitThumbFunc(MCSymbol *Func) override;
bool EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override;

View File

@ -112,9 +112,17 @@ void DwarfCFIException::beginFunction(const MachineFunction *MF) {
TLOF.getCFIPersonalitySymbol(Per, *Asm->Mang, Asm->TM, MMI);
Asm->OutStreamer.EmitCFIPersonality(Sym, PerEncoding);
Asm->OutStreamer.EmitDebugLabel
(Asm->GetTempSymbol("eh_func_begin",
Asm->getFunctionNumber()));
MCSymbol *EHBegin =
Asm->GetTempSymbol("eh_func_begin", Asm->getFunctionNumber());
if (Asm->MAI->useAssignmentForEHBegin()) {
MCContext &Ctx = Asm->OutContext;
MCSymbol *CurPos = Ctx.CreateTempSymbol();
Asm->OutStreamer.EmitLabel(CurPos);
Asm->OutStreamer.EmitAssignment(EHBegin,
MCSymbolRefExpr::Create(CurPos, Ctx));
} else {
Asm->OutStreamer.EmitLabel(EHBegin);
}
// Provide LSDA information.
if (!shouldEmitLSDA)

View File

@ -656,9 +656,6 @@ namespace {
Symbol->setSection(*getCurrentSection().first);
markDefined(*Symbol);
}
void EmitDebugLabel(MCSymbol *Symbol) override {
EmitLabel(Symbol);
}
void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) override {
// FIXME: should we handle aliases?
markDefined(*Symbol);

View File

@ -39,7 +39,7 @@ MCAsmInfo::MCAsmInfo() {
SeparatorString = ";";
CommentString = "#";
LabelSuffix = ":";
DebugLabelSuffix = ":";
UseAssignmentForEHBegin = false;
PrivateGlobalPrefix = "L";
LinkerPrivateGlobalPrefix = "";
InlineAsmStart = "APP";

View File

@ -120,7 +120,6 @@ public:
void EmitLOHDirective(MCLOHType Kind, const MCLOHArgs &Args) override;
void EmitLabel(MCSymbol *Symbol) override;
void EmitDebugLabel(MCSymbol *Symbol) override;
void EmitAssemblerFlag(MCAssemblerFlag Flag) override;
void EmitLinkerOptions(ArrayRef<std::string> Options) override;
@ -334,14 +333,6 @@ void MCAsmStreamer::EmitLOHDirective(MCLOHType Kind, const MCLOHArgs &Args) {
EmitEOL();
}
void MCAsmStreamer::EmitDebugLabel(MCSymbol *Symbol) {
assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
MCStreamer::EmitDebugLabel(Symbol);
OS << *Symbol << MAI->getDebugLabelSuffix();
EmitEOL();
}
void MCAsmStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) {
switch (Flag) {
case MCAF_SyntaxUnified: OS << "\t.syntax unified"; break;

View File

@ -65,10 +65,6 @@ void MCELFStreamer::EmitLabel(MCSymbol *Symbol) {
MCELF::SetType(SD, ELF::STT_TLS);
}
void MCELFStreamer::EmitDebugLabel(MCSymbol *Symbol) {
EmitLabel(Symbol);
}
void MCELFStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) {
// Let the target do whatever target specific stuff it needs to do.
getAssembler().getBackend().handleAssemblerFlag(Flag);

View File

@ -60,7 +60,6 @@ public:
void ChangeSection(const MCSection *Sect, const MCExpr *Subsect) override;
void EmitLabel(MCSymbol *Symbol) override;
void EmitDebugLabel(MCSymbol *Symbol) override;
void EmitEHSymAttributes(const MCSymbol *Symbol, MCSymbol *EHSymbol) override;
void EmitAssemblerFlag(MCAssemblerFlag Flag) override;
void EmitLinkerOptions(ArrayRef<std::string> Options) override;
@ -162,9 +161,6 @@ void MCMachOStreamer::EmitLabel(MCSymbol *Symbol) {
SD.setFlags(SD.getFlags() & ~SF_ReferenceTypeMask);
}
void MCMachOStreamer::EmitDebugLabel(MCSymbol *Symbol) {
EmitLabel(Symbol);
}
void MCMachOStreamer::EmitDataRegion(DataRegionData::KindTy Kind) {
if (!getAssembler().getBackend().hasDataInCodeSupport())
return;

View File

@ -33,9 +33,6 @@ namespace {
assert(getCurrentSection().first &&"Cannot emit before setting section!");
AssignSection(Symbol, getCurrentSection().first);
}
void EmitDebugLabel(MCSymbol *Symbol) override {
EmitLabel(Symbol);
}
void EmitAssemblerFlag(MCAssemblerFlag Flag) override {}
void EmitThumbFunc(MCSymbol *Func) override {}

View File

@ -158,10 +158,6 @@ void MCObjectStreamer::EmitLabel(MCSymbol *Symbol) {
SD.setOffset(F->getContents().size());
}
void MCObjectStreamer::EmitDebugLabel(MCSymbol *Symbol) {
EmitLabel(Symbol);
}
void MCObjectStreamer::EmitULEB128Value(const MCExpr *Value) {
int64_t IntValue;
if (Value->EvaluateAsAbsolute(IntValue, getAssembler())) {

View File

@ -239,12 +239,6 @@ void MCStreamer::EmitLabel(MCSymbol *Symbol) {
TS->emitLabel(Symbol);
}
void MCStreamer::EmitDebugLabel(MCSymbol *Symbol) {
assert(!Symbol->isVariable() && "Cannot emit a variable symbol!");
assert(getCurrentSection().first && "Cannot emit before setting section!");
AssignSection(Symbol, getCurrentSection().first);
}
void MCStreamer::EmitCompactUnwindEncoding(uint32_t CompactUnwindEncoding) {
EnsureValidFrame();
MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo();

View File

@ -82,10 +82,6 @@ void MCWinCOFFStreamer::EmitLabel(MCSymbol *Symbol) {
MCObjectStreamer::EmitLabel(Symbol);
}
void MCWinCOFFStreamer::EmitDebugLabel(MCSymbol *Symbol) {
EmitLabel(Symbol);
}
void MCWinCOFFStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) {
llvm_unreachable("not implemented");
}

View File

@ -38,7 +38,7 @@ MipsMCAsmInfo::MipsMCAsmInfo(StringRef TT) {
ZeroDirective = "\t.space\t";
GPRel32Directive = "\t.gpword\t";
GPRel64Directive = "\t.gpdword\t";
DebugLabelSuffix = "=.";
UseAssignmentForEHBegin = true;
SupportsDebugInformation = true;
ExceptionsType = ExceptionHandling::DwarfCFI;
HasLEB128 = true;

View File

@ -1,6 +1,8 @@
; RUN: llc -march=mipsel -mcpu=mips16 -relocation-model=pic -O3 < %s | FileCheck %s -check-prefix=16
;16: $eh_func_begin0=.
;16: .cfi_personality
;16-NEXT: [[TMP:.*]]:
;16-NEXT: $eh_func_begin0 = ([[TMP]])
@.str = private unnamed_addr constant [7 x i8] c"hello\0A\00", align 1
@_ZTIi = external constant i8*
@.str1 = private unnamed_addr constant [15 x i8] c"exception %i \0A\00", align 1