27 #define AVR_RELAX_MEM_OPS_NAME "AVR memory operation relaxation pass"
45 typedef Block::iterator BlockIt;
49 template <
unsigned OP>
bool relax(Block &
MBB, BlockIt MBBI);
52 bool runOnInstruction(Block &MBB, BlockIt MBBI);
55 return BuildMI(MBB, MBBI, MBBI->getDebugLoc(),
TII->get(Opcode));
62 bool Modified =
false;
67 for (Block &
MBB : MF) {
69 Modified |= BlockModified;
76 bool Modified =
false;
78 BlockIt MBBI = MBB.begin(),
E = MBB.end();
80 BlockIt NMBBI = std::next(MBBI);
81 Modified |= runOnInstruction(MBB, MBBI);
89 bool AVRRelaxMem::relax<AVR::STDWPtrQRr>(Block &
MBB, BlockIt MBBI) {
100 buildMI(MBB, MBBI, AVR::PUSHWRr)
104 buildMI(MBB, MBBI, AVR::SBCIWRdK)
111 buildMI(MBB, MBBI, AVR::STWPtrRr)
116 buildMI(MBB, MBBI, AVR::POPWRd)
125 bool AVRRelaxMem::runOnInstruction(Block &MBB, BlockIt MBBI) {
127 int Opcode = MBBI->getOpcode();
131 return relax<Op>(MBB, MI)
134 RELAX(AVR::STDWPtrQRr);
const AVRInstrInfo * getInstrInfo() const override
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
INITIALIZE_PASS(AVRRelaxMem,"avr-relax-mem", AVR_RELAX_MEM_OPS_NAME, false, false) namespace llvm
static bool runOnBasicBlock(BasicBlock &BB)
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
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)
static GCRegistry::Add< CoreCLRGC > E("coreclr","CoreCLR-compatible GC")
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 MachineOperand & getOperand(unsigned i) const
FunctionPass class - This class is used to implement most global optimizations.
MachineOperand class - Representation of each machine instruction operand.
A specific AVR target MCU.
Representation of each machine instruction.
MachineInstr * removeFromParent()
Unlink 'this' from the containing basic block, and return it without deleting it. ...
unsigned getReg() const
getReg - Returns the register number.
StringRef - Represent a constant reference to a string, i.e.