1 //===-- Coroutines.h - Coroutine Transformations ----------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 // Declare accessor functions for coroutine lowering passes. 9 //===----------------------------------------------------------------------===// 10 11 #ifndef LLVM_TRANSFORMS_COROUTINES_H 12 #define LLVM_TRANSFORMS_COROUTINES_H 13 14 namespace llvm { 15 16 class Pass; 17 class PassManagerBuilder; 18 19 /// Add all coroutine passes to appropriate extension points. 20 void addCoroutinePassesToExtensionPoints(PassManagerBuilder &Builder); 21 22 /// Lower coroutine intrinsics that are not needed by later passes. 23 Pass *createCoroEarlyLegacyPass(); 24 25 /// Split up coroutines into multiple functions driving their state machines. 26 Pass *createCoroSplitLegacyPass(bool IsOptimizing = false); 27 28 /// Analyze coroutines use sites, devirtualize resume/destroy calls and elide 29 /// heap allocation for coroutine frame where possible. 30 Pass *createCoroElideLegacyPass(); 31 32 /// Lower all remaining coroutine intrinsics. 33 Pass *createCoroCleanupLegacyPass(); 34 35 } 36 37 #endif 38