| OLD | NEW |
| 1 //===- subzero/src/IceInstVarIter.h - Iterate over inst vars ----*- C++ -*-===// | 1 //===- subzero/src/IceInstVarIter.h - Iterate over inst vars ----*- C++ -*-===// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 /// | 9 /// |
| 10 /// \file | 10 /// \file |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 /// | 138 /// |
| 139 /// 6) Step2 increments the inner loop's control variable, as well as the | 139 /// 6) Step2 increments the inner loop's control variable, as well as the |
| 140 /// current variable index. | 140 /// current variable index. |
| 141 /// | 141 /// |
| 142 /// We use Var -- which should be a valid C++ identifier -- to uniquify names | 142 /// We use Var -- which should be a valid C++ identifier -- to uniquify names |
| 143 /// -- e.g., i##Var instead of simply i because we want users to be able to use | 143 /// -- e.g., i##Var instead of simply i because we want users to be able to use |
| 144 /// the iterator for cross-products involving instructions' variables. | 144 /// the iterator for cross-products involving instructions' variables. |
| 145 #define FOREACH_VAR_IN_INST(Var, Instr) \ | 145 #define FOREACH_VAR_IN_INST(Var, Instr) \ |
| 146 for (SizeT Sz_I##Var##_ = 0, Sz_##Var##Index_ = 0, \ | 146 for (SizeT Sz_I##Var##_ = 0, Sz_##Var##Index_ = 0, \ |
| 147 Sz_SrcSize##Var##_ = (Instr).getSrcSize(), Sz_J##Var##_ = 0, \ | 147 Sz_SrcSize##Var##_ = (Instr).getSrcSize(), Sz_J##Var##_ = 0, \ |
| 148 Sz_NumVars##Var##_ = 0; \ | 148 Sz_NumVars##Var##_ = 0, Sz_Foreach_Break = 0; \ |
| 149 Sz_I##Var##_ < Sz_SrcSize##Var##_; ++Sz_I##Var##_) \ | 149 !Sz_Foreach_Break && Sz_I##Var##_ < Sz_SrcSize##Var##_; ++Sz_I##Var##_) \ |
| 150 if (Operand *Sz_Op##Var##_ = nullptr) \ | 150 if (Operand *Sz_Op##Var##_ = nullptr) \ |
| 151 /*nothing*/; \ | 151 /*nothing*/; \ |
| 152 else \ | 152 else \ |
| 153 for (Variable *Var = \ | 153 for (Variable *Var = \ |
| 154 (Sz_J##Var##_ = 0, \ | 154 (Sz_J##Var##_ = 0, \ |
| 155 Sz_Op##Var##_ = (Instr).getSrc(Sz_I##Var##_), \ | 155 Sz_Op##Var##_ = (Instr).getSrc(Sz_I##Var##_), \ |
| 156 Sz_NumVars##Var##_ = Sz_Op##Var##_->getNumVars(), nullptr); \ | 156 Sz_NumVars##Var##_ = Sz_Op##Var##_->getNumVars(), nullptr); \ |
| 157 Sz_J##Var##_ < Sz_NumVars##Var##_ && \ | 157 !Sz_Foreach_Break && Sz_J##Var##_ < Sz_NumVars##Var##_ && \ |
| 158 ((Var = Sz_Op##Var##_->getVar(Sz_J##Var##_)), true); \ | 158 ((Var = Sz_Op##Var##_->getVar(Sz_J##Var##_)), true); \ |
| 159 ++Sz_J##Var##_, ++Sz_##Var##Index_) | 159 ++Sz_J##Var##_, ++Sz_##Var##Index_) |
| 160 | 160 |
| 161 #define IsOnlyValidInFOREACH_VAR_IN_INST(V) \ | 161 #define IsOnlyValidInFOREACH_VAR_IN_INST(V) \ |
| 162 (static_cast<const SizeT>(Sz_##V##_)) | 162 (static_cast<const SizeT>(Sz_##V##_)) |
| 163 #define IndexOfVarInInst(Var) IsOnlyValidInFOREACH_VAR_IN_INST(Var##Index) | 163 #define IndexOfVarInInst(Var) IsOnlyValidInFOREACH_VAR_IN_INST(Var##Index) |
| 164 #define IndexOfVarOperandInInst(Var) IsOnlyValidInFOREACH_VAR_IN_INST(I##Var) | 164 #define IndexOfVarOperandInInst(Var) IsOnlyValidInFOREACH_VAR_IN_INST(I##Var) |
| 165 #define FOREACH_VAR_IN_INST_BREAK \ |
| 166 if (true) { \ |
| 167 Sz_Foreach_Break = 1; \ |
| 168 continue; \ |
| 169 } else { \ |
| 170 } |
| 165 #undef OnlyValidIn_FOREACH_VAR_IN_INSTS | 171 #undef OnlyValidIn_FOREACH_VAR_IN_INSTS |
| 166 | 172 |
| 167 #endif // SUBZERO_SRC_ICEINSTVARITER_H | 173 #endif // SUBZERO_SRC_ICEINSTVARITER_H |
| OLD | NEW |