• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//===- SearchableTable.td ----------------------------------*- tablegen -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file defines the key top-level classes needed to produce a reasonably
11// generic table that can be binary-searched via int and string entries.
12//
13// Each table must instantiate "Mappingkind", listing the fields that should be
14// included and fields that shoould be searchable. Only two kinds of fields are
15// searchable at the moment: "strings" (which are compared case-insensitively),
16// and "bits".
17//
18// For each "MappingKind" the generated header will create GET_MAPPINGKIND_DECL
19// and GET_MAPPINGKIND_IMPL guards.
20//
21// Inside the DECL guard will be a set of function declarations:
22// "lookup{InstanceClass}By{SearchableField}", returning "const {InstanceClass}
23// *" and accepting either a StringRef or a uintN_t. Additionally, if
24// EnumNameField is still defined, there will be an "enum {InstanceClass}Values"
25// allowing C++ code to reference either the primary data table's entries (if
26// EnumValueField is not defined) or some other field (e.g. encoding) if it is.
27//
28// Inside the IMPL guard will be a primary data table "{InstanceClass}sList" and
29// as many searchable indexes as requested
30// ("{InstanceClass}sBy{SearchableField}"). Additionally implementations of the
31// lookup function will be provided.
32//
33// See AArch64SystemOperands.td and its generated header for example uses.
34//
35//===----------------------------------------------------------------------===//
36
37class SearchableTable {
38  list<string> SearchableFields;
39  string EnumNameField = "Name";
40  string EnumValueField;
41}
42