1 //===-- ARMMachORelocationInfo.cpp ----------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "MCTargetDesc/ARMMCTargetDesc.h"
11 #include "ARMMCExpr.h"
12 #include "llvm-c/Disassembler.h"
13 #include "llvm/MC/MCContext.h"
14 #include "llvm/MC/MCExpr.h"
15 #include "llvm/MC/MCRelocationInfo.h"
18 using namespace object;
21 class ARMMachORelocationInfo : public MCRelocationInfo {
23 ARMMachORelocationInfo(MCContext &Ctx) : MCRelocationInfo(Ctx) {}
25 const MCExpr *createExprForCAPIVariantKind(const MCExpr *SubExpr,
26 unsigned VariantKind) override {
28 case LLVMDisassembler_VariantKind_ARM_HI16:
29 return ARMMCExpr::CreateUpper16(SubExpr, Ctx);
30 case LLVMDisassembler_VariantKind_ARM_LO16:
31 return ARMMCExpr::CreateLower16(SubExpr, Ctx);
33 return MCRelocationInfo::createExprForCAPIVariantKind(SubExpr,
38 } // End unnamed namespace
40 /// createARMMachORelocationInfo - Construct an ARM Mach-O RelocationInfo.
41 MCRelocationInfo *llvm::createARMMachORelocationInfo(MCContext &Ctx) {
42 return new ARMMachORelocationInfo(Ctx);