LLVM  8.0.1
Macros | Functions | Variables
HexagonMCCodeEmitter.cpp File Reference
#include "MCTargetDesc/HexagonMCCodeEmitter.h"
#include "Hexagon.h"
#include "MCTargetDesc/HexagonBaseInfo.h"
#include "MCTargetDesc/HexagonFixupKinds.h"
#include "MCTargetDesc/HexagonMCExpr.h"
#include "MCTargetDesc/HexagonMCInstrInfo.h"
#include "MCTargetDesc/HexagonMCTargetDesc.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCFixup.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCInstrDesc.h"
#include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/EndianStream.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <map>
#include <string>
#include <vector>
#include "HexagonGenMCCodeEmitter.inc"
Include dependency graph for HexagonMCCodeEmitter.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "mccodeemitter"
 
#define _   fixup_Invalid
 
#define P(x)   Hexagon::fixup_Hexagon##x
 
#define ENABLE_INSTR_PREDICATE_VERIFIER
 

Functions

 STATISTIC (MCNumEmitted, "Number of MC instructions emitted")
 
static bool RegisterMatches (unsigned Consumer, unsigned Producer, unsigned Producer2)
 
static LLVM_ATTRIBUTE_NORETURN void raise_relocation_error (unsigned Width, unsigned Kind)
 
static bool isPCRel (unsigned Kind)
 

Variables

static const unsigned fixup_Invalid = ~0u
 
static const std::map< unsigned, std::vector< unsigned > > ExtFixups
 
static const std::map< unsigned, std::vector< unsigned > > StdFixups
 

Macro Definition Documentation

◆ _

#define _   fixup_Invalid

◆ DEBUG_TYPE

#define DEBUG_TYPE   "mccodeemitter"

Definition at line 40 of file HexagonMCCodeEmitter.cpp.

◆ ENABLE_INSTR_PREDICATE_VERIFIER

#define ENABLE_INSTR_PREDICATE_VERIFIER

Definition at line 802 of file HexagonMCCodeEmitter.cpp.

◆ P

#define P (   x)    Hexagon::fixup_Hexagon##x

Definition at line 50 of file HexagonMCCodeEmitter.cpp.

Function Documentation

◆ isPCRel()

static bool isPCRel ( unsigned  Kind)
static

Definition at line 560 of file HexagonMCCodeEmitter.cpp.

References llvm::array_lengthof(), assert(), llvm::MCExpr::Binary, C, llvm::MCFixup::create(), llvm::MCConstantExpr::create(), llvm::MCBinaryExpr::createAdd(), D, llvm::dbgs(), E, ExtFixups, Fixup, llvm::Hexagon::fixup_Hexagon_27_REG, llvm::Hexagon::fixup_Hexagon_32_PCREL, llvm::Hexagon::fixup_Hexagon_6_PCREL_X, llvm::Hexagon::fixup_Hexagon_B13_PCREL, llvm::Hexagon::fixup_Hexagon_B13_PCREL_X, llvm::Hexagon::fixup_Hexagon_B15_PCREL, llvm::Hexagon::fixup_Hexagon_B15_PCREL_X, llvm::Hexagon::fixup_Hexagon_B22_PCREL, llvm::Hexagon::fixup_Hexagon_B22_PCREL_X, llvm::Hexagon::fixup_Hexagon_B32_PCREL_X, llvm::Hexagon::fixup_Hexagon_B7_PCREL, llvm::Hexagon::fixup_Hexagon_B7_PCREL_X, llvm::Hexagon::fixup_Hexagon_B9_PCREL, llvm::Hexagon::fixup_Hexagon_B9_PCREL_X, llvm::Hexagon::fixup_Hexagon_GD_PLT_B22_PCREL, llvm::Hexagon::fixup_Hexagon_GD_PLT_B22_PCREL_X, llvm::Hexagon::fixup_Hexagon_GOT_11_X, llvm::Hexagon::fixup_Hexagon_GOT_16_X, llvm::Hexagon::fixup_Hexagon_GOTREL_HI16, llvm::Hexagon::fixup_Hexagon_GOTREL_LO16, llvm::Hexagon::fixup_Hexagon_GPREL16_0, llvm::Hexagon::fixup_Hexagon_GPREL16_1, llvm::Hexagon::fixup_Hexagon_GPREL16_2, llvm::Hexagon::fixup_Hexagon_GPREL16_3, llvm::Hexagon::fixup_Hexagon_LD_PLT_B22_PCREL, llvm::Hexagon::fixup_Hexagon_LD_PLT_B22_PCREL_X, llvm::Hexagon::fixup_Hexagon_PLT_B22_PCREL, fixup_Invalid, llvm::FixupKind(), llvm::HexagonMCInstrInfo::getDesc(), llvm::MCOperand::getExpr(), llvm::HexagonMCInstrInfo::getExpr(), llvm::HexagonMCInstrInfo::getExtendableOp(), llvm::HexagonMCInstrInfo::getExtentAlignment(), llvm::HexagonMCInstrInfo::getExtentBits(), llvm::MCExpr::getKind(), llvm::MCSymbolRefExpr::getKind(), llvm::MCBinaryExpr::getLHS(), llvm::MCInst::getLoc(), llvm::HexagonMCInstrInfo::getName(), llvm::MCInst::getNumOperands(), llvm::MCInstrDesc::getOpcode(), llvm::MCInst::getOperand(), llvm::MCBinaryExpr::getRHS(), llvm::HexagonMCInstrInfo::getType(), llvm::AArch64CC::HI, I, llvm::MCInstrDesc::isBranch(), llvm::HexagonMCInstrInfo::isExtendable(), llvm::HexagonMCInstrInfo::isExtended(), llvm::HexagonMCInstrInfo::isExtentSigned(), llvm::HexagonMCInstrInfo::isSubInstruction(), LLVM_DEBUG, llvm::AArch64CC::LO, llvm::SmallVectorTemplateBase< T >::push_back(), raise_relocation_error(), llvm::HexagonMCInstrInfo::s27_2_reloc(), StdFixups, llvm::MCExpr::SymbolRef, llvm::HexagonII::TypeCR, llvm::MCSymbolRefExpr::VK_GOT, llvm::MCSymbolRefExpr::VK_GOTREL, and llvm::MCSymbolRefExpr::VK_None.

Referenced by getImmFixupKind().

◆ raise_relocation_error()

static LLVM_ATTRIBUTE_NORETURN void raise_relocation_error ( unsigned  Width,
unsigned  Kind 
)
static

Definition at line 460 of file HexagonMCCodeEmitter.cpp.

References assert(), llvm::HexagonMCInstrInfo::bundleInstructions(), F(), llvm::Hexagon::fixup_Hexagon_32_6_X, llvm::Hexagon::fixup_Hexagon_B13_PCREL, llvm::Hexagon::fixup_Hexagon_B32_PCREL_X, llvm::Hexagon::fixup_Hexagon_DTPREL_32_6_X, llvm::Hexagon::fixup_Hexagon_DTPREL_HI16, llvm::Hexagon::fixup_Hexagon_DTPREL_LO16, llvm::Hexagon::fixup_Hexagon_GD_GOT_32_6_X, llvm::Hexagon::fixup_Hexagon_GD_GOT_HI16, llvm::Hexagon::fixup_Hexagon_GD_GOT_LO16, llvm::Hexagon::fixup_Hexagon_GD_PLT_B32_PCREL_X, llvm::Hexagon::fixup_Hexagon_GOT_32_6_X, llvm::Hexagon::fixup_Hexagon_GOT_HI16, llvm::Hexagon::fixup_Hexagon_GOT_LO16, llvm::Hexagon::fixup_Hexagon_GOTREL_32_6_X, llvm::Hexagon::fixup_Hexagon_GOTREL_HI16, llvm::Hexagon::fixup_Hexagon_GOTREL_LO16, llvm::Hexagon::fixup_Hexagon_HI16, llvm::Hexagon::fixup_Hexagon_IE_32_6_X, llvm::Hexagon::fixup_Hexagon_IE_GOT_32_6_X, llvm::Hexagon::fixup_Hexagon_IE_GOT_HI16, llvm::Hexagon::fixup_Hexagon_IE_GOT_LO16, llvm::Hexagon::fixup_Hexagon_IE_HI16, llvm::Hexagon::fixup_Hexagon_IE_LO16, llvm::Hexagon::fixup_Hexagon_LD_GOT_32_6_X, llvm::Hexagon::fixup_Hexagon_LD_GOT_HI16, llvm::Hexagon::fixup_Hexagon_LD_GOT_LO16, llvm::Hexagon::fixup_Hexagon_LD_PLT_B32_PCREL_X, llvm::Hexagon::fixup_Hexagon_LO16, llvm::Hexagon::fixup_Hexagon_TPREL_32_6_X, llvm::Hexagon::fixup_Hexagon_TPREL_HI16, llvm::Hexagon::fixup_Hexagon_TPREL_LO16, llvm::HexagonMCInstrInfo::getDesc(), llvm::MCInstrDesc::getOpcode(), llvm::HexagonMCInstrInfo::getType(), llvm::AArch64CC::HI, I, llvm::MCInstrDesc::isBranch(), llvm::MCInstrDesc::isCall(), Kind, llvm::AArch64CC::LO, MI, N, llvm::report_fatal_error(), llvm::raw_string_ostream::str(), llvm::HexagonII::TypeCR, llvm::HexagonII::TypeEXTENDER, llvm::MCSymbolRefExpr::VK_DTPREL, llvm::MCSymbolRefExpr::VK_GOT, llvm::MCSymbolRefExpr::VK_GOTREL, llvm::MCSymbolRefExpr::VK_Hexagon_GD_GOT, llvm::MCSymbolRefExpr::VK_Hexagon_GD_PLT, llvm::MCSymbolRefExpr::VK_Hexagon_IE, llvm::MCSymbolRefExpr::VK_Hexagon_IE_GOT, llvm::MCSymbolRefExpr::VK_Hexagon_LD_GOT, llvm::MCSymbolRefExpr::VK_Hexagon_LD_PLT, llvm::MCSymbolRefExpr::VK_Hexagon_PCREL, llvm::MCSymbolRefExpr::VK_None, and llvm::MCSymbolRefExpr::VK_TPREL.

Referenced by isPCRel().

◆ RegisterMatches()

static bool RegisterMatches ( unsigned  Consumer,
unsigned  Producer,
unsigned  Producer2 
)
static

◆ STATISTIC()

STATISTIC ( MCNumEmitted  ,
"Number of MC instructions emitted"   
)

Variable Documentation

◆ ExtFixups

const std::map<unsigned, std::vector<unsigned> > ExtFixups
static

Definition at line 51 of file HexagonMCCodeEmitter.cpp.

Referenced by isPCRel().

◆ fixup_Invalid

const unsigned fixup_Invalid = ~0u
static

Definition at line 47 of file HexagonMCCodeEmitter.cpp.

Referenced by isPCRel().

◆ StdFixups

const std::map<unsigned, std::vector<unsigned> > StdFixups
static

Definition at line 175 of file HexagonMCCodeEmitter.cpp.

Referenced by isPCRel().