11 #include <llvm/ADT/SmallVector.h>
12 #include <llvm/IR/InstrTypes.h>
24 return op && op->
IncomingNodes_ == IncomingNodes_ && op->result(0) == result(0);
42 std::unique_ptr<rvsdg::Operation>
45 return std::make_unique<SsaPhiOperation>(*
this);
54 return op && op->
argument(0) == argument(0);
63 std::unique_ptr<rvsdg::Operation>
66 return std::make_unique<AssignmentOperation>(*
this);
75 return op && op->
result(0) == result(0);
84 std::unique_ptr<rvsdg::Operation>
87 return std::make_unique<SelectOperation>(*
this);
96 return op && op->
type() == type();
102 return "VectorSelect";
105 std::unique_ptr<rvsdg::Operation>
108 return std::make_unique<VectorSelectOperation>(*
this);
118 return op && op->
argument(0) == argument(0) && op->result(0) == result(0);
127 std::unique_ptr<rvsdg::Operation>
130 return std::make_unique<FloatingPointToUnsignedIntegerOperation>(*
this);
153 return op && op->
argument(0) == argument(0) && op->result(0) == result(0);
162 std::unique_ptr<rvsdg::Operation>
165 return std::make_unique<FloatingPointToSignedIntegerOperation>(*
this);
187 return op && op->
argument(0) == argument(0) && op->result(0) == result(0);
193 return "ControlToInt";
196 std::unique_ptr<rvsdg::Operation>
199 return std::make_unique<ControlToIntOperation>(*
this);
208 return op && op->
argument(0) == argument(0);
217 std::unique_ptr<rvsdg::Operation>
220 return std::make_unique<BranchOperation>(*
this);
235 return "ConstantPointerNull";
238 std::unique_ptr<rvsdg::Operation>
241 return std::make_unique<ConstantPointerNullOperation>(*
this);
250 return op && op->
argument(0) == argument(0) && op->result(0) == result(0);
259 std::unique_ptr<rvsdg::Operation>
262 return std::make_unique<IntegerToPointerOperation>(*
this);
283 return op && op->
argument(0) == argument(0) && op->result(0) == result(0);
292 std::unique_ptr<rvsdg::Operation>
295 return std::make_unique<PtrToIntOperation>(*
this);
316 return op && op->
result(0) == result(0);
322 return "ConstantDataArray";
325 std::unique_ptr<rvsdg::Operation>
328 return std::make_unique<ConstantDataArray>(*
this);
353 return map.LookupKey(predicate);
356 [[nodiscard]] ::llvm::CmpInst::Predicate
360 return map.LookupValue(predicate);
363 [[nodiscard]] std::string_view
389 throw std::runtime_error(
"Unknown ICmpPredicate");
399 return op && op->
argument(0) == argument(0) && op->predicate_ == predicate_;
408 std::unique_ptr<rvsdg::Operation>
411 return std::make_unique<PtrCmpOperation>(*
this);
436 return op && op->
argument(0) == argument(0) && op->result(0) == result(0);
445 std::unique_ptr<rvsdg::Operation>
448 return std::make_unique<ZExtOperation>(*
this);
455 if (rvsdg::IsOwnerNodeOperation<rvsdg::BitConstantOperation>(tracedOperand))
467 auto [_, constantOperation] =
468 rvsdg::TryGetSimpleNodeAndOptionalOp<rvsdg::BitConstantOperation>(tracedOperand);
471 *rvsdg::TryGetOwnerNode<rvsdg::Node>(*operand)->region(),
481 ConstantFP::operator==(const Operation & other) const noexcept
483 auto op =
dynamic_cast<const ConstantFP *
>(&other);
484 return op && size() == op->
size() && constant().bitwiseIsEqual(op->constant());
490 ::llvm::SmallVector<char, 32> v;
493 std::string s(
"FP(");
494 for (
const auto & c : v)
501 std::unique_ptr<rvsdg::Operation>
504 return std::make_unique<ConstantFP>(*
this);
513 return op && op->
argument(0) == argument(0) && op->cmp_ == cmp_;
519 static std::unordered_map<fpcmp, std::string> map({ {
fpcmp::oeq,
"oeq" },
535 return "FCmp " + map[
cmp()];
538 std::unique_ptr<rvsdg::Operation>
541 return std::make_unique<FCmpOperation>(*
this);
563 return op && op->
GetType() == GetType();
572 std::unique_ptr<rvsdg::Operation>
575 return std::make_unique<UndefValueOperation>(*
this);
584 return operation && operation->
GetType() == GetType();
593 std::unique_ptr<rvsdg::Operation>
596 return std::make_unique<PoisonValueOperation>(*
this);
605 return operation && operation->
getType() == getType();
619 throw std::runtime_error(
"FreezeOperation does not support reductions");
628 std::unique_ptr<rvsdg::Operation>
631 return std::make_unique<FreezeOperation>(*
this);
640 return op && op->
fpop() ==
fpop() && op->size() == size();
646 static std::unordered_map<llvm::fpop, std::string> map({ {
fpop::add,
"add" },
653 return "FPOP " + map[
fpop()];
656 std::unique_ptr<rvsdg::Operation>
659 return std::make_unique<FBinaryOperation>(*
this);
684 return op && op->
srcsize() == srcsize() && op->dstsize() == dstsize();
693 std::unique_ptr<rvsdg::Operation>
696 return std::make_unique<FPExtOperation>(*
this);
717 return op && op->
size() == size();
726 std::unique_ptr<rvsdg::Operation>
729 return std::make_unique<FNegOperation>(*
this);
750 return op && op->
srcsize() == srcsize() && op->dstsize() == dstsize();
759 std::unique_ptr<rvsdg::Operation>
762 return std::make_unique<FPTruncOperation>(*
this);
783 if (!op || op->narguments() != narguments())
786 for (
size_t n = 0; n < narguments(); n++)
788 if (op->argument(n) != argument(n))
798 return "VariadicArguments";
801 std::unique_ptr<rvsdg::Operation>
804 return std::make_unique<VariadicArgumentListOperation>(*
this);
813 return op && op->
argument(0) == argument(0) && op->result(0) == result(0);
827 std::unique_ptr<rvsdg::Operation>
830 return std::make_unique<BitCastOperation>(*
this);
854 return op && op->
result(0) == result(0);
860 return "ConstantStruct";
863 std::unique_ptr<rvsdg::Operation>
866 return std::make_unique<ConstantStruct>(*
this);
875 return op && op->
argument(0) == argument(0) && op->result(0) == result(0);
884 std::unique_ptr<rvsdg::Operation>
887 return std::make_unique<TruncOperation>(*
this);
908 return op && op->
argument(0) == argument(0) && op->result(0) == result(0);
917 std::unique_ptr<rvsdg::Operation>
920 return std::make_unique<UIToFPOperation>(*
this);
941 return op && op->
argument(0) == argument(0) && op->result(0) == result(0);
950 std::unique_ptr<rvsdg::Operation>
953 return std::make_unique<SIToFPOperation>(*
this);
974 return op && op->
result(0) == result(0);
980 return "ConstantArray";
983 std::unique_ptr<rvsdg::Operation>
986 return std::make_unique<ConstantArrayOperation>(*
this);
995 return op && op->
result(0) == result(0);
1001 return "ConstantAggregateZero";
1004 std::unique_ptr<rvsdg::Operation>
1007 return std::make_unique<ConstantAggregateZeroOperation>(*
this);
1016 return op && op->
argument(0) == argument(0) && op->argument(1) == argument(1);
1022 return "ExtractElement";
1025 std::unique_ptr<rvsdg::Operation>
1028 return std::make_unique<ExtractElementOperation>(*
this);
1037 return op && op->
argument(0) == argument(0) && op->Mask() == Mask();
1043 return "ShuffleVector";
1046 std::unique_ptr<rvsdg::Operation>
1049 return std::make_unique<ShuffleVectorOperation>(*
this);
1058 return op && op->
result(0) == result(0);
1064 return "ConstantVector";
1067 std::unique_ptr<rvsdg::Operation>
1070 return std::make_unique<ConstantVectorOperation>(*
this);
1079 return op && op->
argument(0) == argument(0) && op->argument(1) == argument(1)
1080 && op->argument(2) == argument(2);
1086 return "InsertElement";
1089 std::unique_ptr<rvsdg::Operation>
1092 return std::make_unique<InsertElementOperation>(*
this);
1101 return op && op->
operation() == operation();
1110 std::unique_ptr<rvsdg::Operation>
1113 return std::make_unique<VectorUnaryOperation>(*
this);
1122 return op && op->
operation() == operation();
1131 std::unique_ptr<rvsdg::Operation>
1134 return std::make_unique<VectorBinaryOperation>(*
this);
1143 return op && op->
result(0) == result(0);
1149 return "ConstantDataVector";
1152 std::unique_ptr<rvsdg::Operation>
1155 return std::make_unique<ConstantDataVectorOperation>(*
this);
1164 return this == &other;
1173 std::unique_ptr<rvsdg::Operation>
1176 return std::make_unique<MallocOperation>(*
this);
1187 return this == &other;
1196 std::unique_ptr<rvsdg::Operation>
1199 return std::make_unique<FreeOperation>(*
this);
std::unique_ptr< Operation > copy() const override
~AssignmentOperation() noexcept override
std::string debug_string() const override
std::string debug_string() const override
std::unique_ptr< Operation > copy() const override
jlm::rvsdg::Output * reduce_operand(jlm::rvsdg::unop_reduction_path_t path, jlm::rvsdg::Output *output) const override
jlm::rvsdg::unop_reduction_path_t can_reduce_operand(const jlm::rvsdg::Output *output) const noexcept override
~BitCastOperation() noexcept override
std::string debug_string() const override
~BranchOperation() noexcept override
std::unique_ptr< Operation > copy() const override
std::unique_ptr< Operation > copy() const override
~ConstantAggregateZeroOperation() noexcept override
std::string debug_string() const override
~ConstantArrayOperation() noexcept override
std::unique_ptr< Operation > copy() const override
std::string debug_string() const override
~ConstantDataArray() noexcept override
std::unique_ptr< Operation > copy() const override
std::string debug_string() const override
~ConstantDataVectorOperation() noexcept override
std::unique_ptr< Operation > copy() const override
std::string debug_string() const override
~ConstantFP() noexcept override
const fpsize & size() const noexcept
std::unique_ptr< Operation > copy() const override
const ::llvm::APFloat & constant() const noexcept
std::string debug_string() const override
ConstantPointerNullOperation class.
std::string debug_string() const override
const PointerType & GetPointerType() const noexcept
~ConstantPointerNullOperation() noexcept override
std::unique_ptr< Operation > copy() const override
bool operator==(const Operation &other) const noexcept override
std::string debug_string() const override
~ConstantStruct() override
std::unique_ptr< Operation > copy() const override
std::unique_ptr< Operation > copy() const override
~ConstantVectorOperation() noexcept override
std::string debug_string() const override
std::string debug_string() const override
~ControlToIntOperation() noexcept override
std::unique_ptr< Operation > copy() const override
const llvm::fpop & fpop() const noexcept
std::string debug_string() const override
jlm::rvsdg::binop_reduction_path_t can_reduce_operand_pair(const jlm::rvsdg::Output *op1, const jlm::rvsdg::Output *op2) const noexcept override
std::unique_ptr< Operation > copy() const override
jlm::rvsdg::Output * reduce_operand_pair(jlm::rvsdg::binop_reduction_path_t path, jlm::rvsdg::Output *op1, jlm::rvsdg::Output *op2) const override
~FBinaryOperation() noexcept override
jlm::rvsdg::binop_reduction_path_t can_reduce_operand_pair(const jlm::rvsdg::Output *op1, const jlm::rvsdg::Output *op2) const noexcept override
const fpcmp & cmp() const noexcept
~FCmpOperation() noexcept override
std::string debug_string() const override
jlm::rvsdg::Output * reduce_operand_pair(jlm::rvsdg::binop_reduction_path_t path, jlm::rvsdg::Output *op1, jlm::rvsdg::Output *op2) const override
std::unique_ptr< Operation > copy() const override
const fpsize & size() const noexcept
jlm::rvsdg::Output * reduce_operand(jlm::rvsdg::unop_reduction_path_t path, jlm::rvsdg::Output *output) const override
jlm::rvsdg::unop_reduction_path_t can_reduce_operand(const jlm::rvsdg::Output *output) const noexcept override
std::unique_ptr< Operation > copy() const override
~FNegOperation() noexcept override
std::string debug_string() const override
~FPExtOperation() noexcept override
std::string debug_string() const override
jlm::rvsdg::Output * reduce_operand(jlm::rvsdg::unop_reduction_path_t path, jlm::rvsdg::Output *output) const override
jlm::rvsdg::unop_reduction_path_t can_reduce_operand(const jlm::rvsdg::Output *output) const noexcept override
std::unique_ptr< Operation > copy() const override
const fpsize & srcsize() const noexcept
const fpsize & srcsize() const noexcept
jlm::rvsdg::unop_reduction_path_t can_reduce_operand(const jlm::rvsdg::Output *output) const noexcept override
std::unique_ptr< Operation > copy() const override
std::string debug_string() const override
~FPTruncOperation() noexcept override
jlm::rvsdg::Output * reduce_operand(jlm::rvsdg::unop_reduction_path_t path, jlm::rvsdg::Output *output) const override
jlm::rvsdg::Output * reduce_operand(jlm::rvsdg::unop_reduction_path_t path, jlm::rvsdg::Output *output) const override
jlm::rvsdg::unop_reduction_path_t can_reduce_operand(const jlm::rvsdg::Output *output) const noexcept override
~FloatingPointToSignedIntegerOperation() noexcept override
std::string debug_string() const override
std::unique_ptr< Operation > copy() const override
jlm::rvsdg::Output * reduce_operand(jlm::rvsdg::unop_reduction_path_t path, jlm::rvsdg::Output *output) const override
std::string debug_string() const override
jlm::rvsdg::unop_reduction_path_t can_reduce_operand(const jlm::rvsdg::Output *output) const noexcept override
std::unique_ptr< Operation > copy() const override
~FloatingPointToUnsignedIntegerOperation() noexcept override
std::unique_ptr< Operation > copy() const override
~FreeOperation() noexcept override
std::string debug_string() const override
std::string debug_string() const override
~FreezeOperation() noexcept override
std::unique_ptr< Operation > copy() const override
jlm::rvsdg::Output * reduce_operand(rvsdg::unop_reduction_path_t path, jlm::rvsdg::Output *arg) const override
rvsdg::unop_reduction_path_t can_reduce_operand(const jlm::rvsdg::Output *arg) const noexcept override
const jlm::rvsdg::Type & getType() const noexcept
std::string debug_string() const override
~InsertElementOperation() noexcept override
std::unique_ptr< Operation > copy() const override
std::unique_ptr< Operation > copy() const override
std::string debug_string() const override
jlm::rvsdg::unop_reduction_path_t can_reduce_operand(const jlm::rvsdg::Output *output) const noexcept override
~IntegerToPointerOperation() noexcept override
jlm::rvsdg::Output * reduce_operand(jlm::rvsdg::unop_reduction_path_t path, jlm::rvsdg::Output *output) const override
std::unique_ptr< Operation > copy() const override
std::string debug_string() const override
~MallocOperation() noexcept override
PoisonValueOperation class.
~PoisonValueOperation() noexcept override
std::string debug_string() const override
const jlm::rvsdg::Type & GetType() const noexcept
std::unique_ptr< Operation > copy() const override
~PtrCmpOperation() noexcept override
jlm::rvsdg::binop_reduction_path_t can_reduce_operand_pair(const jlm::rvsdg::Output *op1, const jlm::rvsdg::Output *op2) const noexcept override
std::string debug_string() const override
jlm::rvsdg::Output * reduce_operand_pair(jlm::rvsdg::binop_reduction_path_t path, jlm::rvsdg::Output *op1, jlm::rvsdg::Output *op2) const override
std::unique_ptr< Operation > copy() const override
std::unique_ptr< Operation > copy() const override
std::string debug_string() const override
jlm::rvsdg::unop_reduction_path_t can_reduce_operand(const jlm::rvsdg::Output *output) const noexcept override
jlm::rvsdg::Output * reduce_operand(jlm::rvsdg::unop_reduction_path_t path, jlm::rvsdg::Output *output) const override
~PtrToIntOperation() noexcept override
~SIToFPOperation() noexcept override
jlm::rvsdg::unop_reduction_path_t can_reduce_operand(const jlm::rvsdg::Output *output) const noexcept override
std::unique_ptr< Operation > copy() const override
jlm::rvsdg::Output * reduce_operand(jlm::rvsdg::unop_reduction_path_t path, jlm::rvsdg::Output *output) const override
std::string debug_string() const override
std::string debug_string() const override
std::unique_ptr< Operation > copy() const override
~SelectOperation() noexcept override
std::string debug_string() const override
std::unique_ptr< Operation > copy() const override
~ShuffleVectorOperation() noexcept override
ControlFlowGraphNode * GetIncomingNode(size_t n) const noexcept
std::string debug_string() const override
std::unique_ptr< Operation > copy() const override
~SsaPhiOperation() noexcept override
std::vector< ControlFlowGraphNode * > IncomingNodes_
std::string debug_string() const override
~TruncOperation() noexcept override
jlm::rvsdg::unop_reduction_path_t can_reduce_operand(const jlm::rvsdg::Output *operand) const noexcept override
size_t ndstbits() const noexcept
jlm::rvsdg::Output * reduce_operand(jlm::rvsdg::unop_reduction_path_t path, jlm::rvsdg::Output *operand) const override
size_t nsrcbits() const noexcept
std::unique_ptr< Operation > copy() const override
std::string debug_string() const override
jlm::rvsdg::unop_reduction_path_t can_reduce_operand(const jlm::rvsdg::Output *operand) const noexcept override
jlm::rvsdg::Output * reduce_operand(jlm::rvsdg::unop_reduction_path_t path, jlm::rvsdg::Output *operand) const override
std::unique_ptr< Operation > copy() const override
~UIToFPOperation() noexcept override
UndefValueOperation class.
~UndefValueOperation() noexcept override
std::string debug_string() const override
std::unique_ptr< Operation > copy() const override
const rvsdg::Type & GetType() const noexcept
std::string debug_string() const override
~VariadicArgumentListOperation() noexcept override
std::unique_ptr< Operation > copy() const override
std::string debug_string() const override
std::unique_ptr< Operation > copy() const override
const rvsdg::BinaryOperation & operation() const noexcept
~VectorBinaryOperation() noexcept override
std::unique_ptr< Operation > copy() const override
const rvsdg::Type & type() const noexcept
std::string debug_string() const override
~VectorSelectOperation() noexcept override
~VectorUnaryOperation() noexcept override
std::string debug_string() const override
const rvsdg::UnaryOperation & operation() const noexcept
std::unique_ptr< Operation > copy() const override
std::string debug_string() const override
size_t nsrcbits() const noexcept
jlm::rvsdg::Output * reduce_operand(jlm::rvsdg::unop_reduction_path_t path, jlm::rvsdg::Output *operand) const override
~ZExtOperation() noexcept override
std::unique_ptr< Operation > copy() const override
jlm::rvsdg::unop_reduction_path_t can_reduce_operand(const jlm::rvsdg::Output *operand) const noexcept override
size_t ndstbits() const noexcept
static Output & create(Region ®ion, BitValueRepresentation value)
const std::shared_ptr< const rvsdg::Type > & argument(size_t index) const noexcept
const std::shared_ptr< const rvsdg::Type > & result(size_t index) const noexcept
size_t narguments() const noexcept
#define JLM_UNREACHABLE(msg)
Global memory state passed between functions.
ICmpPredicate convertICmpPredicateToJlm(::llvm::CmpInst::Predicate predicate)
std::string_view iCmpPredicateToString(ICmpPredicate predicate)
static const util::BijectiveMap<::llvm::CmpInst::Predicate, ICmpPredicate > & getICmpPredicateMap()
::llvm::CmpInst::Predicate convertICmpPredicateToLlvm(ICmpPredicate predicate)
size_t unop_reduction_path_t
size_t binop_reduction_path_t
static const unop_reduction_path_t unop_reduction_constant
static const unop_reduction_path_t unop_reduction_none
Output & traceOutputIntraProcedurally(Output &output)
static const binop_reduction_path_t binop_reduction_none
static std::string strfmt(Args... args)