Bug 1874684 - Part 29: Update spec fixme notes. r=mgaudet
[gecko.git] / js / src / jit / AliasAnalysis.h
blob49ddaee47c8324a3ddd0f19735a5fadd9bfbe890
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * vim: set ts=8 sts=2 et sw=2 tw=80:
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef jit_AliasAnalysis_h
8 #define jit_AliasAnalysis_h
10 #include "jit/MIR.h"
11 #include "jit/MIRGraph.h"
13 namespace js {
14 namespace jit {
16 class LoopAliasInfo;
18 class AliasAnalysis {
19 MIRGenerator* mir;
20 MIRGraph& graph_;
21 LoopAliasInfo* loop_;
23 void spewDependencyList();
25 TempAllocator& alloc() const { return graph_.alloc(); }
27 public:
28 AliasAnalysis(MIRGenerator* mir, MIRGraph& graph)
29 : mir(mir), graph_(graph), loop_(nullptr) {}
31 [[nodiscard]] bool analyze();
34 // Iterates over the flags in an AliasSet.
35 class AliasSetIterator {
36 private:
37 uint32_t flags;
38 unsigned pos;
40 public:
41 explicit AliasSetIterator(AliasSet set) : flags(set.flags()), pos(0) {
42 while (flags && (flags & 1) == 0) {
43 flags >>= 1;
44 pos++;
47 AliasSetIterator& operator++(int) {
48 do {
49 flags >>= 1;
50 pos++;
51 } while (flags && (flags & 1) == 0);
52 return *this;
54 explicit operator bool() const { return !!flags; }
55 unsigned operator*() const {
56 MOZ_ASSERT(pos < AliasSet::NumCategories);
57 return pos;
61 } // namespace jit
62 } // namespace js
64 #endif /* jit_AliasAnalysis_h */