37#define DEBUG_TYPE "x86-fixup-setcc"
39STATISTIC(NumSubstZexts,
"Number of setcc + zext pairs substituted");
57 enum { SearchBound = 16 };
61char X86FixupSetCCPass::ID = 0;
71 TII = ST->getInstrInfo();
75 for (
auto &
MBB : MF) {
77 for (
auto &
MI :
MBB) {
79 if (
MI.definesRegister(X86::EFLAGS,
nullptr))
85 if (
MI.getOpcode() != X86::SETCCr)
90 for (
auto &
Use :
MRI->use_instructions(Reg0))
91 if (
Use.getOpcode() == X86::MOVZX32rr8)
110 ST->is64Bit() ? &X86::GR32RegClass : &X86::GR32_ABCDRegClass;
125 MI.setDesc(
TII->get(X86::SETZUCCr));
127 TII->get(TargetOpcode::IMPLICIT_DEF), ZeroReg);
143 for (
auto &
I : ToErase)
144 I->eraseFromParent();
unsigned const MachineRegisterInfo * MRI
const HexagonInstrInfo * TII
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
FunctionPass class - This class is used to implement most global optimizations.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
virtual bool runOnMachineFunction(MachineFunction &MF)=0
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
const MachineInstrBuilder & addReg(Register RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
Representation of each machine instruction.
const MachineBasicBlock * getParent() const
bool readsRegister(Register Reg, const TargetRegisterInfo *TRI) const
Return true if the MachineInstr reads the specified register.
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
const MachineOperand & getOperand(unsigned i) const
Register getReg() const
getReg - Returns the register number.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
Wrapper class representing virtual and physical registers.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
A Use represents the edge between a Value definition and its users.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This is an optimization pass for GlobalISel generic memory operations.
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
FunctionPass * createX86FixupSetCC()
Return a pass that transforms setcc + movzx pairs into xor + setcc.