32 #define DEBUG_TYPE "x86-fixup-setcc" 34 STATISTIC(NumSubstZexts,
"Number of setcc + zext pairs substituted");
41 StringRef getPassName()
const override {
return "X86 Fixup SetCC"; }
49 enum { SearchBound = 16 };
66 for (
auto &MBB : MF) {
68 for (
auto &
MI : MBB) {
70 if (
MI.definesRegister(X86::EFLAGS))
76 if (
MI.getOpcode() != X86::SETCCr)
80 for (
auto &
Use :
MRI->use_instructions(
MI.getOperand(0).getReg()))
81 if (
Use.getOpcode() == X86::MOVZX32rr8)
104 : &X86::GR32_ABCDRegClass;
106 Register InsertReg =
MRI->createVirtualRegister(RC);
109 BuildMI(MBB, FlagsDefMI,
MI.getDebugLoc(),
TII->get(X86::MOV32r0),
115 TII->get(X86::INSERT_SUBREG), InsertReg)
118 .addImm(X86::sub_8bit);
124 for (
auto &
I : ToErase)
125 I->eraseFromParent();
This class represents lattice values for constants.
void push_back(const T &Elt)
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
FunctionPass * createX86FixupSetCC()
Return a pass that transforms setcc + movzx pairs into xor + setcc.
STATISTIC(NumFunctions, "Total number of functions")
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
const HexagonInstrInfo * TII
A Use represents the edge between a Value definition and its users.
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
unsigned const MachineRegisterInfo * MRI
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
FunctionPass class - This class is used to implement most global optimizations.
bool readsRegister(Register Reg, const TargetRegisterInfo *TRI=nullptr) const
Return true if the MachineInstr reads the specified register.
const MachineBasicBlock * getParent() const
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
Representation of each machine instruction.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
StringRef - Represent a constant reference to a string, i.e.
Register getReg() const
getReg - Returns the register number.
const MachineOperand & getOperand(unsigned i) const
const MachineInstrBuilder & addReg(Register RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
static bool is64Bit(const char *name)
Wrapper class representing virtual and physical registers.