26 #define AVR_RELAX_MEM_OPS_NAME "AVR memory operation relaxation pass" 44 typedef Block::iterator BlockIt;
48 template <
unsigned OP>
bool relax(Block &MBB, BlockIt MBBI);
51 bool runOnInstruction(Block &MBB, BlockIt MBBI);
54 return BuildMI(MBB, MBBI, MBBI->getDebugLoc(), TII->
get(Opcode));
66 for (Block &MBB : MF) {
68 Modified |= BlockModified;
77 BlockIt MBBI = MBB.begin(),
E = MBB.end();
79 BlockIt NMBBI = std::next(MBBI);
80 Modified |= runOnInstruction(MBB, MBBI);
88 bool AVRRelaxMem::relax<AVR::STDWPtrQRr>(Block &MBB, BlockIt MBBI) {
99 buildMI(MBB, MBBI, AVR::PUSHWRr)
103 buildMI(MBB, MBBI, AVR::SBCIWRdK)
110 buildMI(MBB, MBBI, AVR::STWPtrRr)
115 buildMI(MBB, MBBI, AVR::POPWRd)
124 bool AVRRelaxMem::runOnInstruction(Block &MBB, BlockIt MBBI) {
126 int Opcode = MBBI->getOpcode();
130 return relax<Op>(MBB, MI) 133 RELAX(AVR::STDWPtrQRr);
const AVRInstrInfo * getInstrInfo() const override
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
This class represents lattice values for constants.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
const HexagonInstrInfo * TII
FunctionPass * createAVRRelaxMemPass()
void initializeAVRRelaxMemPass(PassRegistry &)
#define AVR_RELAX_MEM_OPS_NAME
unsigned getKillRegState(bool B)
TargetInstrInfo - Interface to description of machine instruction set.
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static bool runOnBasicBlock(MachineBasicBlock *MBB, unsigned BasicBlockNum, VRegRenamer &Renamer)
FunctionPass class - This class is used to implement most global optimizations.
INITIALIZE_PASS(AVRRelaxMem, "avr-relax-mem", AVR_RELAX_MEM_OPS_NAME, false, false) namespace llvm
MachineOperand class - Representation of each machine instruction operand.
A specific AVR target MCU.
Representation of each machine instruction.
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode...
MachineInstr * removeFromParent()
Unlink 'this' from the containing basic block, and return it without deleting it. ...
StringRef - Represent a constant reference to a string, i.e.
Register getReg() const
getReg - Returns the register number.
const MachineOperand & getOperand(unsigned i) const