summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorNirav Dave <niravd@google.com>2018-04-27 16:16:06 +0000
committerNirav Dave <niravd@google.com>2018-04-27 16:16:06 +0000
commit6b01b880129e8102e87b1302315f1a3f7b73a387 (patch)
treefc2353d7fc0abccc3124d97d094bd73b41c24f45 /llvm/lib
parentc3c767bf505ed825a2d90d24560fe7e305cb2ff5 (diff)
downloadbcm5719-llvm-6b01b880129e8102e87b1302315f1a3f7b73a387.tar.gz
bcm5719-llvm-6b01b880129e8102e87b1302315f1a3f7b73a387.zip
[MC] Undo spurious commit added into r331052.
llvm-svn: 331055
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp3
-rw-r--r--llvm/lib/MC/MCAsmStreamer.cpp11
-rw-r--r--llvm/lib/MC/MCExpr.cpp6
-rw-r--r--llvm/lib/MC/MCObjectStreamer.cpp23
-rw-r--r--llvm/lib/MC/MCParser/AsmParser.cpp17
-rw-r--r--llvm/lib/MC/MCStreamer.cpp3
6 files changed, 20 insertions, 43 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
index 4159eb19423..04a72ba3d73 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
@@ -132,9 +132,6 @@ void AsmPrinter::EmitInlineAsm(StringRef Str, const MCSubtargetInfo &STI,
std::unique_ptr<MCAsmParser> Parser(
createMCAsmParser(SrcMgr, OutContext, *OutStreamer, *MAI, BufNum));
- // Do not use assembler-level information for parsing inline assembly.
- OutStreamer->setUseAssemblerInfoForParsing(false);
-
// We create a new MCInstrInfo here since we might be at the module level
// and not have a MachineFunction to initialize the TargetInstrInfo from and
// we only need MCInstrInfo for asm parsing. We create one unconditionally
diff --git a/llvm/lib/MC/MCAsmStreamer.cpp b/llvm/lib/MC/MCAsmStreamer.cpp
index 8308b145ed1..632a0308f29 100644
--- a/llvm/lib/MC/MCAsmStreamer.cpp
+++ b/llvm/lib/MC/MCAsmStreamer.cpp
@@ -78,9 +78,6 @@ public:
InstPrinter->setCommentStream(CommentStream);
}
- MCAssembler &getAssembler() { return *Assembler; }
- MCAssembler *getAssemblerPtr() override { return Assembler.get(); }
-
inline void EmitEOL() {
// Dump Explicit Comments here.
emitExplicitComments();
@@ -1659,10 +1656,10 @@ void MCAsmStreamer::AddEncodingComment(const MCInst &Inst,
raw_svector_ostream VecOS(Code);
// If we have no code emitter, don't emit code.
- if (!getAssembler().getEmitterPtr())
+ if (!Assembler->getEmitterPtr())
return;
- getAssembler().getEmitter().encodeInstruction(Inst, VecOS, Fixups, STI);
+ Assembler->getEmitter().encodeInstruction(Inst, VecOS, Fixups, STI);
// If we are showing fixups, create symbolic markers in the encoded
// representation. We do this by making a per-bit map to the fixup item index,
@@ -1675,7 +1672,7 @@ void MCAsmStreamer::AddEncodingComment(const MCInst &Inst,
for (unsigned i = 0, e = Fixups.size(); i != e; ++i) {
MCFixup &F = Fixups[i];
const MCFixupKindInfo &Info =
- getAssembler().getBackend().getFixupKindInfo(F.getKind());
+ Assembler->getBackend().getFixupKindInfo(F.getKind());
for (unsigned j = 0; j != Info.TargetSize; ++j) {
unsigned Index = F.getOffset() * 8 + Info.TargetOffset + j;
assert(Index < Code.size() * 8 && "Invalid offset in fixup!");
@@ -1740,7 +1737,7 @@ void MCAsmStreamer::AddEncodingComment(const MCInst &Inst,
for (unsigned i = 0, e = Fixups.size(); i != e; ++i) {
MCFixup &F = Fixups[i];
const MCFixupKindInfo &Info =
- getAssembler().getBackend().getFixupKindInfo(F.getKind());
+ Assembler->getBackend().getFixupKindInfo(F.getKind());
OS << " fixup " << char('A' + i) << " - " << "offset: " << F.getOffset()
<< ", value: " << *F.getValue() << ", kind: " << Info.Name << "\n";
}
diff --git a/llvm/lib/MC/MCExpr.cpp b/llvm/lib/MC/MCExpr.cpp
index 1242e3d3648..65fbe8e8428 100644
--- a/llvm/lib/MC/MCExpr.cpp
+++ b/llvm/lib/MC/MCExpr.cpp
@@ -440,10 +440,6 @@ bool MCExpr::evaluateAsAbsolute(int64_t &Res, const MCAssembler &Asm) const {
return evaluateAsAbsolute(Res, &Asm, nullptr, nullptr);
}
-bool MCExpr::evaluateAsAbsolute(int64_t &Res, const MCAssembler *Asm) const {
- return evaluateAsAbsolute(Res, Asm, nullptr, nullptr);
-}
-
bool MCExpr::evaluateKnownAbsolute(int64_t &Res,
const MCAsmLayout &Layout) const {
return evaluateAsAbsolute(Res, &Layout.getAssembler(), &Layout, nullptr,
@@ -497,7 +493,7 @@ static void AttemptToFoldSymbolOffsetDifference(
return;
if (SA.getFragment() == SB.getFragment() && !SA.isVariable() &&
- !SA.isUnset() && !SB.isVariable() && !SB.isUnset()) {
+ !SB.isVariable()) {
Addend += (SA.getOffset() - SB.getOffset());
// Pointers to Thumb symbols need to have their low-bit set to allow
diff --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp
index ebedd9bf815..19c41df473c 100644
--- a/llvm/lib/MC/MCObjectStreamer.cpp
+++ b/llvm/lib/MC/MCObjectStreamer.cpp
@@ -35,15 +35,6 @@ MCObjectStreamer::MCObjectStreamer(MCContext &Context,
MCObjectStreamer::~MCObjectStreamer() {}
-// AssemblerPtr is used for evaluation of expressions and causes
-// difference between asm and object outputs. Return nullptr to in
-// inline asm mode to limit divergence to assembly inputs.
-MCAssembler *MCObjectStreamer::getAssemblerPtr() {
- if (getUseAssemblerInfoForParsing())
- return Assembler.get();
- return nullptr;
-}
-
void MCObjectStreamer::flushPendingLabels(MCFragment *F, uint64_t FOffset) {
if (PendingLabels.empty())
return;
@@ -164,7 +155,7 @@ void MCObjectStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size,
// Avoid fixups when possible.
int64_t AbsValue;
- if (Value->evaluateAsAbsolute(AbsValue, getAssemblerPtr())) {
+ if (Value->evaluateAsAbsolute(AbsValue, getAssembler())) {
if (!isUIntN(8 * Size, AbsValue) && !isIntN(8 * Size, AbsValue)) {
getContext().reportError(
Loc, "value evaluated as " + Twine(AbsValue) + " is out of range.");
@@ -226,7 +217,7 @@ void MCObjectStreamer::EmitLabel(MCSymbol *Symbol, SMLoc Loc, MCFragment *F) {
void MCObjectStreamer::EmitULEB128Value(const MCExpr *Value) {
int64_t IntValue;
- if (Value->evaluateAsAbsolute(IntValue, getAssemblerPtr())) {
+ if (Value->evaluateAsAbsolute(IntValue, getAssembler())) {
EmitULEB128IntValue(IntValue);
return;
}
@@ -235,7 +226,7 @@ void MCObjectStreamer::EmitULEB128Value(const MCExpr *Value) {
void MCObjectStreamer::EmitSLEB128Value(const MCExpr *Value) {
int64_t IntValue;
- if (Value->evaluateAsAbsolute(IntValue, getAssemblerPtr())) {
+ if (Value->evaluateAsAbsolute(IntValue, getAssembler())) {
EmitSLEB128IntValue(IntValue);
return;
}
@@ -263,7 +254,7 @@ bool MCObjectStreamer::changeSectionImpl(MCSection *Section,
int64_t IntSubsection = 0;
if (Subsection &&
- !Subsection->evaluateAsAbsolute(IntSubsection, getAssemblerPtr()))
+ !Subsection->evaluateAsAbsolute(IntSubsection, getAssembler()))
report_fatal_error("Cannot evaluate subsection number");
if (IntSubsection < 0 || IntSubsection > 8192)
report_fatal_error("Subsection number out of range");
@@ -409,7 +400,7 @@ void MCObjectStreamer::EmitDwarfAdvanceLineAddr(int64_t LineDelta,
}
const MCExpr *AddrDelta = buildSymbolDiff(*this, Label, LastLabel);
int64_t Res;
- if (AddrDelta->evaluateAsAbsolute(Res, getAssemblerPtr())) {
+ if (AddrDelta->evaluateAsAbsolute(Res, getAssembler())) {
MCDwarfLineAddr::Emit(this, Assembler->getDWARFLinetableParams(), LineDelta,
Res);
return;
@@ -421,7 +412,7 @@ void MCObjectStreamer::EmitDwarfAdvanceFrameAddr(const MCSymbol *LastLabel,
const MCSymbol *Label) {
const MCExpr *AddrDelta = buildSymbolDiff(*this, Label, LastLabel);
int64_t Res;
- if (AddrDelta->evaluateAsAbsolute(Res, getAssemblerPtr())) {
+ if (AddrDelta->evaluateAsAbsolute(Res, getAssembler())) {
MCDwarfFrameEmitter::EmitAdvanceLoc(*this, Res);
return;
}
@@ -617,7 +608,7 @@ void MCObjectStreamer::emitFill(const MCExpr &NumBytes, uint64_t FillValue,
void MCObjectStreamer::emitFill(const MCExpr &NumValues, int64_t Size,
int64_t Expr, SMLoc Loc) {
int64_t IntNumValues;
- if (!NumValues.evaluateAsAbsolute(IntNumValues, getAssemblerPtr())) {
+ if (!NumValues.evaluateAsAbsolute(IntNumValues, getAssembler())) {
getContext().reportError(Loc, "expected absolute expression");
return;
}
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp
index c2410413a62..7ee8e1b3e84 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/lib/MC/MCParser/AsmParser.cpp
@@ -775,7 +775,7 @@ bool AsmParser::processIncbinFile(const std::string &Filename, int64_t Skip,
Bytes = Bytes.drop_front(Skip);
if (Count) {
int64_t Res;
- if (!Count->evaluateAsAbsolute(Res, getStreamer().getAssemblerPtr()))
+ if (!Count->evaluateAsAbsolute(Res))
return Error(Loc, "expected absolute expression");
if (Res < 0)
return Warning(Loc, "negative count has no effect");
@@ -1378,8 +1378,7 @@ bool AsmParser::parseExpression(const MCExpr *&Res, SMLoc &EndLoc) {
Lex();
}
- // Try to constant fold it up front, if possible. Do not exploit
- // assembler here.
+ // Try to constant fold it up front, if possible.
int64_t Value;
if (Res->evaluateAsAbsolute(Value))
Res = MCConstantExpr::create(Value, getContext());
@@ -1420,7 +1419,7 @@ bool AsmParser::parseAbsoluteExpression(int64_t &Res) {
if (parseExpression(Expr))
return true;
- if (!Expr->evaluateAsAbsolute(Res, getStreamer().getAssemblerPtr()))
+ if (!Expr->evaluateAsAbsolute(Res))
return Error(StartLoc, "expected absolute expression");
return false;
@@ -2617,8 +2616,7 @@ bool AsmParser::parseMacroArguments(const MCAsmMacro *M,
Lex();
if (parseExpression(AbsoluteExp, EndLoc))
return false;
- if (!AbsoluteExp->evaluateAsAbsolute(Value,
- getStreamer().getAssemblerPtr()))
+ if (!AbsoluteExp->evaluateAsAbsolute(Value))
return Error(StrLoc, "expected absolute expression");
const char *StrChar = StrLoc.getPointer();
const char *EndChar = EndLoc.getPointer();
@@ -2918,9 +2916,8 @@ bool AsmParser::parseDirectiveReloc(SMLoc DirectiveLoc) {
if (parseExpression(Offset))
return true;
- if (check(!Offset->evaluateAsAbsolute(OffsetValue,
- getStreamer().getAssemblerPtr()),
- OffsetLoc, "expression is not a constant value") ||
+ if (check(!Offset->evaluateAsAbsolute(OffsetValue), OffsetLoc,
+ "expression is not a constant value") ||
check(OffsetValue < 0, OffsetLoc, "expression is negative") ||
parseToken(AsmToken::Comma, "expected comma") ||
check(getTok().isNot(AsmToken::Identifier), "expected relocation name"))
@@ -5347,7 +5344,7 @@ bool AsmParser::parseDirectiveRept(SMLoc DirectiveLoc, StringRef Dir) {
return true;
int64_t Count;
- if (!CountExpr->evaluateAsAbsolute(Count, getStreamer().getAssemblerPtr())) {
+ if (!CountExpr->evaluateAsAbsolute(Count)) {
return Error(CountLoc, "unexpected token in '" + Dir + "' directive");
}
diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp
index 89d418d6743..776569894a5 100644
--- a/llvm/lib/MC/MCStreamer.cpp
+++ b/llvm/lib/MC/MCStreamer.cpp
@@ -75,8 +75,7 @@ void MCTargetStreamer::emitValue(const MCExpr *Value) {
void MCTargetStreamer::emitAssignment(MCSymbol *Symbol, const MCExpr *Value) {}
MCStreamer::MCStreamer(MCContext &Ctx)
- : Context(Ctx), CurrentWinFrameInfo(nullptr),
- UseAssemblerInfoForParsing(false) {
+ : Context(Ctx), CurrentWinFrameInfo(nullptr) {
SectionStack.push_back(std::pair<MCSectionSubPair, MCSectionSubPair>());
}
OpenPOWER on IntegriCloud