2023-04-17 19:13:59 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <array>
|
2023-07-03 16:02:51 +01:00
|
|
|
#include <ostream>
|
2023-04-17 19:13:59 +01:00
|
|
|
#include <string_view>
|
|
|
|
|
2023-05-31 12:18:00 +01:00
|
|
|
#include "oi/EnumBitset.h"
|
|
|
|
|
2023-06-26 11:07:44 +01:00
|
|
|
#define OI_FEATURE_LIST \
|
|
|
|
X(ChaseRawPointers, "chase-raw-pointers") \
|
|
|
|
X(PackStructs, "pack-structs") \
|
|
|
|
X(GenPaddingStats, "gen-padding-stats") \
|
|
|
|
X(CaptureThriftIsset, "capture-thrift-isset") \
|
|
|
|
X(TypeGraph, "type-graph") \
|
2023-07-25 18:02:53 +01:00
|
|
|
X(PruneTypeGraph, "prune-type-graph") \
|
2023-06-26 11:07:44 +01:00
|
|
|
X(TypedDataSegment, "typed-data-segment") \
|
|
|
|
X(TreeBuilderTypeChecking, "tree-builder-type-checking") \
|
|
|
|
X(TreeBuilderV2, "tree-builder-v2") \
|
|
|
|
X(GenJitDebug, "gen-jit-debug") \
|
|
|
|
X(JitLogging, "jit-logging") \
|
|
|
|
X(JitTiming, "jit-timing") \
|
2023-04-17 19:13:59 +01:00
|
|
|
X(PolymorphicInheritance, "polymorphic-inheritance")
|
|
|
|
|
2023-07-26 15:31:53 +01:00
|
|
|
namespace oi::detail {
|
2023-04-17 19:13:59 +01:00
|
|
|
|
|
|
|
enum class Feature {
|
|
|
|
UnknownFeature,
|
|
|
|
#define X(name, _) name,
|
|
|
|
OI_FEATURE_LIST
|
|
|
|
#undef X
|
|
|
|
};
|
|
|
|
|
|
|
|
Feature featureFromStr(std::string_view);
|
|
|
|
const char* featureToStr(Feature);
|
2023-07-03 16:02:51 +01:00
|
|
|
void featuresHelp(std::ostream& out);
|
2023-04-17 19:13:59 +01:00
|
|
|
|
|
|
|
constexpr std::array allFeatures = {
|
|
|
|
#define X(name, _) Feature::name,
|
|
|
|
OI_FEATURE_LIST
|
|
|
|
#undef X
|
|
|
|
};
|
|
|
|
|
2023-05-31 12:18:00 +01:00
|
|
|
// Use "size+1" to account for UnknownFeature"
|
|
|
|
using FeatureSet = EnumBitset<Feature, allFeatures.size() + 1>;
|
2023-04-24 16:35:16 +01:00
|
|
|
|
2023-07-26 15:31:53 +01:00
|
|
|
} // namespace oi::detail
|