1 //===- ARMMachORelocationInfo.cpp -----------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
10 #include "MCTargetDesc/ARMMCTargetDesc.h"
11 #include "llvm-c/Disassembler.h"
12 #include "llvm/MC/MCDisassembler/MCRelocationInfo.h"
13 #include "llvm/MC/MCExpr.h"
19 class ARMMachORelocationInfo
: public MCRelocationInfo
{
21 ARMMachORelocationInfo(MCContext
&Ctx
) : MCRelocationInfo(Ctx
) {}
23 const MCExpr
*createExprForCAPIVariantKind(const MCExpr
*SubExpr
,
24 unsigned VariantKind
) override
{
26 case LLVMDisassembler_VariantKind_ARM_HI16
:
27 return ARMMCExpr::createUpper16(SubExpr
, Ctx
);
28 case LLVMDisassembler_VariantKind_ARM_LO16
:
29 return ARMMCExpr::createLower16(SubExpr
, Ctx
);
31 return MCRelocationInfo::createExprForCAPIVariantKind(SubExpr
,
37 } // end anonymous namespace
39 /// createARMMachORelocationInfo - Construct an ARM Mach-O RelocationInfo.
40 MCRelocationInfo
*llvm::createARMMachORelocationInfo(MCContext
&Ctx
) {
41 return new ARMMachORelocationInfo(Ctx
);