Home | History | Annotate | Download | only in MCTargetDesc
      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/MC/MCContext.h"
     13 #include "llvm/MC/MCExpr.h"
     14 #include "llvm/MC/MCRelocationInfo.h"
     15 #include "llvm-c/Disassembler.h"
     16 
     17 using namespace llvm;
     18 using namespace object;
     19 
     20 namespace {
     21 class ARMMachORelocationInfo : public MCRelocationInfo {
     22 public:
     23   ARMMachORelocationInfo(MCContext &Ctx) : MCRelocationInfo(Ctx) {}
     24 
     25   const MCExpr *createExprForCAPIVariantKind(const MCExpr *SubExpr,
     26                                              unsigned VariantKind) {
     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.
     41 MCRelocationInfo *llvm::createARMMachORelocationInfo(MCContext &Ctx) {
     42   return new ARMMachORelocationInfo(Ctx);
     43 }
     44