LLVM  7.0.0
Public Member Functions | List of all members
llvm::X86_MC::X86MCInstrAnalysis Class Reference
Inheritance diagram for llvm::X86_MC::X86MCInstrAnalysis:
[legend]
Collaboration diagram for llvm::X86_MC::X86MCInstrAnalysis:
[legend]

Public Member Functions

 X86MCInstrAnalysis (const MCInstrInfo *MCII)
 
bool isDependencyBreaking (const MCSubtargetInfo &STI, const MCInst &Inst) const override
 Returns true if. More...
 
bool clearsSuperRegisters (const MCRegisterInfo &MRI, const MCInst &Inst, APInt &Mask) const override
 Returns true if at least one of the register writes performed by. More...
 
- Public Member Functions inherited from llvm::MCInstrAnalysis
 MCInstrAnalysis (const MCInstrInfo *Info)
 
virtual ~MCInstrAnalysis ()=default
 
virtual bool isBranch (const MCInst &Inst) const
 
virtual bool isConditionalBranch (const MCInst &Inst) const
 
virtual bool isUnconditionalBranch (const MCInst &Inst) const
 
virtual bool isIndirectBranch (const MCInst &Inst) const
 
virtual bool isCall (const MCInst &Inst) const
 
virtual bool isReturn (const MCInst &Inst) const
 
virtual bool isTerminator (const MCInst &Inst) const
 
virtual bool evaluateBranch (const MCInst &Inst, uint64_t Addr, uint64_t Size, uint64_t &Target) const
 Given a branch instruction try to get the address the branch targets. More...
 

Additional Inherited Members

- Protected Attributes inherited from llvm::MCInstrAnalysis
const MCInstrInfo * Info
 

Detailed Description

Definition at line 302 of file X86MCTargetDesc.cpp.

Constructor & Destructor Documentation

◆ X86MCInstrAnalysis()

llvm::X86_MC::X86MCInstrAnalysis::X86MCInstrAnalysis ( const MCInstrInfo *  MCII)
inline

Member Function Documentation

◆ clearsSuperRegisters()

bool llvm::X86_MC::X86MCInstrAnalysis::clearsSuperRegisters ( const MCRegisterInfo &  MRI,
const MCInst &  Inst,
APInt &  Writes 
) const
overridevirtual

Returns true if at least one of the register writes performed by.

Parameters
Instimplicitly clears the upper portion of all super-registers.

Example: on X86-64, a write to EAX implicitly clears the upper half of RAX. Also (still on x86) an XMM write perfomed by an AVX 128-bit instruction implicitly clears the upper portion of the correspondent YMM register.

This method also updates an APInt which is used as mask of register writes. There is one bit for every explicit/implicit write performed by the instruction. If a write implicitly clears its super-registers, then the corresponding bit is set (vic. the corresponding bit is cleared).

The first bits in the APint are related to explicit writes. The remaining bits are related to implicit writes. The sequence of writes follows the machine operand sequence. For implicit writes, the sequence is defined by the MCInstrDesc.

The assumption is that the bit-width of the APInt is correctly set by the caller. The default implementation conservatively assumes that none of the writes clears the upper portion of a super-register.

Reimplemented from llvm::MCInstrAnalysis.

Definition at line 388 of file X86MCTargetDesc.cpp.

References assert(), llvm::APInt::clearAllBits(), llvm::MCRegisterClass::contains(), E, llvm::X86II::EncodingMask, llvm::X86II::EVEX, llvm::MCInstrInfo::get(), llvm::APInt::getBitWidth(), llvm::APInt::getBoolValue(), llvm::MCInstrDesc::getImplicitDefs(), llvm::MCInstrDesc::getNumDefs(), llvm::MCInstrDesc::getNumImplicitDefs(), llvm::MCInst::getOpcode(), llvm::MCInst::getOperand(), llvm::MCOperand::getReg(), llvm::MCRegisterInfo::getRegClass(), I, llvm::MCInstrAnalysis::Info, Reg, llvm::APInt::setBit(), llvm::MCInstrDesc::TSFlags, llvm::X86II::VEX, and llvm::X86II::XOP.

Referenced by X86MCInstrAnalysis().

◆ isDependencyBreaking()

bool llvm::X86_MC::X86MCInstrAnalysis::isDependencyBreaking ( const MCSubtargetInfo &  STI,
const MCInst &  Inst 
) const
overridevirtual

Returns true if.

Parameters
Instis a dependency breaking instruction for the given subtarget.

The value computed by a dependency breaking instruction is not dependent on the inputs. An example of dependency breaking instruction on X86 is XOR eax, eax. TODO: In future, we could implement an alternative approach where this method returns true if the input instruction is not dependent on some/all of its input operands. An APInt mask could then be used to identify independent operands.

Reimplemented from llvm::MCInstrAnalysis.

Definition at line 316 of file X86MCTargetDesc.cpp.

References llvm::MCSubtargetInfo::getCPU(), llvm::MCInst::getOpcode(), llvm::MCInst::getOperand(), and llvm::MCOperand::getReg().

Referenced by X86MCInstrAnalysis().


The documentation for this class was generated from the following file: