#ifndef HWLM_BUILD_H
#define HWLM_BUILD_H
#include "hwlm.h"
#include "hwlm_literal.h"
#include "ue2common.h"
#include "util/bytecode_ptr.h"
#include <map>
#include <memory>
#include <vector>
struct HWLM;
namespace ue2 {
class FDREngineDescription;
class TeddyEngineDescription;
struct CompileContext;
struct Grey;
struct HWLMProto {
u8 engType;
std::unique_ptr<FDREngineDescription> fdrEng;
std::unique_ptr<TeddyEngineDescription> teddyEng;
std::vector<hwlmLiteral> lits;
std::map<u32, std::vector<u32>> bucketToLits;
bool make_small = false;
HWLMProto(u8 engType_in, std::vector<hwlmLiteral> lits_in);
HWLMProto(u8 engType_in, std::unique_ptr<FDREngineDescription> eng_in,
std::vector<hwlmLiteral> lits_in,
std::map<u32, std::vector<u32>> bucketToLits_in,
bool make_small_in);
HWLMProto(u8 engType_in, std::unique_ptr<TeddyEngineDescription> eng_in,
std::vector<hwlmLiteral> lits_in,
std::map<u32, std::vector<u32>> bucketToLits_in,
bool make_small_in);
~HWLMProto();
};
bytecode_ptr<HWLM> hwlmBuild(const HWLMProto &proto, const CompileContext &cc,
hwlm_group_t expected_groups = HWLM_ALL_GROUPS);
std::unique_ptr<HWLMProto>
hwlmBuildProto(std::vector<hwlmLiteral> &lits, bool make_small,
const CompileContext &cc);
size_t hwlmFloodProneSuffixLen(size_t numLiterals, const CompileContext &cc);
size_t hwlmSize(const HWLM *h);
}
#endif