Jlm
Loading...
Searching...
No Matches
substitution.hpp
Go to the documentation of this file.
1/*
2 * Copyright 2010 2011 2012 Helge Bahmann <hcb@chaoticmind.net>
3 * Copyright 2014 2015 Nico Reißmann <nico.reissmann@gmail.com>
4 * See COPYING for terms of redistribution.
5 */
6
7#ifndef JLM_RVSDG_SUBSTITUTION_HPP
8#define JLM_RVSDG_SUBSTITUTION_HPP
9
10#include <jlm/util/common.hpp>
11
12#include <unordered_map>
13
14namespace jlm::rvsdg
15{
16
17class Output;
18
20{
21public:
22 bool
23 contains(const Output & original) const noexcept
24 {
25 return outputMap_.find(&original) != outputMap_.end();
26 }
27
28 Output &
29 lookup(const Output & original) const
30 {
31 if (!contains(original))
32 throw util::Error("Output not in substitution map.");
33
34 return *outputMap_.find(&original)->second;
35 }
36
37 void
42
43private:
44 std::unordered_map<const Output *, Output *> outputMap_{};
45};
46
47}
48
49#endif
void insert(const Output *original, Output *substitute)
Output & lookup(const Output &original) const
bool contains(const Output &original) const noexcept
std::unordered_map< const Output *, Output * > outputMap_
NodeType * TryGetOwnerNode(const rvsdg::Input &input) noexcept
Checks if this is an input to a node of specified type.
Definition node.hpp:872