Update prebuilt Clang to r416183b from Android.
https://android.googlesource.com/platform/prebuilts/clang/host/
linux-x86/+/06a71ddac05c22edb2d10b590e1769b3f8619bef
clang 12.0.5 (based on r416183b) from build 7284624.
Change-Id: I277a316abcf47307562d8b748b84870f31a72866
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
diff --git a/linux-x64/clang/include/llvm/MC/MCAsmBackend.h b/linux-x64/clang/include/llvm/MC/MCAsmBackend.h
index 1f3ad6c..94ed3d2 100644
--- a/linux-x64/clang/include/llvm/MC/MCAsmBackend.h
+++ b/linux-x64/clang/include/llvm/MC/MCAsmBackend.h
@@ -11,36 +11,29 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/Optional.h"
-#include "llvm/ADT/StringRef.h"
#include "llvm/MC/MCDirectives.h"
#include "llvm/MC/MCFixup.h"
#include "llvm/MC/MCFragment.h"
#include "llvm/Support/Endian.h"
#include <cstdint>
-#include <memory>
namespace llvm {
class MCAsmLayout;
class MCAssembler;
class MCCFIInstruction;
-class MCCodePadder;
struct MCFixupKindInfo;
-class MCFragment;
class MCInst;
class MCObjectStreamer;
class MCObjectTargetWriter;
class MCObjectWriter;
-struct MCCodePaddingContext;
-class MCRelaxableFragment;
class MCSubtargetInfo;
class MCValue;
class raw_pwrite_stream;
+class StringRef;
/// Generic interface to target specific assembler backends.
class MCAsmBackend {
- std::unique_ptr<MCCodePadder> CodePadder;
-
protected: // Can only create subclasses.
MCAsmBackend(support::endianness Endian);
@@ -51,6 +44,20 @@
const support::endianness Endian;
+ /// Return true if this target might automatically pad instructions and thus
+ /// need to emit padding enable/disable directives around sensative code.
+ virtual bool allowAutoPadding() const { return false; }
+ /// Return true if this target allows an unrelaxable instruction to be
+ /// emitted into RelaxableFragment and then we can increase its size in a
+ /// tricky way for optimization.
+ virtual bool allowEnhancedRelaxation() const { return false; }
+
+ /// Give the target a chance to manipulate state related to instruction
+ /// alignment (e.g. padding for optimization), instruction relaxablility, etc.
+ /// before and after actually emitting the instruction.
+ virtual void emitInstructionBegin(MCObjectStreamer &OS, const MCInst &Inst) {}
+ virtual void emitInstructionEnd(MCObjectStreamer &OS, const MCInst &Inst) {}
+
/// lifetime management
virtual void reset() {}
@@ -103,6 +110,14 @@
return false;
}
+ virtual bool evaluateTargetFixup(const MCAssembler &Asm,
+ const MCAsmLayout &Layout,
+ const MCFixup &Fixup, const MCFragment *DF,
+ const MCValue &Target, uint64_t &Value,
+ bool &WasForced) {
+ llvm_unreachable("Need to implement hook if target has custom fixups");
+ }
+
/// Apply the \p Value for given \p Fixup into the provided data fragment, at
/// the offset specified by the fixup and following the fixup kind as
/// appropriate. Errors (such as an out of range fixup value) should be
@@ -129,7 +144,9 @@
/// \param STI - The MCSubtargetInfo in effect when the instruction was
/// encoded.
virtual bool mayNeedRelaxation(const MCInst &Inst,
- const MCSubtargetInfo &STI) const = 0;
+ const MCSubtargetInfo &STI) const {
+ return false;
+ }
/// Target specific predicate for whether a given fixup requires the
/// associated instruction to be relaxed.
@@ -146,12 +163,11 @@
/// Relax the instruction in the given fragment to the next wider instruction.
///
- /// \param Inst The instruction to relax, which may be the same as the
- /// output.
+ /// \param [out] Inst The instruction to relax, which is also the relaxed
+ /// instruction.
/// \param STI the subtarget information for the associated instruction.
- /// \param [out] Res On return, the relaxed instruction.
- virtual void relaxInstruction(const MCInst &Inst, const MCSubtargetInfo &STI,
- MCInst &Res) const = 0;
+ virtual void relaxInstruction(MCInst &Inst,
+ const MCSubtargetInfo &STI) const {};
/// @}
@@ -161,6 +177,10 @@
///
virtual unsigned getMinimumNopSize() const { return 1; }
+ /// Returns the maximum size of a nop in bytes on this target.
+ ///
+ virtual unsigned getMaximumNopSize() const { return 0; }
+
/// Write an (optimal) nop sequence of Count bytes to the given output. If the
/// target cannot generate such a sequence, it should return an error.
///
@@ -184,40 +204,6 @@
virtual bool isMicroMips(const MCSymbol *Sym) const {
return false;
}
-
- /// Handles all target related code padding when starting to write a new
- /// basic block to an object file.
- ///
- /// \param OS The streamer used for writing the padding data and function.
- /// \param Context the context of the padding, Embeds the basic block's
- /// parameters.
- void handleCodePaddingBasicBlockStart(MCObjectStreamer *OS,
- const MCCodePaddingContext &Context);
- /// Handles all target related code padding after writing a block to an object
- /// file.
- ///
- /// \param Context the context of the padding, Embeds the basic block's
- /// parameters.
- void handleCodePaddingBasicBlockEnd(const MCCodePaddingContext &Context);
- /// Handles all target related code padding before writing a new instruction
- /// to an object file.
- ///
- /// \param Inst the instruction.
- void handleCodePaddingInstructionBegin(const MCInst &Inst);
- /// Handles all target related code padding after writing an instruction to an
- /// object file.
- ///
- /// \param Inst the instruction.
- void handleCodePaddingInstructionEnd(const MCInst &Inst);
-
- /// Relaxes a fragment (changes the size of the padding) according to target
- /// requirements. The new size computation is done w.r.t a layout.
- ///
- /// \param PF The fragment to relax.
- /// \param Layout Code layout information.
- ///
- /// \returns true iff any relaxation occurred.
- bool relaxFragment(MCPaddingFragment *PF, MCAsmLayout &Layout);
};
} // end namespace llvm