================
@@ -868,6 +868,41 @@ RegisterContextUnwind::GetFullUnwindPlanForFrame() {
     return arch_default_unwind_plan_sp;
   }
 
+  // Function outlining is a clang feature where common blocks of instructions
+  // from separate functions can be put in a separate utility function, and
+  // the original functions call into the utility function to execute them,
+  // resulting in fewer bytes used for the code section overall.
+  //
+  // The call to the OUTLINED_FUNCTION may not be a normal ABI call (e.g.
+  // on RISCV it might be called `jal t0, OUTLINED_FUNCTION_<nn>` putting the
+  // return address in a temporary register instead of $ra).  Tthe unwind
+  // instructions in eh_frame/debug_frame are not correct today for an
+  // OUTLINED_FUNCTION, even when a normal ABI call is made.
+  // Clang does not insert CFI directives in the OUTLINED_FUNCTION so it
----------------
jasonmolenda wrote:

The OUTLINED_FUNCTIONs can make function calls - they can set up a stack frame 
in some cases.  I don't believe this is solvable in clang today because the 
outlining is done at the machine instruction layer, my naive understanding is 
that there is a pass looking at the instructions for multiple functions and 
finding blocks of identical insns with certain constraints (like not using 
pc-relative data or something I'd guess), moving those into an outlined 
function.  But it doesn't know that those instructions are doing 
prologue/epilogue things.  It could track that e.g. a non-standard return 
address register is being used (it had to insert the `ret t0` at the end of the 
instruction block, as well as the `jal t0, OUTLINED_FUNCTION_n` call to it) but 
there are definitely cases where prologue/epilogue instructions are outlined 
that are very difficult to handle correctly at this layer.

https://github.com/llvm/llvm-project/pull/204500
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to