1
LLVM 백엔드에서 실제 (비 의사 명령어) 명령어의 완화로서 의사 명령어를 방출하고 싶습니다. 문제는 내 TargetPassConfig
에 내 의사 명령어 확장기 패스를 추가하는 방법을 찾지 못해서 내 AsmBackend::relaxInstruction
의 출력에 적용될 수 있다는 것입니다.휴식 중 의사 명령어 방출
휴식을위한 동력이 될 것으로 보인다 MCAssembler::relaxInstruction
에서 보면, 그것은 명령 인코더에 직접 휴식의 결과를 전달합니다
bool MCAssembler::relaxInstruction(MCAsmLayout &Layout,
MCRelaxableFragment &F) {
if (!fragmentNeedsRelaxation(&F, Layout))
return false;
++stats::RelaxedInstructions;
// FIXME-PERF: We could immediately lower out instructions if we can tell
// they are fully resolved, to avoid retesting on later passes.
// Relax the fragment.
MCInst Relaxed;
getBackend().relaxInstruction(F.getInst(), F.getSubtargetInfo(), Relaxed);
// Encode the new instruction.
//
// FIXME-PERF: If it matters, we could let the target do this. It can
// probably do so more efficiently in many cases.
SmallVector<MCFixup, 4> Fixups;
SmallString<256> Code;
raw_svector_ostream VecOS(Code);
getEmitter().encodeInstruction(Relaxed, VecOS, Fixups, F.getSubtargetInfo());
// Update the fragment.
F.setInst(Relaxed);
F.getContents() = Code;
F.getFixups() = Fixups;
return true;
}
이 난에 "내 자신의"이야 것을 의미한다 백엔드의 relaxInstruction
이 의사 명령어를 방출하지 않도록 보장합니다. 그렇다면 내 의사 명령어 확장기를 내 relaxInstruction
에 어떻게 연결합니까?
휴식 중에 실제 지침을 방출한다는 분명한 제안을 선점하기 위해 : 'relaxInstruction'은 하나의 편안한 명령을 반환하고 의사 명령은 두 개의 실제 지침을 따르지 않으므로 이완 중에 직접 확장을 방출 할 수 없습니다. – Cactus