2025-01-30 04:41:43 +08:00
|
|
|
// Copyright (C) 2022-2025 Exaloop Inc. <https://exaloop.io>
|
2022-12-31 12:04:29 +08:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2023-01-09 03:24:10 +08:00
|
|
|
#include "codon/cir/transform/pass.h"
|
2022-12-31 12:04:29 +08:00
|
|
|
|
|
|
|
namespace codon {
|
|
|
|
namespace ir {
|
|
|
|
namespace transform {
|
|
|
|
namespace pythonic {
|
|
|
|
|
|
|
|
/// Pass to optimize list1 + list2 + ...
|
|
|
|
/// Also handles list slices and list literals efficiently.
|
|
|
|
class ListAdditionOptimization : public OperatorPass {
|
|
|
|
public:
|
|
|
|
static const std::string KEY;
|
|
|
|
std::string getKey() const override { return KEY; }
|
|
|
|
void handle(CallInstr *v) override;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace pythonic
|
|
|
|
} // namespace transform
|
|
|
|
} // namespace ir
|
|
|
|
} // namespace codon
|