[AArch64] Registering default MCInstrAnalysis

Even in this form it is useful: it can detect branch instructions.

https://github.com/google/sanitizers/issues/706

Subscribers: aemerson, rengolin

Differential Revision: https://reviews.llvm.org/D23426

llvm-svn: 278560
This commit is contained in:
Mike Aizatsky 2016-08-12 20:28:05 +00:00
parent 8585e9d33d
commit f4fdb5ddf3
3 changed files with 12 additions and 0 deletions

View File

@ -15,6 +15,7 @@
#include "AArch64ELFStreamer.h"
#include "AArch64MCAsmInfo.h"
#include "InstPrinter/AArch64InstPrinter.h"
#include "llvm/MC/MCInstrAnalysis.h"
#include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCStreamer.h"
@ -116,6 +117,10 @@ static MCStreamer *createMachOStreamer(MCContext &Ctx, MCAsmBackend &TAB,
/*LabelSections*/ true);
}
static MCInstrAnalysis *createAArch64InstrAnalysis(const MCInstrInfo *Info) {
return new MCInstrAnalysis(Info);
}
// Force static initialization.
extern "C" void LLVMInitializeAArch64TargetMC() {
for (Target *T :
@ -135,6 +140,9 @@ extern "C" void LLVMInitializeAArch64TargetMC() {
// Register the MC subtarget info.
TargetRegistry::RegisterMCSubtargetInfo(*T, createAArch64MCSubtargetInfo);
// Register the MC instruction analyzer.
TargetRegistry::RegisterMCInstrAnalysis(*T, createAArch64InstrAnalysis);
// Register the MC Code Emitter
TargetRegistry::RegisterMCCodeEmitter(*T, createAArch64MCCodeEmitter);

View File

@ -3,6 +3,7 @@ RUN: sancov -print-coverage-pcs %p/Inputs/test-linux_x86_64 | FileCheck %s --che
RUN: llvm-objdump -d %p/Inputs/test-windows_x86_64 | FileCheck %s --check-prefix=DISAS_WIN
RUN: sancov -print-coverage-pcs %p/Inputs/test-windows_x86_64 | FileCheck %s --check-prefix=WINDOWS
RUN: sancov -print-coverage-pcs %p/Inputs/test-darwin_x86_64 | FileCheck %s --check-prefix=DARWIN
RUN: not sancov -print-coverage-pcs %p/Inputs/test-linux_android_aarch64 2>&1 | FileCheck %s --check-prefix=AARCH64
LINUX: 0x4e132b
LINUX: 0x4e1472
@ -57,3 +58,6 @@ DARWIN: 0x1000018e0
DARWIN: 0x100001906
DARWIN: 0x1000019dc
DARWIN: 0x100001a28
AARCH64: Error: __sanitizer_cov* functions not found