40 #define DEBUG_TYPE "mccodeemitter" 42 STATISTIC(MCNumEmitted,
"Number of MC instructions emitted");
52 : MCII(mcii), Ctx(ctx) {}
53 SparcMCCodeEmitter(
const SparcMCCodeEmitter &) =
delete;
54 SparcMCCodeEmitter &operator=(
const SparcMCCodeEmitter &) =
delete;
55 ~SparcMCCodeEmitter()
override =
default;
63 uint64_t getBinaryCodeForInstr(
const MCInst &
MI,
73 unsigned getCallTargetOpValue(
const MCInst &
MI,
unsigned OpNo,
79 unsigned getBranchPredTargetOpValue(
const MCInst &
MI,
unsigned OpNo,
82 unsigned getBranchOnRegTargetOpValue(
const MCInst &
MI,
unsigned OpNo,
87 uint64_t computeAvailableFeatures(
const FeatureBitset &FB)
const;
88 void verifyInstructionPredicates(
const MCInst &
MI,
89 uint64_t AvailableFeatures)
const;
97 verifyInstructionPredicates(MI,
100 unsigned Bits = getBinaryCodeForInstr(MI, Fixups, STI);
104 unsigned tlsOpNo = 0;
111 case SP::TLS_LDXrr: tlsOpNo = 3;
break;
115 uint64_t
op = getMachineOpValue(MI, MO, Fixups, STI);
116 assert(op == 0 &&
"Unexpected operand value!");
123 unsigned SparcMCCodeEmitter::
128 return Ctx.getRegisterInfo()->getEncodingValue(MO.
getReg());
135 if (
const SparcMCExpr *SExpr = dyn_cast<SparcMCExpr>(Expr)) {
142 if (Expr->evaluateAsAbsolute(Res))
149 unsigned SparcMCCodeEmitter::
150 getCallTargetOpValue(
const MCInst &MI,
unsigned OpNo,
155 return getMachineOpValue(MI, MO, Fixups, STI);
164 "Unexpected expression in TLS_CALL");
166 assert(SymExpr->getSymbol().getName() ==
"__tls_get_addr" &&
167 "Unexpected function for TLS_CALL");
190 return getMachineOpValue(MI, MO, Fixups, STI);
197 unsigned SparcMCCodeEmitter::
198 getBranchPredTargetOpValue(
const MCInst &MI,
unsigned OpNo,
203 return getMachineOpValue(MI, MO, Fixups, STI);
210 unsigned SparcMCCodeEmitter::
211 getBranchOnRegTargetOpValue(
const MCInst &MI,
unsigned OpNo,
216 return getMachineOpValue(MI, MO, Fixups, STI);
226 #define ENABLE_INSTR_PREDICATE_VERIFIER 227 #include "SparcGenMCCodeEmitter.inc" 232 return new SparcMCCodeEmitter(MCII, Ctx);
MCCodeEmitter * createSparcMCCodeEmitter(const MCInstrInfo &MCII, const MCRegisterInfo &MRI, MCContext &Ctx)
This class represents lattice values for constants.
void push_back(const T &Elt)
STATISTIC(NumFunctions, "Total number of functions")
const FeatureBitset & getFeatureBits() const
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Base class for the full range of assembler expressions which are needed for parsing.
Represent a reference to a symbol from inside an expression.
unsigned getReg() const
Returns the register number.
Context object for machine code objects.
const MCExpr * getExpr() const
Instances of this class represent a single low-level machine instruction.
fixup_sparc_br19 - 19-bit PC relative relocation for branches on icc/xcc
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
void write(void *memory, value_type value, endianness endian)
Write a value to memory with a particular endianness.
unsigned const MachineRegisterInfo * MRI
Container class for subtarget features.
MCCodeEmitter - Generic instruction encoding interface.
Interface to description of machine instruction set.
MCFixupKind
Extensible enumeration to represent the type of a fixup.
const MCExpr * getSubExpr() const
getSubExpr - Get the child of this expression.
static MCFixup create(uint32_t Offset, const MCExpr *Value, MCFixupKind Kind, SMLoc Loc=SMLoc())
fixup_sparc_bpr - 16-bit fixup for bpr
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
const MCOperand & getOperand(unsigned i) const
Generic base class for all target subtargets.
References to labels and assigned expressions.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
static uint32_t getBranchTargetOpValue(const MCInst &MI, unsigned OpIdx, unsigned FixupKind, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI)
getBranchTargetOpValue - Helper function to get the branch target operand, which is either an immedia...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
fixup_sparc_br22 - 22-bit PC relative relocation for branches
VariantKind getKind() const
getOpcode - Get the kind of this expression.
This class implements an extremely fast bulk output stream that can only output to a stream...
unsigned getOpcode() const
Instances of this class represent operands of the MCInst class.