
On some architectures such as Arm and X86 the encoding for a nop may change depending on the subtarget in operation at the time of encoding. This change replaces the per module MCSubtargetInfo retained by the targets AsmBackend in favour of passing through the local MCSubtargetInfo in operation at the time. On Arm using the architectural NOP instruction can have a performance benefit on some implementations. For Arm I've deleted the copy of the AsmBackend's MCSubtargetInfo to limit the chances of this causing problems in the future. I've not done this for other targets such as X86 as there is more frequent use of the MCSubtargetInfo and it looks to be for stable properties that we would not expect to vary per function. This change required threading STI through MCNopsFragment and MCBoundaryAlignFragment. I've attempted to take into account the in tree experimental backends. Differential Revision: https://reviews.llvm.org/D45962
41 lines
1.4 KiB
C++
41 lines
1.4 KiB
C++
//===-- ARMAsmBackendDarwin.h ARM Asm Backend Darwin ----------*- C++ -*-===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLVM_LIB_TARGET_ARM_ARMASMBACKENDDARWIN_H
|
|
#define LLVM_LIB_TARGET_ARM_ARMASMBACKENDDARWIN_H
|
|
|
|
#include "ARMAsmBackend.h"
|
|
#include "llvm/BinaryFormat/MachO.h"
|
|
#include "llvm/MC/MCObjectWriter.h"
|
|
|
|
namespace llvm {
|
|
class ARMAsmBackendDarwin : public ARMAsmBackend {
|
|
const MCRegisterInfo &MRI;
|
|
Triple TT;
|
|
public:
|
|
const MachO::CPUSubTypeARM Subtype;
|
|
ARMAsmBackendDarwin(const Target &T, const MCSubtargetInfo &STI,
|
|
const MCRegisterInfo &MRI)
|
|
: ARMAsmBackend(T, STI.getTargetTriple().isThumb(), support::little),
|
|
MRI(MRI), TT(STI.getTargetTriple()),
|
|
Subtype((MachO::CPUSubTypeARM)cantFail(
|
|
MachO::getCPUSubType(STI.getTargetTriple()))) {}
|
|
|
|
std::unique_ptr<MCObjectTargetWriter>
|
|
createObjectTargetWriter() const override {
|
|
return createARMMachObjectWriter(
|
|
/*Is64Bit=*/false, cantFail(MachO::getCPUType(TT)), Subtype);
|
|
}
|
|
|
|
uint32_t generateCompactUnwindEncoding(
|
|
ArrayRef<MCCFIInstruction> Instrs) const override;
|
|
};
|
|
} // end namespace llvm
|
|
|
|
#endif
|