Changeset View
Changeset View
Standalone View
Standalone View
llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp
Show First 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | unsigned AArch64InstrInfo::getInstSizeInBytes(const MachineInstr &MI) const { | ||||
const MCAsmInfo *MAI = MF->getTarget().getMCAsmInfo(); | const MCAsmInfo *MAI = MF->getTarget().getMCAsmInfo(); | ||||
{ | { | ||||
auto Op = MI.getOpcode(); | auto Op = MI.getOpcode(); | ||||
if (Op == AArch64::INLINEASM || Op == AArch64::INLINEASM_BR) | if (Op == AArch64::INLINEASM || Op == AArch64::INLINEASM_BR) | ||||
return getInlineAsmLength(MI.getOperand(0).getSymbolName(), *MAI); | return getInlineAsmLength(MI.getOperand(0).getSymbolName(), *MAI); | ||||
} | } | ||||
// Meta-instructions emit no code. | |||||
if (MI.isMetaInstruction()) | |||||
return 0; | |||||
// FIXME: We currently only handle pseudoinstructions that don't get expanded | // FIXME: We currently only handle pseudoinstructions that don't get expanded | ||||
// before the assembly printer. | // before the assembly printer. | ||||
unsigned NumBytes = 0; | unsigned NumBytes = 0; | ||||
const MCInstrDesc &Desc = MI.getDesc(); | const MCInstrDesc &Desc = MI.getDesc(); | ||||
switch (Desc.getOpcode()) { | switch (Desc.getOpcode()) { | ||||
default: | default: | ||||
// Anything not explicitly designated otherwise is a normal 4-byte insn. | // Anything not explicitly designated otherwise is a normal 4-byte insn. | ||||
NumBytes = 4; | NumBytes = 4; | ||||
break; | break; | ||||
case TargetOpcode::DBG_VALUE: | |||||
case TargetOpcode::EH_LABEL: | |||||
case TargetOpcode::IMPLICIT_DEF: | |||||
case TargetOpcode::KILL: | |||||
NumBytes = 0; | |||||
break; | |||||
case TargetOpcode::STACKMAP: | case TargetOpcode::STACKMAP: | ||||
// The upper bound for a stackmap intrinsic is the full length of its shadow | // The upper bound for a stackmap intrinsic is the full length of its shadow | ||||
NumBytes = StackMapOpers(&MI).getNumPatchBytes(); | NumBytes = StackMapOpers(&MI).getNumPatchBytes(); | ||||
assert(NumBytes % 4 == 0 && "Invalid number of NOP bytes requested!"); | assert(NumBytes % 4 == 0 && "Invalid number of NOP bytes requested!"); | ||||
break; | break; | ||||
case TargetOpcode::PATCHPOINT: | case TargetOpcode::PATCHPOINT: | ||||
// The size of the patchpoint intrinsic is the number of bytes requested | // The size of the patchpoint intrinsic is the number of bytes requested | ||||
NumBytes = PatchPointOpers(&MI).getNumPatchBytes(); | NumBytes = PatchPointOpers(&MI).getNumPatchBytes(); | ||||
▲ Show 20 Lines • Show All 5,487 Lines • Show Last 20 Lines |