limex: implement variable shift NFA engines

Replaces the old LimEx NFA engines, which were specialised for model
size and number of shifts, with a new set of engines that can handle a
variable number of shifts.
This commit is contained in:
Kirill Rybalchenko
2016-04-21 16:52:43 +01:00
committed by Matthew Barr
parent cdaf705a87
commit 9d2403e8bb
21 changed files with 264 additions and 693 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Intel Corporation
* Copyright (c) 2015-2016, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -68,6 +68,9 @@
The value of NFA.stateSize gives the total state size in bytes (the sum of
all the above).
Number of shifts should be always greater or equal to 1
Number of shifts 0 means that no appropriate NFA engine was found.
*/
#ifndef LIMEX_INTERNAL_H
@@ -77,7 +80,8 @@
#include "repeat_internal.h"
// Constants
#define MAX_MAX_SHIFT 8 /**< largest maxshift used by a LimEx NFA */
#define MAX_SHIFT_COUNT 8 /**< largest number of shifts used by a LimEx NFA */
#define MAX_SHIFT_AMOUNT 16 /**< largest shift amount used by a LimEx NFA */
#define LIMEX_FLAG_COMPRESS_STATE 1 /**< pack state into stream state */
#define LIMEX_FLAG_COMPRESS_MASKED 2 /**< use reach mask-based compression */
@@ -168,8 +172,10 @@ struct LimExNFA##size { /* MUST align with LimExNFABase */ \
u_##size compressMask; /**< switch off before compress */ \
u_##size exceptionMask; \
u_##size repeatCyclicMask; \
u_##size shift[MAX_MAX_SHIFT]; \
u_##size zombieMask; /**< zombie if in any of the set states */ \
u_##size shift[MAX_SHIFT_COUNT]; \
u32 shiftCount; /**< number of shift masks used */ \
u8 shiftAmount[MAX_SHIFT_COUNT]; /**< shift amount for each mask */ \
};
CREATE_NFA_LIMEX(32)