LLVM
8.0.1
|
#include "InstPrinter/X86ATTInstPrinter.h"
#include "InstPrinter/X86InstComments.h"
#include "MCTargetDesc/X86BaseInfo.h"
#include "MCTargetDesc/X86TargetStreamer.h"
#include "Utils/X86ShuffleDecode.h"
#include "X86AsmPrinter.h"
#include "X86RegisterInfo.h"
#include "X86ShuffleDecodeConstantPool.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/CodeGen/MachineConstantPool.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineModuleInfoImpls.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/StackMaps.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/Mangler.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCCodeEmitter.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCFixup.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCInstBuilder.h"
#include "llvm/MC/MCSection.h"
#include "llvm/MC/MCSectionELF.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/MC/MCSymbolELF.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
Go to the source code of this file.
Macros | |
#define | MOV_CASE(Prefix, Suffix) |
#define | MOV_AVX512_CASE(Suffix) |
#define | CASE_ALL_MOV_RM() |
Functions | |
static void | EmitNops (MCStreamer &OS, unsigned NumBytes, bool Is64Bit, const MCSubtargetInfo &STI) |
Emit the optimal amount of multi-byte nops on X86. More... | |
static void | SimplifyShortImmForm (MCInst &Inst, unsigned Opcode) |
Simplify FOO $imm, %{al,ax,eax,rax} to FOO $imm, for instruction with a short fixed-register form. More... | |
static void | SimplifyMOVSX (MCInst &Inst) |
If a movsx instruction has a shorter encoding for the used register simplify the instruction to use it instead. More... | |
static void | SimplifyShortMoveForm (X86AsmPrinter &Printer, MCInst &Inst, unsigned Opcode) |
Simplify things like MOV32rm to MOV32o32a. More... | |
static unsigned | getRetOpcode (const X86Subtarget &Subtarget) |
static unsigned | EmitNop (MCStreamer &OS, unsigned NumBytes, bool Is64Bit, const MCSubtargetInfo &STI) |
Emit the largest nop instruction smaller than or equal to NumBytes bytes. More... | |
static MachineBasicBlock::const_iterator | PrevCrossBBInst (MachineBasicBlock::const_iterator MBBI) |
static const Constant * | getConstantFromPool (const MachineInstr &MI, const MachineOperand &Op) |
static std::string | getShuffleComment (const MachineInstr *MI, unsigned SrcOp1Idx, unsigned SrcOp2Idx, ArrayRef< int > Mask) |
static void | printConstant (const APInt &Val, raw_ostream &CS) |
static void | printConstant (const APFloat &Flt, raw_ostream &CS) |
static void | printConstant (const Constant *COp, raw_ostream &CS) |
static unsigned | getRegisterWidth (const MCOperandInfo &Info) |
#define CASE_ALL_MOV_RM | ( | ) |
Referenced by llvm::X86AsmPrinter::EmitInstruction().
#define MOV_AVX512_CASE | ( | Suffix | ) |
#define MOV_CASE | ( | Prefix, | |
Suffix | |||
) |
|
static |
Emit the largest nop instruction smaller than or equal to NumBytes
bytes.
Return the size of nop emitted.
Definition at line 773 of file X86MCInstLower.cpp.
References assert(), llvm::MCStreamer::EmitBytes(), llvm::MCStreamer::EmitInstruction(), and llvm_unreachable.
Referenced by EmitNops().
|
static |
Emit the optimal amount of multi-byte nops on X86.
Definition at line 872 of file X86MCInstLower.cpp.
References llvm::MCStreamer::AddComment(), addOperand(), llvm::MCInst::addOperand(), assert(), llvm::MCSymbolRefExpr::create(), llvm::MCOperand::createImm(), llvm::MachineOperand::CreateMCSymbol(), llvm::MCOperand::createReg(), llvm::MCContext::createTempSymbol(), llvm::AsmPrinter::CUSTOM_EVENT, E, llvm::MCStreamer::EmitBinaryData(), llvm::MCStreamer::EmitBytes(), llvm::MCStreamer::EmitCodeAlignment(), llvm::MCStreamer::EmitInstruction(), llvm::MCStreamer::EmitLabel(), EmitNop(), llvm::MCCodeEmitter::encodeInstruction(), llvm::FaultMaps::FaultKindMax, llvm::AsmPrinter::FUNCTION_ENTER, llvm::AsmPrinter::FUNCTION_EXIT, llvm::PatchPointOpers::getCallTarget(), llvm::MCStreamer::getContext(), llvm::MachineOperand::getImm(), llvm::MachineOperand::getMBB(), llvm::PatchPointOpers::getNextScratchIdx(), llvm::MachineInstr::getNumOperands(), llvm::PatchPointOpers::getNumPatchBytes(), llvm::MachineInstr::getOperand(), llvm::MCContext::getOrCreateSymbol(), llvm::MachineOperand::getReg(), llvm::AsmPrinter::getSubtargetInfo(), llvm::MachineBasicBlock::getSymbol(), llvm::MachineOperand::getType(), I, llvm::X86Subtarget::is64Bit(), llvm::MachineOperand::isImm(), llvm::AsmPrinter::isPositionIndependent(), llvm::X86II::isX86_64ExtendedReg(), llvm_unreachable, llvm::make_range(), MI, llvm::MachineOperand::MO_ExternalSymbol, llvm::MachineOperand::MO_GlobalAddress, llvm::MachineOperand::MO_Immediate, llvm::X86II::MO_PLT, llvm::MachineOperand::MO_Register, llvm::MachineInstr::operands_begin(), llvm::MachineInstr::operands_end(), llvm::AsmPrinter::OutContext, llvm::FaultMaps::recordFaultingOp(), llvm::StackMaps::recordPatchPoint(), llvm::AsmPrinter::recordSled(), llvm::StackMaps::recordStackMap(), llvm::StackMaps::recordStatepoint(), llvm::report_fatal_error(), llvm::MipsISD::Ret, llvm::MCInst::setOpcode(), llvm::MachineOperand::setTargetFlags(), llvm::SmallVectorBase::size(), llvm::AsmPrinter::TAIL_CALL, llvm::AsmPrinter::TYPED_EVENT, llvm::X86Subtarget::useRetpolineIndirectCalls(), and llvm::MCSymbolRefExpr::VK_None.
Referenced by llvm::MCAlignFragment::hasEmitNops(), and llvm::MCAlignFragment::setEmitNops().
|
static |
Definition at line 1380 of file X86MCInstLower.cpp.
References assert(), C, llvm::MachineConstantPoolEntry::ConstVal, llvm::MachineFunction::getConstantPool(), llvm::MachineConstantPool::getConstants(), llvm::MachineOperand::getIndex(), llvm::MachineOperand::getOffset(), llvm::MachineBasicBlock::getParent(), llvm::MachineInstr::getParent(), llvm::MachineConstantPoolEntry::getType(), llvm::Value::getType(), llvm::MachineOperand::isCPI(), llvm::MachineConstantPoolEntry::isMachineConstantPoolEntry(), and llvm::MachineConstantPoolEntry::Val.
Referenced by llvm::X86AsmPrinter::EmitInstruction().
|
static |
Definition at line 1598 of file X86MCInstLower.cpp.
References llvm_unreachable, and llvm::MCOperandInfo::RegClass.
Referenced by llvm::X86AsmPrinter::EmitInstruction().
|
static |
Definition at line 396 of file X86MCInstLower.cpp.
References llvm::MCInst::addOperand(), llvm::X86::AddrNumOperands, llvm::X86::AddrSegmentReg, assert(), llvm::ISD::CATCHRET, llvm::ISD::CLEANUPRET, llvm::MCSymbolRefExpr::create(), llvm::MCOperand::createExpr(), llvm::MCOperand::createImm(), llvm::MCOperand::createReg(), llvm::N86::EAX, llvm::N86::EBX, llvm::ISD::EH_RETURN, llvm::errs(), llvm::MachineOperand::getBlockAddress(), llvm::AsmPrinter::GetBlockAddressSymbol(), llvm::X86::GetCondBranchFromCond(), llvm::MCStreamer::getContext(), llvm::AsmPrinter::GetCPISymbol(), llvm::MachineOperand::getImm(), llvm::MachineOperand::getIndex(), llvm::AsmPrinter::GetJTISymbol(), llvm::MachineOperand::getMCSymbol(), llvm::MCInst::getNumOperands(), llvm::MCInst::getOpcode(), llvm::MachineInstr::getOpcode(), llvm::MCInst::getOperand(), llvm::MachineInstr::getOperand(), llvm::MCContext::getOrCreateSymbol(), llvm::MCOperand::getReg(), llvm::MachineOperand::getReg(), GetSymbolFromOperand(), llvm::MachineOperand::getType(), llvm::X86Subtarget::is64Bit(), llvm::MachineOperand::isImplicit(), llvm::X86II::isX86_64ExtendedReg(), llvm_unreachable, llvm::Lower, LowerSymbolOperand(), MI, llvm::MachineOperand::MO_BlockAddress, llvm::MachineOperand::MO_ConstantPoolIndex, llvm::MachineOperand::MO_ExternalSymbol, llvm::MachineOperand::MO_GlobalAddress, llvm::MachineOperand::MO_Immediate, llvm::MachineOperand::MO_JumpTableIndex, llvm::MachineOperand::MO_MachineBasicBlock, llvm::MachineOperand::MO_MCSymbol, llvm::MachineOperand::MO_Register, llvm::MachineOperand::MO_RegisterMask, name, llvm::None, llvm::MachineInstr::operands(), llvm::MachineInstr::print(), llvm::MCInst::setOpcode(), SimplifyMOVSX(), SimplifyShortImmForm(), SimplifyShortMoveForm(), llvm::MCSymbolRefExpr::VK_PLT, llvm::MCSymbolRefExpr::VK_TLSGD, llvm::MCSymbolRefExpr::VK_TLSLD, and llvm::MCSymbolRefExpr::VK_TLSLDM.
Referenced by llvm::X86AsmPrinter::EmitInstruction().
|
static |
Definition at line 1400 of file X86MCInstLower.cpp.
References assert(), llvm::ArrayRef< T >::begin(), llvm::ArrayRef< T >::end(), llvm::raw_ostream::flush(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::getReg(), llvm::X86ATTInstPrinter::getRegisterName(), llvm::MachineOperand::isReg(), llvm::SM_SentinelUndef, and llvm::SM_SentinelZero.
Referenced by llvm::X86AsmPrinter::EmitInstruction().
|
static |
Definition at line 1369 of file X86MCInstLower.cpp.
References llvm::MachineBasicBlock::begin(), llvm::MachineBasicBlock::end(), llvm::MachineFunction::front(), llvm::MachineBasicBlock::getParent(), and llvm::ilist_node_with_parent< NodeTy, ParentTy, Options >::getPrevNode().
Referenced by llvm::X86AsmPrinter::EmitInstruction().
|
static |
Definition at line 1485 of file X86MCInstLower.cpp.
References llvm::APInt::getBitWidth(), llvm::APInt::getNumWords(), llvm::APInt::getRawData(), llvm::APInt::getZExtValue(), and N.
Referenced by llvm::X86AsmPrinter::EmitInstruction(), and printConstant().
|
static |
Definition at line 1500 of file X86MCInstLower.cpp.
References llvm::APFloat::toString().
|
static |
Definition at line 1507 of file X86MCInstLower.cpp.
References assert(), llvm::X86TargetStreamer::emitFPOEndPrologue(), llvm::X86TargetStreamer::emitFPOPushReg(), llvm::X86TargetStreamer::emitFPOSetFrame(), llvm::X86TargetStreamer::emitFPOStackAlign(), llvm::X86TargetStreamer::emitFPOStackAlloc(), llvm::MCStreamer::EmitWinCFIAllocStack(), llvm::MCStreamer::EmitWinCFIEndProlog(), llvm::MCStreamer::EmitWinCFIPushFrame(), llvm::MCStreamer::EmitWinCFIPushReg(), llvm::MCStreamer::EmitWinCFISaveReg(), llvm::MCStreamer::EmitWinCFISaveXMM(), llvm::MCStreamer::EmitWinCFISetFrame(), llvm::MachineOperand::getImm(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::X86RegisterInfo::getSEHRegNum(), llvm::X86AsmPrinter::getSubtarget(), llvm::MachineFunction::getSubtarget(), llvm::MCStreamer::getTargetStreamer(), llvm::MachineFunction::hasWinCFI(), llvm_unreachable, llvm::AsmPrinter::MF, and printConstant().
|
static |
If a movsx instruction has a shorter encoding for the used register simplify the instruction to use it instead.
Definition at line 318 of file X86MCInstLower.cpp.
References llvm::AArch64CC::AL, llvm::N86::EAX, llvm::MCInst::getOpcode(), llvm::MCInst::getOperand(), llvm::MCOperand::getReg(), llvm_unreachable, and llvm::MCInst::setOpcode().
Referenced by getRetOpcode().
Simplify FOO $imm, %{al,ax,eax,rax} to FOO $imm, for instruction with a short fixed-register form.
Definition at line 295 of file X86MCInstLower.cpp.
References llvm::MCInst::addOperand(), llvm::AArch64CC::AL, assert(), llvm::N86::EAX, llvm::MCInst::getNumOperands(), llvm::MCInst::getOperand(), llvm::MCOperand::getReg(), llvm::MCOperand::isExpr(), llvm::MCOperand::isImm(), llvm::MCOperand::isReg(), Reg, and llvm::MCInst::setOpcode().
Referenced by getRetOpcode().
|
static |
Simplify things like MOV32rm to MOV32o32a.
Definition at line 345 of file X86MCInstLower.cpp.
References llvm::HexagonII::Absolute, llvm::MCInst::addOperand(), llvm::X86::AddrBaseReg, llvm::X86::AddrIndexReg, llvm::X86::AddrScaleAmt, llvm::X86::AddrSegmentReg, llvm::AArch64CC::AL, assert(), llvm::N86::EAX, llvm::MCOperand::getExpr(), llvm::MCOperand::getImm(), llvm::MCInst::getNumOperands(), llvm::MCInst::getOperand(), llvm::MCOperand::getReg(), llvm::X86AsmPrinter::getSubtarget(), llvm::X86Subtarget::is64Bit(), llvm::MCOperand::isExpr(), llvm::MCOperand::isImm(), llvm::MCOperand::isReg(), Reg, llvm::MCInst::setOpcode(), and llvm::MCSymbolRefExpr::VK_TLVP.
Referenced by getRetOpcode().