12c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha//==-- llvm/MC/MCRelocationInfo.h --------------------------------*- C++ -*-==// 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// This file declares the MCRelocationInfo class, which provides methods to 112c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha// create MCExprs from relocations, either found in an object::ObjectFile 122c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha// (object::RelocationRef), or provided through the C API. 132c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha// 142c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha//===----------------------------------------------------------------------===// 152c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha 162c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha#ifndef LLVM_MC_MCRELOCATIONINFO_H 172c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha#define LLVM_MC_MCRELOCATIONINFO_H 182c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha 192c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha#include "llvm/Support/Compiler.h" 202c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha 212c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougachanamespace llvm { 222c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha 232c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougachanamespace object { 242c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougachaclass RelocationRef; 252c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha} 262c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougachaclass MCExpr; 272c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougachaclass MCContext; 282c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha 292c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha/// \brief Create MCExprs from relocations found in an object file. 302c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougachaclass MCRelocationInfo { 312c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha MCRelocationInfo(const MCRelocationInfo &) LLVM_DELETED_FUNCTION; 322c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha void operator=(const MCRelocationInfo &) LLVM_DELETED_FUNCTION; 332c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha 342c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougachaprotected: 352c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha MCContext &Ctx; 362c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha 372c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougachapublic: 382c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha MCRelocationInfo(MCContext &Ctx); 392c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha virtual ~MCRelocationInfo(); 402c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha 412c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha /// \brief Create an MCExpr for the relocation \p Rel. 422c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha /// \returns If possible, an MCExpr corresponding to Rel, else 0. 432c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha virtual const MCExpr *createExprForRelocation(object::RelocationRef Rel); 442c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha 452c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha /// \brief Create an MCExpr for the target-specific \p VariantKind. 462c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha /// The VariantKinds are defined in llvm-c/Disassembler.h. 472c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha /// Used by MCExternalSymbolizer. 482c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha /// \returns If possible, an MCExpr corresponding to VariantKind, else 0. 492c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha virtual const MCExpr *createExprForCAPIVariantKind(const MCExpr *SubExpr, 502c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha unsigned VariantKind); 512c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha}; 522c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha 532c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha} 542c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha 552c94d0faa0e1c268893d5e04dc77e8a35889db00Ahmed Bougacha#endif 56