[clang] [clang][AArch64] Pass down stack clash protection options to LLVM/Backend (PR #68993)
Sam Tebbs via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 20 02:55:00 PDT 2023
================
@@ -85,17 +90,32 @@ static bool isPrologueCFIInstruction(const MachineInstr &MI) {
MI.getFlag(MachineInstr::FrameSetup);
}
-static bool containsPrologue(const MachineBasicBlock &MBB) {
- return llvm::any_of(MBB.instrs(), isPrologueCFIInstruction);
-}
-
static bool containsEpilogue(const MachineBasicBlock &MBB) {
return llvm::any_of(llvm::reverse(MBB), [](const auto &MI) {
return MI.getOpcode() == TargetOpcode::CFI_INSTRUCTION &&
MI.getFlag(MachineInstr::FrameDestroy);
});
}
+static MachineBasicBlock *
+findPrologueEnd(MachineFunction &MF, MachineBasicBlock::iterator &PrologueEnd) {
+ MachineBasicBlock *PrologueBlock = nullptr;
+ for (auto It = po_begin(&MF.front()), End = po_end(&MF.front()); It != End;
+ ++It) {
+ MachineBasicBlock *MBB = *It;
+ llvm::for_each(MBB->instrs(), [&](MachineInstr &MI) {
----------------
SamTebbs33 wrote:
Does it make sense here to go through the reversed list of the instructions and stop after you find the first prologue CFI instruction?
https://github.com/llvm/llvm-project/pull/68993
More information about the cfe-commits
mailing list