12c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha//===-- ARMMachORelocationInfo.cpp ----------------------------------------===// 22c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha// 32c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha// The LLVM Compiler Infrastructure 42c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha// 52c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha// This file is distributed under the University of Illinois Open Source 62c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha// License. See LICENSE.TXT for details. 72c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha// 82c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha//===----------------------------------------------------------------------===// 92c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha 102c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha#include "MCTargetDesc/ARMMCTargetDesc.h" 112c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha#include "ARMMCExpr.h" 1236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines#include "llvm-c/Disassembler.h" 132c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha#include "llvm/MC/MCContext.h" 142c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha#include "llvm/MC/MCExpr.h" 152c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha#include "llvm/MC/MCRelocationInfo.h" 162c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha 172c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougachausing namespace llvm; 182c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougachausing namespace object; 192c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha 202c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougachanamespace { 212c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougachaclass ARMMachORelocationInfo : public MCRelocationInfo { 222c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougachapublic: 232c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha ARMMachORelocationInfo(MCContext &Ctx) : MCRelocationInfo(Ctx) {} 242c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha 252c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha const MCExpr *createExprForCAPIVariantKind(const MCExpr *SubExpr, 2636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines unsigned VariantKind) override { 272c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha switch(VariantKind) { 282c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha case LLVMDisassembler_VariantKind_ARM_HI16: 292c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha return ARMMCExpr::CreateUpper16(SubExpr, Ctx); 302c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha case LLVMDisassembler_VariantKind_ARM_LO16: 312c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha return ARMMCExpr::CreateLower16(SubExpr, Ctx); 322c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha default: 332c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha return MCRelocationInfo::createExprForCAPIVariantKind(SubExpr, 342c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha VariantKind); 352c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha } 362c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha } 372c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha}; 382c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha} // End unnamed namespace 392c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha 402c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha/// createARMMachORelocationInfo - Construct an ARM Mach-O RelocationInfo. 412c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed BougachaMCRelocationInfo *llvm::createARMMachORelocationInfo(MCContext &Ctx) { 422c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha return new ARMMachORelocationInfo(Ctx); 432c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha} 44