Lines Matching refs:MI

81   uint64_t getBinaryCodeForInstr(const MachineInstr &MI) const;
83 void emitInstruction(MachineBasicBlock::instr_iterator MI,
101 unsigned getMachineOpValue(const MachineInstr &MI,
104 unsigned getRelocation(const MachineInstr &MI,
107 unsigned getJumpTargetOpValue(const MachineInstr &MI, unsigned OpNo) const;
108 unsigned getJumpTargetOpValueMM(const MachineInstr &MI, unsigned OpNo) const;
109 unsigned getBranchTargetOpValueMM(const MachineInstr &MI,
112 unsigned getBranchTargetOpValue(const MachineInstr &MI, unsigned OpNo) const;
113 unsigned getMemEncoding(const MachineInstr &MI, unsigned OpNo) const;
114 unsigned getMemEncodingMMImm12(const MachineInstr &MI, unsigned OpNo) const;
115 unsigned getSizeExtEncoding(const MachineInstr &MI, unsigned OpNo) const;
116 unsigned getSizeInsEncoding(const MachineInstr &MI, unsigned OpNo) const;
117 unsigned getLSAImmEncoding(const MachineInstr &MI, unsigned OpNo) const;
123 void expandACCInstr(MachineBasicBlock::instr_iterator MI,
127 bool expandPseudos(MachineBasicBlock::instr_iterator &MI,
165 unsigned MipsCodeEmitter::getRelocation(const MachineInstr &MI, in getRelocation() argument
168 uint64_t TSFlags = MI.getDesc().TSFlags; in getRelocation()
173 && MI.isBranch()) in getRelocation()
175 if (Form == MipsII::FrmI && MI.getOpcode() == Mips::LUi) in getRelocation()
180 unsigned MipsCodeEmitter::getJumpTargetOpValue(const MachineInstr &MI, in getJumpTargetOpValue() argument
182 MachineOperand MO = MI.getOperand(OpNo); in getJumpTargetOpValue()
184 emitGlobalAddress(MO.getGlobal(), getRelocation(MI, MO), true); in getJumpTargetOpValue()
186 emitExternalSymbolAddress(MO.getSymbolName(), getRelocation(MI, MO)); in getJumpTargetOpValue()
188 emitMachineBasicBlock(MO.getMBB(), getRelocation(MI, MO)); in getJumpTargetOpValue()
194 unsigned MipsCodeEmitter::getJumpTargetOpValueMM(const MachineInstr &MI, in getJumpTargetOpValueMM() argument
200 unsigned MipsCodeEmitter::getBranchTargetOpValueMM(const MachineInstr &MI, in getBranchTargetOpValueMM() argument
206 unsigned MipsCodeEmitter::getBranchTargetOpValue(const MachineInstr &MI, in getBranchTargetOpValue() argument
208 MachineOperand MO = MI.getOperand(OpNo); in getBranchTargetOpValue()
209 emitMachineBasicBlock(MO.getMBB(), getRelocation(MI, MO)); in getBranchTargetOpValue()
213 unsigned MipsCodeEmitter::getMemEncoding(const MachineInstr &MI, in getMemEncoding() argument
216 assert(MI.getOperand(OpNo).isReg()); in getMemEncoding()
217 unsigned RegBits = getMachineOpValue(MI, MI.getOperand(OpNo)) << 16; in getMemEncoding()
218 return (getMachineOpValue(MI, MI.getOperand(OpNo+1)) & 0xFFFF) | RegBits; in getMemEncoding()
221 unsigned MipsCodeEmitter::getMemEncodingMMImm12(const MachineInstr &MI, in getMemEncodingMMImm12() argument
227 unsigned MipsCodeEmitter::getSizeExtEncoding(const MachineInstr &MI, in getSizeExtEncoding() argument
230 return getMachineOpValue(MI, MI.getOperand(OpNo)) - 1; in getSizeExtEncoding()
233 unsigned MipsCodeEmitter::getSizeInsEncoding(const MachineInstr &MI, in getSizeInsEncoding() argument
236 return getMachineOpValue(MI, MI.getOperand(OpNo-1)) + in getSizeInsEncoding()
237 getMachineOpValue(MI, MI.getOperand(OpNo)) - 1; in getSizeInsEncoding()
240 unsigned MipsCodeEmitter::getLSAImmEncoding(const MachineInstr &MI, in getLSAImmEncoding() argument
248 unsigned MipsCodeEmitter::getMachineOpValue(const MachineInstr &MI, in getMachineOpValue() argument
255 emitGlobalAddress(MO.getGlobal(), getRelocation(MI, MO), true); in getMachineOpValue()
257 emitExternalSymbolAddress(MO.getSymbolName(), getRelocation(MI, MO)); in getMachineOpValue()
259 emitConstPoolAddress(MO.getIndex(), getRelocation(MI, MO)); in getMachineOpValue()
261 emitJumpTableAddress(MO.getIndex(), getRelocation(MI, MO)); in getMachineOpValue()
263 emitMachineBasicBlock(MO.getMBB(), getRelocation(MI, MO)); in getMachineOpValue()
307 void MipsCodeEmitter::emitInstruction(MachineBasicBlock::instr_iterator MI, in emitInstruction() argument
309 DEBUG(errs() << "JIT: " << (void*)MCE.getCurrentPCValue() << ":\t" << *MI); in emitInstruction()
312 if (((MI->getDesc().TSFlags & MipsII::FormMask) == MipsII::Pseudo) && in emitInstruction()
313 !expandPseudos(MI, MBB)) in emitInstruction()
316 MCE.processDebugLoc(MI->getDebugLoc(), true); in emitInstruction()
318 emitWord(getBinaryCodeForInstr(*MI)); in emitInstruction()
321 MCE.processDebugLoc(MI->getDebugLoc(), false); in emitInstruction()
333 void MipsCodeEmitter::expandACCInstr(MachineBasicBlock::instr_iterator MI, in expandACCInstr() argument
337 BuildMI(MBB, &*MI, MI->getDebugLoc(), II->get(Opc)) in expandACCInstr()
338 .addReg(MI->getOperand(1).getReg()).addReg(MI->getOperand(2).getReg()); in expandACCInstr()
341 bool MipsCodeEmitter::expandPseudos(MachineBasicBlock::instr_iterator &MI, in expandPseudos() argument
343 switch (MI->getOpcode()) { in expandPseudos()
345 BuildMI(MBB, &*MI, MI->getDebugLoc(), II->get(Mips::SLL), Mips::ZERO) in expandPseudos()
349 BuildMI(MBB, &*MI, MI->getDebugLoc(), II->get(Mips::BEQ)).addReg(Mips::ZERO) in expandPseudos()
350 .addReg(Mips::ZERO).addOperand(MI->getOperand(0)); in expandPseudos()
353 BuildMI(MBB, &*MI, MI->getDebugLoc(), II->get(Mips::BREAK)).addImm(0) in expandPseudos()
357 BuildMI(MBB, &*MI, MI->getDebugLoc(), II->get(Mips::JALR), Mips::RA) in expandPseudos()
358 .addReg(MI->getOperand(0).getReg()); in expandPseudos()
361 expandACCInstr(MI, MBB, Mips::MULT); in expandPseudos()
364 expandACCInstr(MI, MBB, Mips::MULTu); in expandPseudos()
367 expandACCInstr(MI, MBB, Mips::SDIV); in expandPseudos()
370 expandACCInstr(MI, MBB, Mips::UDIV); in expandPseudos()
373 expandACCInstr(MI, MBB, Mips::MADD); in expandPseudos()
376 expandACCInstr(MI, MBB, Mips::MADDU); in expandPseudos()
379 expandACCInstr(MI, MBB, Mips::MSUB); in expandPseudos()
382 expandACCInstr(MI, MBB, Mips::MSUBU); in expandPseudos()
388 (MI--)->eraseFromBundle(); in expandPseudos()