Update clang to r339409b.
Change-Id: Ied8a188bb072c40035320acedc86164b66d920af
diff --git a/linux-x64/clang/include/llvm/MC/MCAsmInfoWasm.h b/linux-x64/clang/include/llvm/MC/MCAsmInfoWasm.h
index bc46cfd..71c6ee2 100644
--- a/linux-x64/clang/include/llvm/MC/MCAsmInfoWasm.h
+++ b/linux-x64/clang/include/llvm/MC/MCAsmInfoWasm.h
@@ -19,6 +19,6 @@
protected:
MCAsmInfoWasm();
};
-}
+} // namespace llvm
#endif
diff --git a/linux-x64/clang/include/llvm/MC/MCCodeView.h b/linux-x64/clang/include/llvm/MC/MCCodeView.h
index 1d9e3c6..2678cf4 100644
--- a/linux-x64/clang/include/llvm/MC/MCCodeView.h
+++ b/linux-x64/clang/include/llvm/MC/MCCodeView.h
@@ -30,6 +30,7 @@
/// Instances of this class represent the information from a
/// .cv_loc directive.
class MCCVLoc {
+ const MCSymbol *Label = nullptr;
uint32_t FunctionId;
uint32_t FileNum;
uint32_t Line;
@@ -39,15 +40,17 @@
private: // CodeViewContext manages these
friend class CodeViewContext;
- MCCVLoc(unsigned functionid, unsigned fileNum, unsigned line, unsigned column,
- bool prologueend, bool isstmt)
- : FunctionId(functionid), FileNum(fileNum), Line(line), Column(column),
- PrologueEnd(prologueend), IsStmt(isstmt) {}
+ MCCVLoc(const MCSymbol *Label, unsigned functionid, unsigned fileNum,
+ unsigned line, unsigned column, bool prologueend, bool isstmt)
+ : Label(Label), FunctionId(functionid), FileNum(fileNum), Line(line),
+ Column(column), PrologueEnd(prologueend), IsStmt(isstmt) {}
// Allow the default copy constructor and assignment operator to be used
// for an MCCVLoc object.
public:
+ const MCSymbol *getLabel() const { return Label; }
+
unsigned getFunctionId() const { return FunctionId; }
/// Get the FileNum of this MCCVLoc.
@@ -62,6 +65,8 @@
bool isPrologueEnd() const { return PrologueEnd; }
bool isStmt() const { return IsStmt; }
+ void setLabel(const MCSymbol *L) { Label = L; }
+
void setFunctionId(unsigned FID) { FunctionId = FID; }
/// Set the FileNum of this MCCVLoc.
@@ -80,31 +85,6 @@
void setIsStmt(bool IS) { IsStmt = IS; }
};
-/// Instances of this class represent the line information for
-/// the CodeView line table entries. Which is created after a machine
-/// instruction is assembled and uses an address from a temporary label
-/// created at the current address in the current section and the info from
-/// the last .cv_loc directive seen as stored in the context.
-class MCCVLineEntry : public MCCVLoc {
- const MCSymbol *Label;
-
-private:
- // Allow the default copy constructor and assignment operator to be used
- // for an MCCVLineEntry object.
-
-public:
- // Constructor to create an MCCVLineEntry given a symbol and the dwarf loc.
- MCCVLineEntry(const MCSymbol *Label, const MCCVLoc loc)
- : MCCVLoc(loc), Label(Label) {}
-
- const MCSymbol *getLabel() const { return Label; }
-
- // This is called when an instruction is assembled into the specified
- // section and if there is information from the last .cv_loc directive that
- // has yet to have a line entry made for it is made.
- static void Make(MCObjectStreamer *MCOS);
-};
-
/// Information describing a function or inlined call site introduced by
/// .cv_func_id or .cv_inline_site_id. Accumulates information from .cv_loc
/// directives used with this function's id or the id of an inlined call site
@@ -183,32 +163,20 @@
/// and sets CVLocSeen. When the next instruction is assembled an entry
/// in the line number table with this information and the address of the
/// instruction will be created.
- void setCurrentCVLoc(unsigned FunctionId, unsigned FileNo, unsigned Line,
- unsigned Column, bool PrologueEnd, bool IsStmt) {
- CurrentCVLoc.setFunctionId(FunctionId);
- CurrentCVLoc.setFileNum(FileNo);
- CurrentCVLoc.setLine(Line);
- CurrentCVLoc.setColumn(Column);
- CurrentCVLoc.setPrologueEnd(PrologueEnd);
- CurrentCVLoc.setIsStmt(IsStmt);
- CVLocSeen = true;
- }
-
- bool getCVLocSeen() { return CVLocSeen; }
- void clearCVLocSeen() { CVLocSeen = false; }
-
- const MCCVLoc &getCurrentCVLoc() { return CurrentCVLoc; }
+ void recordCVLoc(MCContext &Ctx, const MCSymbol *Label, unsigned FunctionId,
+ unsigned FileNo, unsigned Line, unsigned Column,
+ bool PrologueEnd, bool IsStmt);
bool isValidCVFileNumber(unsigned FileNumber);
/// Add a line entry.
- void addLineEntry(const MCCVLineEntry &LineEntry);
+ void addLineEntry(const MCCVLoc &LineEntry);
- std::vector<MCCVLineEntry> getFunctionLineEntries(unsigned FuncId);
+ std::vector<MCCVLoc> getFunctionLineEntries(unsigned FuncId);
std::pair<size_t, size_t> getLineExtent(unsigned FuncId);
- ArrayRef<MCCVLineEntry> getLinesForExtent(size_t L, size_t R);
+ ArrayRef<MCCVLoc> getLinesForExtent(size_t L, size_t R);
/// Emits a line table substream.
void emitLineTableForFunction(MCObjectStreamer &OS, unsigned FuncId,
@@ -247,10 +215,6 @@
std::pair<StringRef, unsigned> addToStringTable(StringRef S);
private:
- /// The current CodeView line information from the last .cv_loc directive.
- MCCVLoc CurrentCVLoc = MCCVLoc(0, 0, 0, 0, false, true);
- bool CVLocSeen = false;
-
/// Map from string to string table offset.
StringMap<unsigned> StringTable;
@@ -286,8 +250,8 @@
/// id.
std::map<unsigned, std::pair<size_t, size_t>> MCCVLineStartStop;
- /// A collection of MCCVLineEntry for each section.
- std::vector<MCCVLineEntry> MCCVLines;
+ /// A collection of MCCVLoc for each section.
+ std::vector<MCCVLoc> MCCVLines;
/// All known functions and inlined call sites, indexed by function id.
std::vector<MCCVFunctionInfo> Functions;
diff --git a/linux-x64/clang/include/llvm/MC/MCContext.h b/linux-x64/clang/include/llvm/MC/MCContext.h
index a712e2d..3b8ac8b 100644
--- a/linux-x64/clang/include/llvm/MC/MCContext.h
+++ b/linux-x64/clang/include/llvm/MC/MCContext.h
@@ -298,10 +298,6 @@
CodeViewContext &getCVContext();
- /// Clear the current cv_loc, if there is one. Avoids lazily creating a
- /// CodeViewContext if none is needed.
- void clearCVLocSeen();
-
void setAllowTemporaryLabels(bool Value) { AllowTemporaryLabels = Value; }
void setUseNamesOnTempLabels(bool Value) { UseNamesOnTempLabels = Value; }
diff --git a/linux-x64/clang/include/llvm/MC/MCELFObjectWriter.h b/linux-x64/clang/include/llvm/MC/MCELFObjectWriter.h
index 389a4d7..f226d6a 100644
--- a/linux-x64/clang/include/llvm/MC/MCELFObjectWriter.h
+++ b/linux-x64/clang/include/llvm/MC/MCELFObjectWriter.h
@@ -74,6 +74,8 @@
switch (OSType) {
case Triple::CloudABI:
return ELF::ELFOSABI_CLOUDABI;
+ case Triple::HermitCore:
+ return ELF::ELFOSABI_STANDALONE;
case Triple::PS4:
case Triple::FreeBSD:
return ELF::ELFOSABI_FREEBSD;
diff --git a/linux-x64/clang/include/llvm/MC/MCExpr.h b/linux-x64/clang/include/llvm/MC/MCExpr.h
index 0d8f3ca..23dde10 100644
--- a/linux-x64/clang/include/llvm/MC/MCExpr.h
+++ b/linux-x64/clang/include/llvm/MC/MCExpr.h
@@ -589,6 +589,8 @@
virtual bool evaluateAsRelocatableImpl(MCValue &Res,
const MCAsmLayout *Layout,
const MCFixup *Fixup) const = 0;
+ // allow Target Expressions to be checked for equality
+ virtual bool isEqualTo(const MCExpr *x) const { return false; }
// This should be set when assigned expressions are not valid ".set"
// expressions, e.g. registers, and must be inlined.
virtual bool inlineAssignedExpr() const { return false; }
diff --git a/linux-x64/clang/include/llvm/MC/MCInstrAnalysis.h b/linux-x64/clang/include/llvm/MC/MCInstrAnalysis.h
index 0777add..950a1af 100644
--- a/linux-x64/clang/include/llvm/MC/MCInstrAnalysis.h
+++ b/linux-x64/clang/include/llvm/MC/MCInstrAnalysis.h
@@ -88,18 +88,53 @@
const MCInst &Inst,
APInt &Writes) const;
- /// Returns true if \param Inst is a dependency breaking instruction for the
- /// given subtarget.
+ /// Returns true if MI is a dependency breaking zero-idiom for the given
+ /// subtarget.
+ ///
+ /// Mask is used to identify input operands that have their dependency
+ /// broken. Each bit of the mask is associated with a specific input operand.
+ /// Bits associated with explicit input operands are laid out first in the
+ /// mask; implicit operands come after explicit operands.
+ ///
+ /// Dependencies are broken only for operands that have their corresponding bit
+ /// set. Operands that have their bit cleared, or that don't have a
+ /// corresponding bit in the mask don't have their dependency broken. Note
+ /// that Mask may not be big enough to describe all operands. The assumption
+ /// for operands that don't have a correspondent bit in the mask is that those
+ /// are still data dependent.
+ ///
+ /// The only exception to the rule is for when Mask has all zeroes.
+ /// A zero mask means: dependencies are broken for all explicit register
+ /// operands.
+ virtual bool isZeroIdiom(const MCInst &MI, APInt &Mask,
+ unsigned CPUID) const {
+ return false;
+ }
+
+ /// Returns true if MI is a dependency breaking instruction for the
+ /// subtarget associated with CPUID .
///
/// The value computed by a dependency breaking instruction is not dependent
/// on the inputs. An example of dependency breaking instruction on X86 is
/// `XOR %eax, %eax`.
- /// TODO: In future, we could implement an alternative approach where this
- /// method returns `true` if the input instruction is not dependent on
- /// some/all of its input operands. An APInt mask could then be used to
- /// identify independent operands.
- virtual bool isDependencyBreaking(const MCSubtargetInfo &STI,
- const MCInst &Inst) const;
+ ///
+ /// If MI is a dependency breaking instruction for subtarget CPUID, then Mask
+ /// can be inspected to identify independent operands.
+ ///
+ /// Essentially, each bit of the mask corresponds to an input operand.
+ /// Explicit operands are laid out first in the mask; implicit operands follow
+ /// explicit operands. Bits are set for operands that are independent.
+ ///
+ /// Note that the number of bits in Mask may not be equivalent to the sum of
+ /// explicit and implicit operands in MI. Operands that don't have a
+ /// corresponding bit in Mask are assumed "not independente".
+ ///
+ /// The only exception is for when Mask is all zeroes. That means: explicit
+ /// input operands of MI are independent.
+ virtual bool isDependencyBreaking(const MCInst &MI, APInt &Mask,
+ unsigned CPUID) const {
+ return isZeroIdiom(MI, Mask, CPUID);
+ }
/// Given a branch instruction try to get the address the branch
/// targets. Return true on success, and the address in Target.
diff --git a/linux-x64/clang/include/llvm/MC/MCInstrDesc.h b/linux-x64/clang/include/llvm/MC/MCInstrDesc.h
index 3e000a2..ba97aeb 100644
--- a/linux-x64/clang/include/llvm/MC/MCInstrDesc.h
+++ b/linux-x64/clang/include/llvm/MC/MCInstrDesc.h
@@ -120,6 +120,7 @@
HasOptionalDef,
Pseudo,
Return,
+ EHScopeReturn,
Call,
Barrier,
Terminator,
diff --git a/linux-x64/clang/include/llvm/MC/MCObjectStreamer.h b/linux-x64/clang/include/llvm/MC/MCObjectStreamer.h
index 035206d..c9e577b 100644
--- a/linux-x64/clang/include/llvm/MC/MCObjectStreamer.h
+++ b/linux-x64/clang/include/llvm/MC/MCObjectStreamer.h
@@ -179,7 +179,9 @@
///
/// Emit the absolute difference between \c Hi and \c Lo, as long as we can
/// compute it. Currently, that requires that both symbols are in the same
- /// data fragment. Otherwise, do nothing and return \c false.
+ /// data fragment and that the target has not specified that diff expressions
+ /// require relocations to be emitted. Otherwise, do nothing and return
+ /// \c false.
///
/// \pre Offset of \c Hi is greater than the offset \c Lo.
void emitAbsoluteSymbolDiff(const MCSymbol *Hi, const MCSymbol *Lo,
diff --git a/linux-x64/clang/include/llvm/MC/MCParser/MCAsmLexer.h b/linux-x64/clang/include/llvm/MC/MCParser/MCAsmLexer.h
index 10550b3..8ff0df2 100644
--- a/linux-x64/clang/include/llvm/MC/MCParser/MCAsmLexer.h
+++ b/linux-x64/clang/include/llvm/MC/MCParser/MCAsmLexer.h
@@ -52,7 +52,6 @@
bool IsAtStartOfStatement = true;
AsmCommentConsumer *CommentConsumer = nullptr;
- bool AltMacroMode;
MCAsmLexer();
virtual AsmToken LexToken() = 0;
@@ -67,17 +66,9 @@
MCAsmLexer &operator=(const MCAsmLexer &) = delete;
virtual ~MCAsmLexer();
- bool IsaAltMacroMode() {
- return AltMacroMode;
- }
-
- void SetAltMacroMode(bool AltMacroSet) {
- AltMacroMode = AltMacroSet;
- }
-
/// Consume the next token from the input stream and return it.
///
- /// The lexer will continuosly return the end-of-file token once the end of
+ /// The lexer will continuously return the end-of-file token once the end of
/// the main input file has been reached.
const AsmToken &Lex() {
assert(!CurTok.empty());
diff --git a/linux-x64/clang/include/llvm/MC/MCParser/MCAsmParserUtils.h b/linux-x64/clang/include/llvm/MC/MCParser/MCAsmParserUtils.h
index 259113b..84173bb 100644
--- a/linux-x64/clang/include/llvm/MC/MCParser/MCAsmParserUtils.h
+++ b/linux-x64/clang/include/llvm/MC/MCParser/MCAsmParserUtils.h
@@ -25,7 +25,7 @@
/// On success, returns false and sets the Symbol and Value output parameters.
bool parseAssignmentExpression(StringRef Name, bool allow_redef,
MCAsmParser &Parser, MCSymbol *&Symbol,
- const MCExpr *&Value, bool AllowExtendedExpr = false);
+ const MCExpr *&Value);
} // namespace MCParserUtils
diff --git a/linux-x64/clang/include/llvm/MC/MCParser/MCTargetAsmParser.h b/linux-x64/clang/include/llvm/MC/MCParser/MCTargetAsmParser.h
index 2d188a6..bb97942 100644
--- a/linux-x64/clang/include/llvm/MC/MCParser/MCTargetAsmParser.h
+++ b/linux-x64/clang/include/llvm/MC/MCParser/MCTargetAsmParser.h
@@ -372,9 +372,9 @@
SemaCallback = Callback;
}
- // Target-specific parsing of assembler-level variable assignment.
- virtual bool parseAssignmentExpression(const MCExpr *&Res, SMLoc &EndLoc) {
- return getParser().parseExpression(Res, EndLoc);
+ // Target-specific parsing of expression.
+ virtual bool parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc) {
+ return getParser().parsePrimaryExpr(Res, EndLoc);
}
virtual bool ParseRegister(unsigned &RegNo, SMLoc &StartLoc,
@@ -476,6 +476,9 @@
return nullptr;
}
+ // For actions that have to be performed before a label is emitted
+ virtual void doBeforeLabelEmit(MCSymbol *Symbol) {}
+
virtual void onLabelParsed(MCSymbol *Symbol) {}
/// Ensure that all previously parsed instructions have been emitted to the
diff --git a/linux-x64/clang/include/llvm/MC/MCSchedule.h b/linux-x64/clang/include/llvm/MC/MCSchedule.h
index f2f1dfb..9f53a46 100644
--- a/linux-x64/clang/include/llvm/MC/MCSchedule.h
+++ b/linux-x64/clang/include/llvm/MC/MCSchedule.h
@@ -182,6 +182,10 @@
// cycles.
const char *CycleCounter;
+ // An optional name of a performance counter that can be used to measure
+ // uops.
+ const char *UopsCounter;
+
// For each MCProcResourceDesc defined by the processor, an optional list of
// names of performance counters that can be used to measure the resource
// utilization.
diff --git a/linux-x64/clang/include/llvm/MC/MCStreamer.h b/linux-x64/clang/include/llvm/MC/MCStreamer.h
index e4d0dc0..91fb4e5 100644
--- a/linux-x64/clang/include/llvm/MC/MCStreamer.h
+++ b/linux-x64/clang/include/llvm/MC/MCStreamer.h
@@ -231,6 +231,9 @@
virtual void EmitRawTextImpl(StringRef String);
+ /// Returns true if the the .cv_loc directive is in the right section.
+ bool checkCVLocSection(unsigned FuncId, unsigned FileNo, SMLoc Loc);
+
public:
MCStreamer(const MCStreamer &) = delete;
MCStreamer &operator=(const MCStreamer &) = delete;
diff --git a/linux-x64/clang/include/llvm/MC/MCSymbolWasm.h b/linux-x64/clang/include/llvm/MC/MCSymbolWasm.h
index e043453..281178a 100644
--- a/linux-x64/clang/include/llvm/MC/MCSymbolWasm.h
+++ b/linux-x64/clang/include/llvm/MC/MCSymbolWasm.h
@@ -20,11 +20,8 @@
bool IsHidden = false;
bool IsComdat = false;
std::string ModuleName;
- SmallVector<wasm::ValType, 1> Returns;
- SmallVector<wasm::ValType, 4> Params;
+ wasm::WasmSignature *Signature = nullptr;
wasm::WasmGlobalType GlobalType;
- bool ParamsSet = false;
- bool ReturnsSet = false;
bool GlobalTypeSet = false;
/// An expression describing how to calculate the size of a symbol. If a
@@ -35,8 +32,7 @@
// Use a module name of "env" for now, for compatibility with existing tools.
// This is temporary, and may change, as the ABI is not yet stable.
MCSymbolWasm(const StringMapEntry<bool> *Name, bool isTemporary)
- : MCSymbol(SymbolKindWasm, Name, isTemporary),
- ModuleName("env") {}
+ : MCSymbol(SymbolKindWasm, Name, isTemporary), ModuleName("env") {}
static bool classof(const MCSymbol *S) { return S->isWasm(); }
const MCExpr *getSize() const { return SymbolSize; }
@@ -61,25 +57,8 @@
const StringRef getModuleName() const { return ModuleName; }
void setModuleName(StringRef Name) { ModuleName = Name; }
- const SmallVector<wasm::ValType, 1> &getReturns() const {
- assert(ReturnsSet);
- return Returns;
- }
-
- void setReturns(SmallVectorImpl<wasm::ValType> &&Rets) {
- ReturnsSet = true;
- Returns = std::move(Rets);
- }
-
- const SmallVector<wasm::ValType, 4> &getParams() const {
- assert(ParamsSet);
- return Params;
- }
-
- void setParams(SmallVectorImpl<wasm::ValType> &&Pars) {
- ParamsSet = true;
- Params = std::move(Pars);
- }
+ const wasm::WasmSignature *getSignature() const { return Signature; }
+ void setSignature(wasm::WasmSignature *Sig) { Signature = Sig; }
const wasm::WasmGlobalType &getGlobalType() const {
assert(GlobalTypeSet);
@@ -92,6 +71,6 @@
}
};
-} // end namespace llvm
+} // end namespace llvm
#endif // LLVM_MC_MCSYMBOLWASM_H
diff --git a/linux-x64/clang/include/llvm/MC/MCWasmObjectWriter.h b/linux-x64/clang/include/llvm/MC/MCWasmObjectWriter.h
index e45030f..6b788cf 100644
--- a/linux-x64/clang/include/llvm/MC/MCWasmObjectWriter.h
+++ b/linux-x64/clang/include/llvm/MC/MCWasmObjectWriter.h
@@ -51,6 +51,6 @@
createWasmObjectWriter(std::unique_ptr<MCWasmObjectTargetWriter> MOTW,
raw_pwrite_stream &OS);
-} // End llvm namespace
+} // namespace llvm
#endif