17 #ifndef LLVM_MC_MCLINKEROPTIMIZATIONHINT_H
18 #define LLVM_MC_MCLINKEROPTIMIZATIONHINT_H
53 #define MCLOHCaseNameToId(Name) .Case(#Name, MCLOH_ ## Name)
67 #define MCLOHCaseIdToName(Name) case MCLOH_ ## Name: return StringRef(#Name);
116 : Kind(Kind), Args(Args.
begin(), Args.
end()) {
128 emit_impl(OutStream, ObjWriter, Layout);
138 void write_impl(
const char *,
size_t size)
override { Count +=
size; }
140 uint64_t current_pos()
const override {
return Count; }
143 raw_counting_ostream() : Count(0) {}
144 ~raw_counting_ostream()
override { flush(); }
147 raw_counting_ostream OutStream;
148 emit_impl(OutStream, ObjWriter, Layout);
149 return OutStream.tell();
155 mutable uint64_t EmitSize;
181 EmitSize += D.getEmitSize(ObjWriter, Layout);
190 D.emit(ObjWriter, Layout);
const_iterator end(StringRef path)
Get end iterator over path.
uint64_t getEmitSize(const MachObjectWriter &ObjWriter, const MCAsmLayout &Layout) const
Get the size in bytes of this directive if emitted in ObjWriter with the given Layout.
raw_ostream & getStream()
MCLOHContainer::LOHDirectives MCLOHDirectives
uint64_t getEmitSize(const MachObjectWriter &ObjWriter, const MCAsmLayout &Layout) const
Get the size of the directives if emitted.
void emit(MachObjectWriter &ObjWriter, const MCAsmLayout &Layout) const
Emit this directive as: <kind, numArgs, addr1, ..., addrN>
Adrp _v -> Add _v -> Ldr.
const_iterator begin(StringRef path)
Get begin iterator over path.
void emit(MachObjectWriter &ObjWriter, const MCAsmLayout &Layout) const
Emit all Linker Optimization Hint in one big table.
Adrp _v -> Ldr _v -> Ldr.
Store Linker Optimization Hint information (LOH).
Encapsulates the layout of an assembly file at a particular point in time.
MCLOHDirective(MCLOHType Kind, const LOHArgs &Args)
#define MCLOHCaseIdToName(Name)
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
MCLOHDirective::LOHArgs MCLOHArgs
const LOHArgs & getArgs() const
#define MCLOHCaseNameToId(Name)
A switch()-like statement whose cases are string literals.
static int MCLOHNameToId(StringRef Name)
MCLOHType
Linker Optimization Hint Type.
const LOHDirectives & getDirectives() const
Const accessor to the directives.
MCLOHType getKind() const
SmallVectorImpl< MCSymbol * > LOHArgs
Adrp _v -> Add _v -> Str.
void addDirective(MCLOHType Kind, const MCLOHDirective::LOHArgs &Args)
Add the directive of the given kind Kind with the given arguments Args to the container.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
static StringRef MCLOHDirectiveName()
Adrp xY, _v1 -> Adrp xY, _v2.
static bool isValidMCLOHType(unsigned Kind)
Adrp _v -> Ldr _v -> Str.
SmallVectorImpl< MCLOHDirective > LOHDirectives
const ARM::ArchExtKind Kind
static int MCLOHIdToNbArgs(MCLOHType Kind)
static StringRef MCLOHIdToName(MCLOHType Kind)
This class implements an extremely fast bulk output stream that can only output to a stream...
StringRef - Represent a constant reference to a string, i.e.