1//===-- ARMMachORelocationInfo.cpp ----------------------------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 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" 16 17using namespace llvm; 18using namespace object; 19 20namespace { 21class ARMMachORelocationInfo : public MCRelocationInfo { 22public: 23 ARMMachORelocationInfo(MCContext &Ctx) : MCRelocationInfo(Ctx) {} 24 25 const MCExpr *createExprForCAPIVariantKind(const MCExpr *SubExpr, 26 unsigned VariantKind) override { 27 switch(VariantKind) { 28 case LLVMDisassembler_VariantKind_ARM_HI16: 29 return ARMMCExpr::CreateUpper16(SubExpr, Ctx); 30 case LLVMDisassembler_VariantKind_ARM_LO16: 31 return ARMMCExpr::CreateLower16(SubExpr, Ctx); 32 default: 33 return MCRelocationInfo::createExprForCAPIVariantKind(SubExpr, 34 VariantKind); 35 } 36 } 37}; 38} // End unnamed namespace 39 40/// createARMMachORelocationInfo - Construct an ARM Mach-O RelocationInfo. 41MCRelocationInfo *llvm::createARMMachORelocationInfo(MCContext &Ctx) { 42 return new ARMMachORelocationInfo(Ctx); 43} 44