Simplify now that emitValueToOffset always returns false.

llvm-svn: 252102
This commit is contained in:
Rafael Espindola 2015-11-04 23:59:18 +00:00
parent 04d39260d6
commit 7ae65d87cf
6 changed files with 8 additions and 24 deletions

View File

@ -112,7 +112,7 @@ public:
unsigned MaxBytesToEmit = 0) override; unsigned MaxBytesToEmit = 0) override;
void EmitCodeAlignment(unsigned ByteAlignment, void EmitCodeAlignment(unsigned ByteAlignment,
unsigned MaxBytesToEmit = 0) override; 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, void EmitDwarfLocDirective(unsigned FileNo, unsigned Line,
unsigned Column, unsigned Flags, unsigned Column, unsigned Flags,
unsigned Isa, unsigned Discriminator, unsigned Isa, unsigned Discriminator,

View File

@ -612,8 +612,7 @@ public:
/// expression must be associated with the current section. /// expression must be associated with the current section.
/// \param Value - The value to use when filling bytes. /// \param Value - The value to use when filling bytes.
/// \return false on success, true if the offset was invalid. /// \return false on success, true if the offset was invalid.
virtual bool EmitValueToOffset(const MCExpr *Offset, virtual void emitValueToOffset(const MCExpr *Offset, unsigned char Value = 0);
unsigned char Value = 0);
/// @} /// @}

View File

@ -186,7 +186,7 @@ public:
void EmitCodeAlignment(unsigned ByteAlignment, void EmitCodeAlignment(unsigned ByteAlignment,
unsigned MaxBytesToEmit = 0) override; unsigned MaxBytesToEmit = 0) override;
bool EmitValueToOffset(const MCExpr *Offset, void emitValueToOffset(const MCExpr *Offset,
unsigned char Value = 0) override; unsigned char Value = 0) override;
void EmitFileDirective(StringRef Filename) override; void EmitFileDirective(StringRef Filename) override;
@ -856,14 +856,13 @@ void MCAsmStreamer::EmitCodeAlignment(unsigned ByteAlignment,
1, MaxBytesToEmit); 1, MaxBytesToEmit);
} }
bool MCAsmStreamer::EmitValueToOffset(const MCExpr *Offset, void MCAsmStreamer::emitValueToOffset(const MCExpr *Offset,
unsigned char Value) { unsigned char Value) {
// FIXME: Verify that Offset is associated with the current section. // FIXME: Verify that Offset is associated with the current section.
OS << ".org "; OS << ".org ";
Offset->print(OS, MAI); Offset->print(OS, MAI);
OS << ", " << (unsigned)Value; OS << ", " << (unsigned)Value;
EmitEOL(); EmitEOL();
return false;
} }
void MCAsmStreamer::EmitFileDirective(StringRef Filename) { void MCAsmStreamer::EmitFileDirective(StringRef Filename) {

View File

@ -391,10 +391,9 @@ void MCObjectStreamer::EmitCodeAlignment(unsigned ByteAlignment,
cast<MCAlignFragment>(getCurrentFragment())->setEmitNops(true); cast<MCAlignFragment>(getCurrentFragment())->setEmitNops(true);
} }
bool MCObjectStreamer::EmitValueToOffset(const MCExpr *Offset, void MCObjectStreamer::emitValueToOffset(const MCExpr *Offset,
unsigned char Value) { unsigned char Value) {
insert(new MCOrgFragment(*Offset, Value)); insert(new MCOrgFragment(*Offset, Value));
return false;
} }
// Associate GPRel32 fixup with data and resize data area // Associate GPRel32 fixup with data and resize data area

View File

@ -2696,7 +2696,6 @@ bool AsmParser::parseDirectiveOrg() {
checkForValidSection(); checkForValidSection();
const MCExpr *Offset; const MCExpr *Offset;
SMLoc Loc = getTok().getLoc();
if (parseExpression(Offset)) if (parseExpression(Offset))
return true; return true;
@ -2715,13 +2714,7 @@ bool AsmParser::parseDirectiveOrg() {
} }
Lex(); Lex();
getStreamer().emitValueToOffset(Offset, FillExpr);
// 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");
return false; return false;
} }
@ -4905,11 +4898,7 @@ bool parseAssignmentExpression(StringRef Name, bool allow_redef,
"invalid reassignment of non-absolute variable '" + "invalid reassignment of non-absolute variable '" +
Name + "'"); Name + "'");
} else if (Name == ".") { } else if (Name == ".") {
if (Parser.getStreamer().EmitValueToOffset(Value, 0)) { Parser.getStreamer().emitValueToOffset(Value, 0);
Parser.Error(EqualLoc, "expected absolute expression");
Parser.eatToEndOfStatement();
return true;
}
return false; return false;
} else } else
Sym = Parser.getContext().getOrCreateSymbol(Name); Sym = Parser.getContext().getOrCreateSymbol(Name);

View File

@ -697,9 +697,7 @@ void MCStreamer::EmitValueToAlignment(unsigned ByteAlignment, int64_t Value,
unsigned MaxBytesToEmit) {} unsigned MaxBytesToEmit) {}
void MCStreamer::EmitCodeAlignment(unsigned ByteAlignment, void MCStreamer::EmitCodeAlignment(unsigned ByteAlignment,
unsigned MaxBytesToEmit) {} unsigned MaxBytesToEmit) {}
bool MCStreamer::EmitValueToOffset(const MCExpr *Offset, unsigned char Value) { void MCStreamer::emitValueToOffset(const MCExpr *Offset, unsigned char Value) {}
return false;
}
void MCStreamer::EmitBundleAlignMode(unsigned AlignPow2) {} void MCStreamer::EmitBundleAlignMode(unsigned AlignPow2) {}
void MCStreamer::EmitBundleLock(bool AlignToEnd) {} void MCStreamer::EmitBundleLock(bool AlignToEnd) {}
void MCStreamer::FinishImpl() {} void MCStreamer::FinishImpl() {}