llvm-project
e04b1a58 - [CIR][LoweringPrepare] Emit guard variables for static local initialization

Commit
8 days ago
[CIR][LoweringPrepare] Emit guard variables for static local initialization This implements the lowering of static local variables with the Itanium C++ ABI guard variable pattern in LoweringPrepare. When a GlobalOp has the static_local attribute and a ctor region, this pass: 1. Creates a guard variable global (mangled name from AST) 2. Inserts the guard check pattern at each GetGlobalOp use site: - Load guard byte with acquire ordering - If zero, call __cxa_guard_acquire - If acquire returns non-zero, inline the ctor region code - Call __cxa_guard_release 3. Clears the static_local attribute and ctor region from the GlobalOp
Author
Parents
Loading