CIRCT 22.0.0git
Loading...
Searching...
No Matches
LoweringOptionsParser.h
Go to the documentation of this file.
1//===- LoweringOptionsParser.h - CIRCT Lowering Option Parser ---*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// Parser for lowering options.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef CIRCT_SUPPORT_LOWERINGOPTIONSPARSER_H
14#define CIRCT_SUPPORT_LOWERINGOPTIONSPARSER_H
15
16#include "circt/Support/LLVM.h"
18#include "llvm/ADT/StringRef.h"
19#include "llvm/Support/CommandLine.h"
20
21namespace circt {
22
23/// Commandline parser for LoweringOptions. Delegates to the parser
24/// defined by LoweringOptions.
25struct LoweringOptionsParser : public llvm::cl::parser<LoweringOptions> {
26
27 LoweringOptionsParser(llvm::cl::Option &option)
28 : llvm::cl::parser<LoweringOptions>(option) {}
29
30 bool parse(llvm::cl::Option &option, StringRef argName, StringRef argValue,
31 LoweringOptions &value) {
32 bool failed = false;
33 value.parse(argValue, [&](Twine error) { failed = option.error(error); });
34 return failed;
35 }
36};
37
39 : llvm::cl::opt<LoweringOptions, false, LoweringOptionsParser> {
40 LoweringOptionsOption(llvm::cl::OptionCategory &cat)
41 : llvm::cl::opt<LoweringOptions, false, LoweringOptionsParser>{
42 "lowering-options",
43 llvm::cl::desc(
44 "Style options. Valid flags include: "
45 "noAlwaysComb, exprInEventControl, disallowPackedArrays, "
46 "disallowLocalVariables, verifLabels, emittedLineLength=<n>, "
47 "maximumNumberOfTermsPerExpression=<n>, "
48 "explicitBitcast, emitReplicatedOpsToHeader, "
49 "locationInfoStyle={plain,wrapInAtSquareBracket,none}, "
50 "disallowPortDeclSharing, printDebugInfo, "
51 "disallowExpressionInliningInPorts, disallowMuxInlining, "
52 "emitWireInPort, emitBindComments, omitVersionComment, "
53 "caseInsensitiveKeywords"),
54 llvm::cl::cat(cat), llvm::cl::value_desc("option")} {}
55};
56
57} // namespace circt
58
59#endif // CIRCT_SUPPORT_LOWERINGOPTIONSPARSER_H
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
LoweringOptionsOption(llvm::cl::OptionCategory &cat)
Commandline parser for LoweringOptions.
LoweringOptionsParser(llvm::cl::Option &option)
bool parse(llvm::cl::Option &option, StringRef argName, StringRef argValue, LoweringOptions &value)
Options which control the emission from CIRCT to Verilog.
void parse(llvm::StringRef options, ErrorHandlerT callback)
Read in options from a string, overriding only the set options in the string.