LLVM 22.0.0git
|
Binary assembler expressions. More...
#include "llvm/MC/MCExpr.h"
Public Types | |
enum | Opcode { Add , And , Div , EQ , GT , GTE , LAnd , LOr , LT , LTE , Mod , Mul , NE , Or , OrNot , Shl , AShr , LShr , Sub , Xor } |
![]() | |
enum | ExprKind : uint8_t { Binary , Constant , SymbolRef , Unary , Specifier , Target } |
Public Member Functions | |
Accessors | |
Opcode | getOpcode () const |
Get the kind of this binary expression. | |
const MCExpr * | getLHS () const |
Get the left-hand side expression of the binary operator. | |
const MCExpr * | getRHS () const |
Get the right-hand side expression of the binary operator. | |
![]() | |
MCExpr (const MCExpr &)=delete | |
MCExpr & | operator= (const MCExpr &)=delete |
ExprKind | getKind () const |
SMLoc | getLoc () const |
LLVM_ABI void | dump () const |
LLVM_ABI bool | evaluateAsAbsolute (int64_t &Res) const |
Try to evaluate the expression to an absolute value. | |
LLVM_ABI bool | evaluateAsAbsolute (int64_t &Res, const MCAssembler &Asm) const |
LLVM_ABI bool | evaluateAsAbsolute (int64_t &Res, const MCAssembler *Asm) const |
LLVM_ABI bool | evaluateKnownAbsolute (int64_t &Res, const MCAssembler &Asm) const |
Aggressive variant of evaluateAsRelocatable when relocations are unavailable (e.g. | |
LLVM_ABI bool | evaluateAsRelocatable (MCValue &Res, const MCAssembler *Asm) const |
Try to evaluate the expression to a relocatable value, i.e. | |
LLVM_ABI bool | evaluateAsValue (MCValue &Res, const MCAssembler &Asm) const |
Try to evaluate the expression to the form (a - b + constant) where neither a nor b are variables. | |
LLVM_ABI MCFragment * | findAssociatedFragment () const |
Find the "associated section" for this expression, which is currently defined as the absolute section for constants, or otherwise the section associated with the first defined symbol in the expression. | |
Additional Inherited Members | |
![]() | |
using | Spec = uint16_t |
![]() | |
MCExpr (ExprKind Kind, SMLoc Loc, unsigned SubclassData=0) | |
LLVM_ABI bool | evaluateAsRelocatableImpl (MCValue &Res, const MCAssembler *Asm, bool InSet) const |
unsigned | getSubclassData () const |
Definition at line 453 of file MCExpr.h.
References llvm::MCExpr::Binary, and E.
|
static |
Definition at line 201 of file MCExpr.cpp.
Referenced by llvm::MCAsmParser::applySpecifier(), buildSymbolDiff(), computeLabelDiff(), createAdd(), createAnd(), createAShr(), createDiv(), createEQ(), createGT(), createGTE(), createLAnd(), createLOr(), createLShr(), createLT(), createLTE(), createMod(), createMul(), createNE(), createOr(), createShl(), createSub(), createXor(), makeEndMinusStartExpr(), makeStartPlusIntExpr(), and tryFoldHelper().
|
inlinestatic |
Definition at line 343 of file MCExpr.h.
References Add, create(), LHS, and RHS.
Referenced by createPCXRelExprOp(), llvm::MCResourceInfo::createTotalNumSGPRs(), llvm::AMDGPUTargetAsmStreamer::EmitAmdhsaKernelDescriptor(), llvm::MCWinCOFFStreamer::emitCOFFImgRel32(), llvm::MCWinCOFFStreamer::emitCOFFSecRel32(), llvm::ARMAsmPrinter::emitInstruction(), llvm::SystemZAsmPrinter::emitInstruction(), llvm::X86AsmPrinter::emitInstruction(), llvm::ARMAsmPrinter::emitJumpTableAddrs(), llvm::ARMAsmPrinter::emitJumpTableTBInst(), llvm::AsmPrinter::emitLabelPlusOffset(), llvm::ARMAsmPrinter::emitMachineConstantPoolValue(), llvm::MCObjectStreamer::emitRelocDirective(), EmitSymbolRefWithOfs(), llvm::AsmPrinter::emitXRayTable(), llvm::CodeViewContext::encodeDefRange(), llvm::MipsMCCodeEmitter::getBranchTarget21OpValue(), llvm::MipsMCCodeEmitter::getBranchTarget21OpValueMM(), llvm::MipsMCCodeEmitter::getBranchTarget26OpValue(), llvm::MipsMCCodeEmitter::getBranchTarget26OpValueMM(), llvm::MipsMCCodeEmitter::getBranchTargetOpValue(), llvm::MipsMCCodeEmitter::getBranchTargetOpValue1SImm16(), llvm::MipsMCCodeEmitter::getBranchTargetOpValueLsl2MMR6(), llvm::MipsMCCodeEmitter::getBranchTargetOpValueMMR6(), llvm::MipsTargetObjectFile::getDebugThreadLocalSymbol(), llvm::SystemZMCInstLower::getExpr(), llvm::X86_64MCAsmInfoDarwin::getExprForPersonalitySymbol(), llvm::TargetLoweringObjectFileMachO::getIndirectSymViaGOTPCRel(), llvm::AArch64_ELFTargetObjectFile::getIndirectSymViaGOTPCRel(), llvm::ARMElfTargetObjectFile::getIndirectSymViaGOTPCRel(), llvm::RISCVELFTargetObjectFile::getIndirectSymViaGOTPCRel(), llvm::X86_64MachoTargetObjectFile::getIndirectSymViaGOTPCRel(), llvm::X86_64ELFTargetObjectFile::getIndirectSymViaGOTPCRel(), GetSymbolRef(), llvm::X86_64MachoTargetObjectFile::getTTypeGlobalReference(), llvm::AsmPrinter::lowerConstant(), llvm::AMDGPUMCInstLower::lowerOperand(), llvm::TargetLoweringObjectFileCOFF::lowerRelativeReference(), llvm::TargetLoweringObjectFileELF::lowerSymbolDifference(), LowerSymbolOperand(), llvm::XtensaAsmPrinter::LowerSymbolOperand(), llvm::LanaiMCInstLower::LowerSymbolOperand(), llvm::M68kMCInstLower::LowerSymbolOperand(), llvm::MSP430MCInstLower::LowerSymbolOperand(), lowerSymbolOperand(), llvm::AVRMCInstLower::lowerSymbolOperand(), llvm::AArch64MCInstLower::lowerSymbolOperandCOFF(), llvm::AArch64MCInstLower::lowerSymbolOperandELF(), llvm::AArch64MCInstLower::lowerSymbolOperandMachO(), llvm::LoongArchAsmBackend::relaxAlign(), llvm::AMDGPUAsmPrinter::runOnMachineFunction(), llvm::MCExternalSymbolizer::tryAddingSymbolicOperand(), and llvm::AArch64ExternalSymbolizer::tryAddingSymbolicOperand().
|
inlinestatic |
Definition at line 348 of file MCExpr.h.
References create(), LHS, and RHS.
Referenced by llvm::AMDGPU::MCKernelDescriptor::bits_get(), llvm::AMDGPU::MCKernelDescriptor::bits_set(), llvm::SIInstrInfo::insertIndirectBranch(), MaskShift(), llvm::AMDGPU::maskShiftGet(), and llvm::AMDGPU::maskShiftSet().
|
inlinestatic |
Definition at line 353 of file MCExpr.h.
References create(), Div, LHS, and RHS.
Referenced by computeAccumOffset(), llvm::ARMAsmPrinter::emitJumpTableTBInst(), and GetSubDivExpr().
|
inlinestatic |
Definition at line 423 of file MCExpr.h.
References create(), LHS, LShr, and RHS.
Referenced by llvm::AMDGPU::MCKernelDescriptor::bits_get(), llvm::SystemZTargetGOFFStreamer::createWordDiffExpr(), llvm::SystemZTargetHLASMStreamer::createWordDiffExpr(), and llvm::AMDGPU::maskShiftGet().
|
inlinestatic |
Definition at line 398 of file MCExpr.h.
References create(), LHS, Mul, and RHS.
Referenced by llvm::AMDGPUTargetAsmStreamer::EmitAmdhsaKernelDescriptor(), and llvm::AMDGPUAsmPrinter::runOnMachineFunction().
|
inlinestatic |
Definition at line 408 of file MCExpr.h.
References create(), LHS, and RHS.
Referenced by ARMEmitUnwindInfo(), llvm::AMDGPU::MCKernelDescriptor::bits_set(), llvm::AMDGPUDisassembler::decodeVersionImm(), llvm::AMDGPU::AMDGPUMCKernelCodeT::EmitKernelCodeT(), llvm::SIProgramInfo::getComputePGMRSrc1(), llvm::SIProgramInfo::getComputePGMRSrc2(), llvm::SIProgramInfo::getPGMRSrc1(), and llvm::AMDGPUPALMetadata::setRegister().
|
inlinestatic |
Definition at line 413 of file MCExpr.h.
References create(), LHS, RHS, and Shl.
Referenced by llvm::AMDGPU::MCKernelDescriptor::bits_set(), MaskShift(), and llvm::AMDGPU::maskShiftSet().
|
inlinestatic |
Definition at line 428 of file MCExpr.h.
References create(), LHS, RHS, and Sub.
Referenced by llvm::CSKYConstantPool::addEntry(), addNegOperand(), computeAccumOffset(), createPCXRelExprOp(), llvm::SystemZTargetGOFFStreamer::createWordDiffExpr(), llvm::SystemZTargetHLASMStreamer::createWordDiffExpr(), EmitAbsDifference(), llvm::MCStreamer::emitAbsoluteSymbolDiff(), llvm::MCStreamer::emitAbsoluteSymbolDiffAsULEB128(), llvm::AMDGPUTargetELFStreamer::EmitAmdhsaKernelDescriptor(), llvm::MipsTargetELFStreamer::emitDirectiveEnd(), llvm::EHStreamer::emitExceptionTable(), llvm::AsmPrinter::emitFunctionBody(), llvm::AMDGPUAsmPrinter::emitFunctionBodyEnd(), llvm::AMDGPUTargetELFStreamer::EmitHSAMetadata(), llvm::ARMAsmPrinter::emitInstruction(), llvm::X86AsmPrinter::emitInstruction(), llvm::AMDGPUTargetELFStreamer::EmitISAVersion(), llvm::ARMAsmPrinter::emitJumpTableAddrs(), llvm::AsmPrinter::emitJumpTableEntry(), llvm::ARMAsmPrinter::emitJumpTableTBInst(), llvm::X86AsmPrinter::emitKCFITypeId(), llvm::ARMAsmPrinter::emitMachineConstantPoolValue(), llvm::CSKYAsmPrinter::emitMachineConstantPoolValue(), EmitSymbolRefWithOfs(), llvm::AsmPrinter::emitXRayTable(), llvm::WasmException::endFunction(), llvm::MCAsmInfo::getExprForFDESymbol(), llvm::AArch64MCAsmInfoDarwin::getExprForPersonalitySymbol(), llvm::TargetLoweringObjectFileMachO::getIndirectSymViaGOTPCRel(), llvm::AArch64_MachoTargetObjectFile::getIndirectSymViaGOTPCRel(), GetOptionalAbsDifference(), GetSubDivExpr(), GetSymbolRef(), llvm::AArch64_MachoTargetObjectFile::getTTypeGlobalReference(), llvm::TargetLoweringObjectFile::getTTypeReference(), llvm::HexagonAsmPrinter::HexagonProcessInstruction(), llvm::SIInstrInfo::insertIndirectBranch(), llvm::AsmPrinter::lowerConstant(), llvm::VETargetLowering::LowerCustomJumpTableEntry(), llvm::TargetLoweringObjectFileELF::lowerSymbolDifference(), llvm::FaultMaps::recordFaultingOp(), llvm::MCExternalSymbolizer::tryAddingSymbolicOperand(), and llvm::AArch64ExternalSymbolizer::tryAddingSymbolicOperand().
Get the left-hand side expression of the binary operator.
Definition at line 446 of file MCExpr.h.
References LHS.
Referenced by llvm::MCAsmParser::applySpecifier(), binaryOpKnownBitsMapHelper(), llvm::SystemZHLASMAsmStreamer::emitHLASMValueImpl(), llvm::MCExpr::evaluateAsRelocatableImpl(), EvaluateCRExpr(), llvm::MCExpr::findAssociatedFragment(), llvm::PPCMCCodeEmitter::getDispRI34PCRelEncoding(), hasGOTReference(), isEvaluated(), llvm::AMDGPUMCExpr::isSymbolUsedInExpression(), llvm::LoongArchAsmBackend::relaxDwarfCFA(), llvm::RISCVAsmBackend::relaxDwarfCFA(), startsWithGlobalOffsetTable(), tryFoldHelper(), and llvm::MCStreamer::visitUsedExpr().
|
inline |
Get the kind of this binary expression.
Definition at line 443 of file MCExpr.h.
References llvm::MCExpr::getSubclassData().
Referenced by llvm::MCAsmParser::applySpecifier(), binaryOpKnownBitsMapHelper(), llvm::SystemZHLASMAsmStreamer::emitHLASMValueImpl(), llvm::MCExpr::evaluateAsRelocatableImpl(), EvaluateCRExpr(), llvm::MCExpr::findAssociatedFragment(), llvm::PPCMCCodeEmitter::getDispRI34PCRelEncoding(), and tryFoldHelper().
Get the right-hand side expression of the binary operator.
Definition at line 449 of file MCExpr.h.
References RHS.
Referenced by llvm::MCAsmParser::applySpecifier(), binaryOpKnownBitsMapHelper(), llvm::SystemZHLASMAsmStreamer::emitHLASMValueImpl(), llvm::MCExpr::evaluateAsRelocatableImpl(), EvaluateCRExpr(), llvm::MCExpr::findAssociatedFragment(), llvm::PPCMCCodeEmitter::getDispRI34PCRelEncoding(), hasGOTReference(), isEvaluated(), llvm::AMDGPUMCExpr::isSymbolUsedInExpression(), llvm::LoongArchAsmBackend::relaxDwarfCFA(), llvm::RISCVAsmBackend::relaxDwarfCFA(), startsWithGlobalOffsetTable(), tryFoldHelper(), and llvm::MCStreamer::visitUsedExpr().