Lines Matching refs:Inst

123 void MCPlusBuilder::setTailCall(MCInst &Inst) {  in setTailCall()  argument
124 assert(!hasAnnotation(Inst, MCAnnotation::kTailCall)); in setTailCall()
125 setAnnotationOpValue(Inst, MCAnnotation::kTailCall, true); in setTailCall()
128 bool MCPlusBuilder::isTailCall(const MCInst &Inst) const { in isTailCall()
129 if (hasAnnotation(Inst, MCAnnotation::kTailCall)) in isTailCall()
131 if (getConditionalTailCall(Inst)) in isTailCall()
136 Optional<MCLandingPad> MCPlusBuilder::getEHInfo(const MCInst &Inst) const { in getEHInfo()
137 if (!isCall(Inst)) in getEHInfo()
140 getAnnotationOpValue(Inst, MCAnnotation::kEHLandingPad); in getEHInfo()
144 getAnnotationOpValue(Inst, MCAnnotation::kEHAction); in getEHInfo()
152 void MCPlusBuilder::addEHInfo(MCInst &Inst, const MCLandingPad &LP) { in addEHInfo() argument
153 if (isCall(Inst)) { in addEHInfo()
154 assert(!getEHInfo(Inst)); in addEHInfo()
155 setAnnotationOpValue(Inst, MCAnnotation::kEHLandingPad, in addEHInfo()
157 setAnnotationOpValue(Inst, MCAnnotation::kEHAction, in addEHInfo()
162 bool MCPlusBuilder::updateEHInfo(MCInst &Inst, const MCLandingPad &LP) { in updateEHInfo() argument
163 if (!isInvoke(Inst)) in updateEHInfo()
166 setAnnotationOpValue(Inst, MCAnnotation::kEHLandingPad, in updateEHInfo()
168 setAnnotationOpValue(Inst, MCAnnotation::kEHAction, in updateEHInfo()
173 int64_t MCPlusBuilder::getGnuArgsSize(const MCInst &Inst) const { in getGnuArgsSize()
175 getAnnotationOpValue(Inst, MCAnnotation::kGnuArgsSize); in getGnuArgsSize()
181 void MCPlusBuilder::addGnuArgsSize(MCInst &Inst, int64_t GnuArgsSize, in addGnuArgsSize() argument
184 assert(getGnuArgsSize(Inst) == -1LL && "GNU_args_size already set"); in addGnuArgsSize()
185 assert(isInvoke(Inst) && "GNU_args_size can only be set for invoke"); in addGnuArgsSize()
187 setAnnotationOpValue(Inst, MCAnnotation::kGnuArgsSize, GnuArgsSize, AllocId); in addGnuArgsSize()
190 uint64_t MCPlusBuilder::getJumpTable(const MCInst &Inst) const { in getJumpTable()
192 getAnnotationOpValue(Inst, MCAnnotation::kJumpTable); in getJumpTable()
198 uint16_t MCPlusBuilder::getJumpTableIndexReg(const MCInst &Inst) const { in getJumpTableIndexReg()
199 return getAnnotationAs<uint16_t>(Inst, "JTIndexReg"); in getJumpTableIndexReg()
202 bool MCPlusBuilder::setJumpTable(MCInst &Inst, uint64_t Value, in setJumpTable() argument
204 if (!isIndirectBranch(Inst)) in setJumpTable()
206 setAnnotationOpValue(Inst, MCAnnotation::kJumpTable, Value, AllocId); in setJumpTable()
207 getOrCreateAnnotationAs<uint16_t>(Inst, "JTIndexReg", AllocId) = IndexReg; in setJumpTable()
211 bool MCPlusBuilder::unsetJumpTable(MCInst &Inst) { in unsetJumpTable() argument
212 if (!getJumpTable(Inst)) in unsetJumpTable()
214 removeAnnotation(Inst, MCAnnotation::kJumpTable); in unsetJumpTable()
215 removeAnnotation(Inst, "JTIndexReg"); in unsetJumpTable()
220 MCPlusBuilder::getConditionalTailCall(const MCInst &Inst) const { in getConditionalTailCall()
222 getAnnotationOpValue(Inst, MCAnnotation::kConditionalTailCall); in getConditionalTailCall()
228 bool MCPlusBuilder::setConditionalTailCall(MCInst &Inst, uint64_t Dest) { in setConditionalTailCall() argument
229 if (!isConditionalBranch(Inst)) in setConditionalTailCall()
232 setAnnotationOpValue(Inst, MCAnnotation::kConditionalTailCall, Dest); in setConditionalTailCall()
236 bool MCPlusBuilder::unsetConditionalTailCall(MCInst &Inst) { in unsetConditionalTailCall() argument
237 if (!getConditionalTailCall(Inst)) in unsetConditionalTailCall()
239 removeAnnotation(Inst, MCAnnotation::kConditionalTailCall); in unsetConditionalTailCall()
243 Optional<uint32_t> MCPlusBuilder::getOffset(const MCInst &Inst) const { in getOffset()
244 Optional<int64_t> Value = getAnnotationOpValue(Inst, MCAnnotation::kOffset); in getOffset()
250 uint32_t MCPlusBuilder::getOffsetWithDefault(const MCInst &Inst, in getOffsetWithDefault() argument
252 if (Optional<uint32_t> Offset = getOffset(Inst)) in getOffsetWithDefault()
257 bool MCPlusBuilder::setOffset(MCInst &Inst, uint32_t Offset, in setOffset() argument
259 setAnnotationOpValue(Inst, MCAnnotation::kOffset, Offset, AllocatorId); in setOffset()
263 bool MCPlusBuilder::clearOffset(MCInst &Inst) { in clearOffset() argument
264 if (!hasAnnotation(Inst, MCAnnotation::kOffset)) in clearOffset()
266 removeAnnotation(Inst, MCAnnotation::kOffset); in clearOffset()
270 bool MCPlusBuilder::hasAnnotation(const MCInst &Inst, unsigned Index) const { in hasAnnotation() argument
271 const MCInst *AnnotationInst = getAnnotationInst(Inst); in hasAnnotation()
275 return (bool)getAnnotationOpValue(Inst, Index); in hasAnnotation()
278 bool MCPlusBuilder::removeAnnotation(MCInst &Inst, unsigned Index) { in removeAnnotation() argument
279 MCInst *AnnotationInst = getAnnotationInst(Inst); in removeAnnotation()
293 void MCPlusBuilder::stripAnnotations(MCInst &Inst, bool KeepTC) { in stripAnnotations() argument
294 MCInst *AnnotationInst = getAnnotationInst(Inst); in stripAnnotations()
298 auto IsTC = hasAnnotation(Inst, MCAnnotation::kTailCall); in stripAnnotations()
300 Inst.erase(std::prev(Inst.end())); in stripAnnotations()
302 setTailCall(Inst); in stripAnnotations()
305 void MCPlusBuilder::printAnnotations(const MCInst &Inst, in printAnnotations() argument
307 const MCInst *AnnotationInst = getAnnotationInst(Inst); in printAnnotations()
323 bool MCPlusBuilder::evaluateBranch(const MCInst &Inst, uint64_t Addr, in evaluateBranch() argument
325 return Analysis->evaluateBranch(Inst, Addr, Size, Target); in evaluateBranch()
328 void MCPlusBuilder::getClobberedRegs(const MCInst &Inst, in getClobberedRegs() argument
330 if (isPrefix(Inst) || isCFI(Inst)) in getClobberedRegs()
333 const MCInstrDesc &InstInfo = Info->get(Inst.getOpcode()); in getClobberedRegs()
340 const MCOperand &Operand = Inst.getOperand(I); in getClobberedRegs()
346 void MCPlusBuilder::getTouchedRegs(const MCInst &Inst, BitVector &Regs) const { in getTouchedRegs() argument
347 if (isPrefix(Inst) || isCFI(Inst)) in getTouchedRegs()
350 const MCInstrDesc &InstInfo = Info->get(Inst.getOpcode()); in getTouchedRegs()
359 for (unsigned I = 0, E = Inst.getNumOperands(); I != E; ++I) { in getTouchedRegs()
360 if (!Inst.getOperand(I).isReg()) in getTouchedRegs()
362 Regs |= getAliases(Inst.getOperand(I).getReg(), /*OnlySmaller=*/false); in getTouchedRegs()
366 void MCPlusBuilder::getWrittenRegs(const MCInst &Inst, BitVector &Regs) const { in getWrittenRegs() argument
367 if (isPrefix(Inst) || isCFI(Inst)) in getWrittenRegs()
370 const MCInstrDesc &InstInfo = Info->get(Inst.getOpcode()); in getWrittenRegs()
377 const MCOperand &Operand = Inst.getOperand(I); in getWrittenRegs()
383 void MCPlusBuilder::getUsedRegs(const MCInst &Inst, BitVector &Regs) const { in getUsedRegs() argument
384 if (isPrefix(Inst) || isCFI(Inst)) in getUsedRegs()
387 const MCInstrDesc &InstInfo = Info->get(Inst.getOpcode()); in getUsedRegs()
393 for (unsigned I = 0, E = Inst.getNumOperands(); I != E; ++I) { in getUsedRegs()
394 if (!Inst.getOperand(I).isReg()) in getUsedRegs()
396 Regs |= getAliases(Inst.getOperand(I).getReg(), /*OnlySmaller=*/true); in getUsedRegs()
400 void MCPlusBuilder::getSrcRegs(const MCInst &Inst, BitVector &Regs) const { in getSrcRegs() argument
401 if (isPrefix(Inst) || isCFI(Inst)) in getSrcRegs()
404 if (isCall(Inst)) { in getSrcRegs()
412 if (isReturn(Inst)) { in getSrcRegs()
417 if (isRep(Inst)) in getSrcRegs()
420 const MCInstrDesc &InstInfo = Info->get(Inst.getOpcode()); in getSrcRegs()
428 if (!Inst.getOperand(I).isReg()) in getSrcRegs()
430 Regs |= getAliases(Inst.getOperand(I).getReg(), /*OnlySmaller=*/true); in getSrcRegs()
522 bool MCPlusBuilder::setOperandToSymbolRef(MCInst &Inst, int OpNum, in setOperandToSymbolRef() argument
529 Inst, MCSymbolRefExpr::create(Symbol, *Ctx), *Ctx, RelType)); in setOperandToSymbolRef()
532 Inst, in setOperandToSymbolRef()
537 Inst.getOperand(OpNum) = Operand; in setOperandToSymbolRef()