1 /* -*- mesa-c++ -*- 2 * Copyright 2018-2019 Collabora LTD 3 * Author: Gert Wollny <[email protected]> 4 * SPDX-License-Identifier: MIT 5 */ 6 7 #ifndef SFN_CONDITIONALJUMPTRACKER_H 8 #define SFN_CONDITIONALJUMPTRACKER_H 9 10 #include "gallium/drivers/r600/r600_asm.h" 11 12 namespace r600 { 13 14 enum JumpType { 15 jt_loop, 16 jt_if 17 }; 18 19 /** 20 Class to link the jump locations 21 */ 22 class ConditionalJumpTracker { 23 public: 24 ConditionalJumpTracker(); 25 ~ConditionalJumpTracker(); 26 27 /* Mark the start of a loop or a if/else */ 28 void push(r600_bytecode_cf *start, JumpType type); 29 30 /* Mark the end of a loop or a if/else and fixup the jump sites */ 31 bool pop(r600_bytecode_cf *final, JumpType type); 32 33 /* Add middle sites to the call frame i.e. continue, 34 * break inside loops, and else in if-then-else constructs. 35 */ 36 bool add_mid(r600_bytecode_cf *source, JumpType type); 37 38 private: 39 struct ConditionalJumpTrackerImpl *impl; 40 }; 41 42 } // namespace r600 43 44 #endif // SFN_CONDITIONALJUMPTRACKER_H 45