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));
67 for (Block &MBB : MF) {
69 Modified |= BlockModified;
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...
This class represents lattice values for constants.
unsigned getReg() const
getReg - Returns the register number.
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")
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.
static bool runOnBasicBlock(MachineBasicBlock *MBB, std::vector< StringRef > &bbNames, std::vector< unsigned > &renamedInOtherBB, unsigned &basicBlockNum, unsigned &VRegGapIndex, NamedVRegCursor &NVC)
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.
const MachineOperand & getOperand(unsigned i) const