@@ -125,7 +125,7 @@ struct LogicNetworkGate {
125125
126126 // / Operation pointer and kind packed together.
127127 // / The kind is stored in the low bits of the pointer.
128- llvm::PointerIntPair<mlir:: Operation *, 3 , Kind> opAndKind;
128+ llvm::PointerIntPair<Operation *, 3 , Kind> opAndKind;
129129
130130 // / Fanin edges (up to 3 inputs). For AND gates, only edges[0] and edges[1]
131131 // / are used. For MAJ gates, all three are used. For PrimaryInput/Constant,
@@ -140,12 +140,10 @@ struct LogicNetworkGate {
140140 Kind getKind () const { return opAndKind.getInt (); }
141141
142142 // / Get the operation pointer (nullptr for constants).
143- mlir:: Operation *getOperation () const { return opAndKind.getPointer (); }
143+ Operation *getOperation () const { return opAndKind.getPointer (); }
144144
145145 // / Set the kind and operation.
146- void set (mlir::Operation *op, Kind kind) {
147- opAndKind.setPointerAndInt (op, kind);
148- }
146+ void set (Operation *op, Kind kind) { opAndKind.setPointerAndInt (op, kind); }
149147
150148 // / Get the number of fanin edges based on kind.
151149 // / For Other (variadic) gates, uses op->getNumOperands().
@@ -206,7 +204,7 @@ class LogicNetwork {
206204 static constexpr uint32_t kConstant0 = 0 ;
207205 static constexpr uint32_t kConstant1 = 1 ;
208206
209- const auto & getGates () const { return gates; }
207+ ArrayRef<LogicNetworkGate> getGates () const { return gates; }
210208
211209 LogicNetwork () {
212210 // Reserve index 0 for constant 0 and index 1 for constant 1
@@ -215,8 +213,8 @@ class LogicNetwork {
215213 gates.emplace_back ();
216214 gates[kConstant1 ].set (nullptr , LogicNetworkGate::Constant);
217215 // indexToValue needs placeholders for constants
218- indexToValue.push_back (mlir:: Value ()); // const0
219- indexToValue.push_back (mlir:: Value ()); // const1
216+ indexToValue.push_back (Value ()); // const0
217+ indexToValue.push_back (Value ()); // const1
220218 }
221219
222220 // / Get a LogicEdge representing constant 0.
@@ -225,30 +223,30 @@ class LogicNetwork {
225223 // / Get a LogicEdge representing constant 1 (constant 0 inverted).
226224 static Signal getConstant1 () { return Signal (kConstant0 , true ); }
227225
228- // / Assign a unique index to a value if not already assigned .
229- // / Returns the raw index (without inversion) for the value .
230- uint32_t getOrCreateIndex (mlir:: Value value);
226+ // / Get or create an index for a value.
227+ // / If the value doesn't have an index yet, assigns one and returns the index .
228+ uint32_t getOrCreateIndex (Value value);
231229
232230 // / Get the raw index for a value. Asserts if value is not found.
233231 // / Note: This returns only the index, not a Signal with inversion info.
234232 // / Use hasIndex() to check existence first, or use getOrCreateIndex().
235- uint32_t getIndex (mlir:: Value value) const ;
233+ uint32_t getIndex (Value value) const ;
236234
237235 // / Check if a value has been indexed.
238- bool hasIndex (mlir:: Value value) const ;
236+ bool hasIndex (Value value) const ;
239237
240238 // / Get the value for a given raw index. Asserts if index is out of bounds.
241239 // / Returns null Value for constant indices (0 and 1).
242240 Value getValue (uint32_t index) const ;
243241
244- // / Get a Signal for a value (returns non-inverted signal) .
242+ // / Get a Signal for a value.
245243 // / Asserts if value not found - use hasIndex() first if unsure.
246- Signal getSignal (mlir:: Value value, bool inverted) const {
244+ Signal getSignal (Value value, bool inverted) const {
247245 return Signal (getIndex (value), inverted);
248246 }
249247
250- // / Get or create a Signal for a value (non-inverted) .
251- Signal getOrCreateSignal (mlir:: Value value, bool inverted) {
248+ // / Get or create a Signal for a value.
249+ Signal getOrCreateSignal (Value value, bool inverted) {
252250 return Signal (getOrCreateIndex (value), inverted);
253251 }
254252
@@ -265,33 +263,33 @@ class LogicNetwork {
265263 size_t size () const { return gates.size (); }
266264
267265 // / Add a primary input to the network.
268- uint32_t addPrimaryInput (mlir:: Value value);
266+ uint32_t addPrimaryInput (Value value);
269267
270268 // / Add an AND gate to the network.
271- uint32_t addAndGate (mlir:: Operation *op, Signal lhs, Signal rhs);
269+ uint32_t addAndGate (Operation *op, Signal lhs, Signal rhs);
272270
273271 // / Add a XOR gate to the network.
274- uint32_t addXorGate (mlir:: Operation *op, Signal lhs, Signal rhs);
272+ uint32_t addXorGate (Operation *op, Signal lhs, Signal rhs);
275273
276274 // / Add a MAJ gate to the network.
277- uint32_t addMajGate (mlir:: Operation *op, Signal a, Signal b, Signal c);
275+ uint32_t addMajGate (Operation *op, Signal a, Signal b, Signal c);
278276
279277 // / Add a gate that is treated as "other" (not simulatable, acts as PI).
280- uint32_t addOtherGate (mlir:: Operation *op, mlir:: Value result);
278+ uint32_t addOtherGate (Operation *op, Value result);
281279
282280 // / Build the logic network from a region/block in topological order.
283281 // / Returns failure if the IR is not in a valid form.
284- LogicalResult buildFromBlock (mlir:: Block *block);
282+ LogicalResult buildFromBlock (Block *block);
285283
286284 // / Clear the network and reset to initial state.
287285 void clear ();
288286
289287private:
290288 // / Map from MLIR Value to network index.
291- llvm::DenseMap<mlir:: Value, uint32_t > valueToIndex;
289+ llvm::DenseMap<Value, uint32_t > valueToIndex;
292290
293291 // / Map from network index to MLIR Value.
294- llvm::SmallVector<mlir:: Value> indexToValue;
292+ llvm::SmallVector<Value> indexToValue;
295293
296294 // / Vector of all gates in the network.
297295 llvm::SmallVector<LogicNetworkGate> gates;
0 commit comments