LLVM API Documentation

ARMMachORelocationInfo.cpp
Go to the documentation of this file.
00001 //===-- ARMMachORelocationInfo.cpp ----------------------------------------===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 
00010 #include "MCTargetDesc/ARMMCTargetDesc.h"
00011 #include "ARMMCExpr.h"
00012 #include "llvm-c/Disassembler.h"
00013 #include "llvm/MC/MCContext.h"
00014 #include "llvm/MC/MCExpr.h"
00015 #include "llvm/MC/MCRelocationInfo.h"
00016 
00017 using namespace llvm;
00018 using namespace object;
00019 
00020 namespace {
00021 class ARMMachORelocationInfo : public MCRelocationInfo {
00022 public:
00023   ARMMachORelocationInfo(MCContext &Ctx) : MCRelocationInfo(Ctx) {}
00024 
00025   const MCExpr *createExprForCAPIVariantKind(const MCExpr *SubExpr,
00026                                              unsigned VariantKind) override {
00027     switch(VariantKind) {
00028     case LLVMDisassembler_VariantKind_ARM_HI16:
00029       return ARMMCExpr::CreateUpper16(SubExpr, Ctx);
00030     case LLVMDisassembler_VariantKind_ARM_LO16:
00031       return ARMMCExpr::CreateLower16(SubExpr, Ctx);
00032     default:
00033       return MCRelocationInfo::createExprForCAPIVariantKind(SubExpr,
00034                                                             VariantKind);
00035     }
00036   }
00037 };
00038 } // End unnamed namespace
00039 
00040 /// createARMMachORelocationInfo - Construct an ARM Mach-O RelocationInfo.
00041 MCRelocationInfo *llvm::createARMMachORelocationInfo(MCContext &Ctx) {
00042   return new ARMMachORelocationInfo(Ctx);
00043 }