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;
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,

View File

@ -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);
/// @}

View File

@ -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) {

View File

@ -391,10 +391,9 @@ void MCObjectStreamer::EmitCodeAlignment(unsigned ByteAlignment,
cast<MCAlignFragment>(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

View File

@ -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);

View File

@ -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() {}