1*9880d681SAndroid Build Coastguard Worker //===-- ARMMachORelocationInfo.cpp ----------------------------------------===// 2*9880d681SAndroid Build Coastguard Worker // 3*9880d681SAndroid Build Coastguard Worker // The LLVM Compiler Infrastructure 4*9880d681SAndroid Build Coastguard Worker // 5*9880d681SAndroid Build Coastguard Worker // This file is distributed under the University of Illinois Open Source 6*9880d681SAndroid Build Coastguard Worker // License. See LICENSE.TXT for details. 7*9880d681SAndroid Build Coastguard Worker // 8*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===// 9*9880d681SAndroid Build Coastguard Worker 10*9880d681SAndroid Build Coastguard Worker #include "MCTargetDesc/ARMMCTargetDesc.h" 11*9880d681SAndroid Build Coastguard Worker #include "ARMMCExpr.h" 12*9880d681SAndroid Build Coastguard Worker #include "llvm-c/Disassembler.h" 13*9880d681SAndroid Build Coastguard Worker #include "llvm/MC/MCContext.h" 14*9880d681SAndroid Build Coastguard Worker #include "llvm/MC/MCExpr.h" 15*9880d681SAndroid Build Coastguard Worker #include "llvm/MC/MCDisassembler/MCRelocationInfo.h" 16*9880d681SAndroid Build Coastguard Worker 17*9880d681SAndroid Build Coastguard Worker using namespace llvm; 18*9880d681SAndroid Build Coastguard Worker using namespace object; 19*9880d681SAndroid Build Coastguard Worker 20*9880d681SAndroid Build Coastguard Worker namespace { 21*9880d681SAndroid Build Coastguard Worker class ARMMachORelocationInfo : public MCRelocationInfo { 22*9880d681SAndroid Build Coastguard Worker public: ARMMachORelocationInfo(MCContext & Ctx)23*9880d681SAndroid Build Coastguard Worker ARMMachORelocationInfo(MCContext &Ctx) : MCRelocationInfo(Ctx) {} 24*9880d681SAndroid Build Coastguard Worker createExprForCAPIVariantKind(const MCExpr * SubExpr,unsigned VariantKind)25*9880d681SAndroid Build Coastguard Worker const MCExpr *createExprForCAPIVariantKind(const MCExpr *SubExpr, 26*9880d681SAndroid Build Coastguard Worker unsigned VariantKind) override { 27*9880d681SAndroid Build Coastguard Worker switch(VariantKind) { 28*9880d681SAndroid Build Coastguard Worker case LLVMDisassembler_VariantKind_ARM_HI16: 29*9880d681SAndroid Build Coastguard Worker return ARMMCExpr::createUpper16(SubExpr, Ctx); 30*9880d681SAndroid Build Coastguard Worker case LLVMDisassembler_VariantKind_ARM_LO16: 31*9880d681SAndroid Build Coastguard Worker return ARMMCExpr::createLower16(SubExpr, Ctx); 32*9880d681SAndroid Build Coastguard Worker default: 33*9880d681SAndroid Build Coastguard Worker return MCRelocationInfo::createExprForCAPIVariantKind(SubExpr, 34*9880d681SAndroid Build Coastguard Worker VariantKind); 35*9880d681SAndroid Build Coastguard Worker } 36*9880d681SAndroid Build Coastguard Worker } 37*9880d681SAndroid Build Coastguard Worker }; 38*9880d681SAndroid Build Coastguard Worker } // End unnamed namespace 39*9880d681SAndroid Build Coastguard Worker 40*9880d681SAndroid Build Coastguard Worker /// createARMMachORelocationInfo - Construct an ARM Mach-O RelocationInfo. createARMMachORelocationInfo(MCContext & Ctx)41*9880d681SAndroid Build Coastguard WorkerMCRelocationInfo *llvm::createARMMachORelocationInfo(MCContext &Ctx) { 42*9880d681SAndroid Build Coastguard Worker return new ARMMachORelocationInfo(Ctx); 43*9880d681SAndroid Build Coastguard Worker } 44