Jlm
Loading...
Searching...
No Matches
constant.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2014 Helge Bahmann <hcb@chaoticmind.net>
3 * Copyright 2011 2012 2013 2014 Nico Reißmann <nico.reissmann@gmail.com>
4 * See COPYING for terms of redistribution.
5 */
6
8
9namespace jlm::rvsdg
10{
11
13
15 : NullaryOperation(BitType::Create(value.nbits())),
16 value_(std::move(value))
17{}
18
19bool
21{
22 const auto operation = dynamic_cast<const BitConstantOperation *>(&other);
23 return operation && operation->value_ == value_;
24}
25
26std::string
28{
29 if (value_.is_known() && value_.nbits() <= 64)
30 return jlm::util::strfmt("BITS", value_.nbits(), "(", value_.to_uint(), ")");
31
32 return value_.str();
33}
34
35std::unique_ptr<Operation>
37{
38 return std::make_unique<BitConstantOperation>(value_);
39}
40
41}
std::unique_ptr< Operation > copy() const override
Definition constant.cpp:36
std::string debug_string() const override
Definition constant.cpp:27
bool operator==(const Operation &other) const noexcept override
Definition constant.cpp:20
~BitConstantOperation() noexcept override
BitValueRepresentation value_
Definition constant.hpp:57
Nullary operator (operator taking no formal arguments)
Definition nullary.hpp:22
NodeType * TryGetOwnerNode(const rvsdg::Input &input) noexcept
Checks if this is an input to a node of specified type.
Definition node.hpp:872
static std::string strfmt(Args... args)
Definition strfmt.hpp:35