diff --git a/llvm/include/llvm/MC/MCObjectStreamer.h b/llvm/include/llvm/MC/MCObjectStreamer.h index 2e3aa7e57066..ca7bdd3347e5 100644 --- a/llvm/include/llvm/MC/MCObjectStreamer.h +++ b/llvm/include/llvm/MC/MCObjectStreamer.h @@ -112,7 +112,7 @@ public: unsigned MaxBytesToEmit = 0) override; void EmitCodeAlignment(unsigned ByteAlignment, unsigned MaxBytesToEmit = 0) override; - bool EmitValueToOffset(const MCExpr *Offset, unsigned char Value) override; + void emitValueToOffset(const MCExpr *Offset, unsigned char Value) override; void EmitDwarfLocDirective(unsigned FileNo, unsigned Line, unsigned Column, unsigned Flags, unsigned Isa, unsigned Discriminator, diff --git a/llvm/include/llvm/MC/MCStreamer.h b/llvm/include/llvm/MC/MCStreamer.h index eb8da33a31d3..5724a99ad080 100644 --- a/llvm/include/llvm/MC/MCStreamer.h +++ b/llvm/include/llvm/MC/MCStreamer.h @@ -612,8 +612,7 @@ public: /// expression must be associated with the current section. /// \param Value - The value to use when filling bytes. /// \return false on success, true if the offset was invalid. - virtual bool EmitValueToOffset(const MCExpr *Offset, - unsigned char Value = 0); + virtual void emitValueToOffset(const MCExpr *Offset, unsigned char Value = 0); /// @} diff --git a/llvm/lib/MC/MCAsmStreamer.cpp b/llvm/lib/MC/MCAsmStreamer.cpp index 28adb5e22a0f..4f2d1d2229d9 100644 --- a/llvm/lib/MC/MCAsmStreamer.cpp +++ b/llvm/lib/MC/MCAsmStreamer.cpp @@ -186,7 +186,7 @@ public: void EmitCodeAlignment(unsigned ByteAlignment, unsigned MaxBytesToEmit = 0) override; - bool EmitValueToOffset(const MCExpr *Offset, + void emitValueToOffset(const MCExpr *Offset, unsigned char Value = 0) override; void EmitFileDirective(StringRef Filename) override; @@ -856,14 +856,13 @@ void MCAsmStreamer::EmitCodeAlignment(unsigned ByteAlignment, 1, MaxBytesToEmit); } -bool MCAsmStreamer::EmitValueToOffset(const MCExpr *Offset, +void MCAsmStreamer::emitValueToOffset(const MCExpr *Offset, unsigned char Value) { // FIXME: Verify that Offset is associated with the current section. OS << ".org "; Offset->print(OS, MAI); OS << ", " << (unsigned)Value; EmitEOL(); - return false; } void MCAsmStreamer::EmitFileDirective(StringRef Filename) { diff --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp index 667384e76ca1..f992371bc847 100644 --- a/llvm/lib/MC/MCObjectStreamer.cpp +++ b/llvm/lib/MC/MCObjectStreamer.cpp @@ -391,10 +391,9 @@ void MCObjectStreamer::EmitCodeAlignment(unsigned ByteAlignment, cast(getCurrentFragment())->setEmitNops(true); } -bool MCObjectStreamer::EmitValueToOffset(const MCExpr *Offset, +void MCObjectStreamer::emitValueToOffset(const MCExpr *Offset, unsigned char Value) { insert(new MCOrgFragment(*Offset, Value)); - return false; } // Associate GPRel32 fixup with data and resize data area diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp index ad2e1fd5809a..890363767806 100644 --- a/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/llvm/lib/MC/MCParser/AsmParser.cpp @@ -2696,7 +2696,6 @@ bool AsmParser::parseDirectiveOrg() { checkForValidSection(); const MCExpr *Offset; - SMLoc Loc = getTok().getLoc(); if (parseExpression(Offset)) return true; @@ -2715,13 +2714,7 @@ bool AsmParser::parseDirectiveOrg() { } Lex(); - - // Only limited forms of relocatable expressions are accepted here, it - // has to be relative to the current section. The streamer will return - // 'true' if the expression wasn't evaluatable. - if (getStreamer().EmitValueToOffset(Offset, FillExpr)) - return Error(Loc, "expected assembly-time absolute expression"); - + getStreamer().emitValueToOffset(Offset, FillExpr); return false; } @@ -4905,11 +4898,7 @@ bool parseAssignmentExpression(StringRef Name, bool allow_redef, "invalid reassignment of non-absolute variable '" + Name + "'"); } else if (Name == ".") { - if (Parser.getStreamer().EmitValueToOffset(Value, 0)) { - Parser.Error(EqualLoc, "expected absolute expression"); - Parser.eatToEndOfStatement(); - return true; - } + Parser.getStreamer().emitValueToOffset(Value, 0); return false; } else Sym = Parser.getContext().getOrCreateSymbol(Name); diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp index 1ae1d51f2a32..836b40544642 100644 --- a/llvm/lib/MC/MCStreamer.cpp +++ b/llvm/lib/MC/MCStreamer.cpp @@ -697,9 +697,7 @@ void MCStreamer::EmitValueToAlignment(unsigned ByteAlignment, int64_t Value, unsigned MaxBytesToEmit) {} void MCStreamer::EmitCodeAlignment(unsigned ByteAlignment, unsigned MaxBytesToEmit) {} -bool MCStreamer::EmitValueToOffset(const MCExpr *Offset, unsigned char Value) { - return false; -} +void MCStreamer::emitValueToOffset(const MCExpr *Offset, unsigned char Value) {} void MCStreamer::EmitBundleAlignMode(unsigned AlignPow2) {} void MCStreamer::EmitBundleLock(bool AlignToEnd) {} void MCStreamer::FinishImpl() {}