CIRCT 20.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"
17#include "llvm/ADT/StringRef.h"
18#include "llvm/Support/CommandLine.h"
19
20namespace circt {
21
22/// Commandline parser for LoweringOptions. Delegates to the parser
23/// defined by LoweringOptions.
24struct LoweringOptionsParser : public llvm::cl::parser<LoweringOptions> {
25
26 LoweringOptionsParser(llvm::cl::Option &option)
27 : llvm::cl::parser<LoweringOptions>(option) {}
28
29 bool parse(llvm::cl::Option &option, StringRef argName, StringRef argValue,
30 LoweringOptions &value) {
31 bool failed = false;
32 value.parse(argValue, [&](Twine error) { failed = option.error(error); });
33 return failed;
34 }
35};
36
38 : llvm::cl::opt<LoweringOptions, false, LoweringOptionsParser> {
39 LoweringOptionsOption(llvm::cl::OptionCategory &cat)
40 : llvm::cl::opt<LoweringOptions, false, LoweringOptionsParser>{
41 "lowering-options",
42 llvm::cl::desc(
43 "Style options. Valid flags include: "
44 "noAlwaysComb, exprInEventControl, disallowPackedArrays, "
45 "disallowLocalVariables, verifLabels, emittedLineLength=<n>, "
46 "maximumNumberOfTermsPerExpression=<n>, "
47 "explicitBitcast, emitReplicatedOpsToHeader, "
48 "locationInfoStyle={plain,wrapInAtSquareBracket,none}, "
49 "disallowPortDeclSharing, printDebugInfo, "
50 "disallowExpressionInliningInPorts, disallowMuxInlining, "
51 "emitWireInPort, emitBindComments, omitVersionComment, "
52 "caseInsensitiveKeywords"),
53 llvm::cl::cat(cat), llvm::cl::value_desc("option")} {}
54};
55
56} // namespace circt
57
58#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.