2011-10-02 00:41:13 +08:00
|
|
|
//===- TableGen.cpp - Top-Level TableGen implementation for LLVM ----------===//
|
2005-04-22 08:00:37 +08:00
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2005-04-22 08:00:37 +08:00
|
|
|
//
|
2003-10-21 04:20:30 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2003-10-06 03:27:59 +08:00
|
|
|
//
|
2011-10-02 00:41:13 +08:00
|
|
|
// This file contains the main function for LLVM's TableGen.
|
2003-10-06 03:27:59 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2012-06-11 23:37:55 +08:00
|
|
|
#include "TableGenBackends.h" // Declares all backends.
|
2009-07-09 02:44:05 +08:00
|
|
|
#include "llvm/Support/CommandLine.h"
|
2016-01-04 12:51:51 +08:00
|
|
|
#include "llvm/Support/ManagedStatic.h"
|
2009-07-09 02:44:05 +08:00
|
|
|
#include "llvm/Support/PrettyStackTrace.h"
|
2010-11-30 02:16:10 +08:00
|
|
|
#include "llvm/Support/Signals.h"
|
2011-10-02 00:41:13 +08:00
|
|
|
#include "llvm/TableGen/Main.h"
|
|
|
|
#include "llvm/TableGen/Record.h"
|
2014-06-17 21:10:38 +08:00
|
|
|
#include "llvm/TableGen/SetTheory.h"
|
2011-10-02 00:41:13 +08:00
|
|
|
|
2004-08-01 11:55:39 +08:00
|
|
|
using namespace llvm;
|
2003-11-12 06:41:34 +08:00
|
|
|
|
2003-10-06 03:27:59 +08:00
|
|
|
enum ActionType {
|
|
|
|
PrintRecords,
|
[TableGen] Add a general-purpose JSON backend.
The aim of this backend is to output everything TableGen knows about
the record set, similarly to the default -print-records backend. But
where -print-records produces output in TableGen's input syntax
(convenient for humans to read), this backend produces it as
structured JSON data, which is convenient for loading into standard
scripting languages such as Python, in order to extract information
from the data set in an automated way.
The output data contains a JSON representation of the variable
definitions in output 'def' records, and a few pieces of metadata such
as which of those definitions are tagged with the 'field' prefix and
which defs are derived from which classes. It doesn't dump out
absolutely every piece of knowledge it _could_ produce, such as type
information and complicated arithmetic operator nodes in abstract
superclasses; the main aim is to allow consumers of this JSON dump to
essentially act as new backends, and backends don't generally need to
depend on that kind of data.
The new backend is implemented as an EmitJSON() function similar to
all of llvm-tblgen's other EmitFoo functions, except that it lives in
lib/TableGen instead of utils/TableGen on the basis that I'm expecting
to add it to clang-tblgen too in a future patch.
To test it, I've written a Python script that loads the JSON output
and tests properties of it based on comments in the .td source - more
or less like FileCheck, except that the CHECK: lines have Python
expressions after them instead of textual pattern matches.
Reviewers: nhaehnle
Reviewed By: nhaehnle
Subscribers: arichardson, labath, mgorny, llvm-commits
Differential Revision: https://reviews.llvm.org/D46054
llvm-svn: 336771
2018-07-11 16:40:19 +08:00
|
|
|
DumpJSON,
|
2003-10-06 03:27:59 +08:00
|
|
|
GenEmitter,
|
2011-06-28 02:32:37 +08:00
|
|
|
GenRegisterInfo,
|
2011-06-29 04:07:07 +08:00
|
|
|
GenInstrInfo,
|
2017-11-14 23:35:15 +08:00
|
|
|
GenInstrDocs,
|
2011-06-29 04:07:07 +08:00
|
|
|
GenAsmWriter,
|
|
|
|
GenAsmMatcher,
|
2009-11-25 10:13:23 +08:00
|
|
|
GenDisassembler,
|
2011-07-09 01:36:35 +08:00
|
|
|
GenPseudoLowering,
|
[RISCV] Tablegen-driven Instruction Compression.
Summary:
This patch implements a tablegen-driven Instruction Compression
mechanism for generating RISCV compressed instructions
(C Extension) from the expanded instruction form.
This tablegen backend processes CompressPat declarations in a
td file and generates all the compile-time and runtime checks
required to validate the declarations, validate the input
operands and generate correct instructions.
The checks include validating register operands, immediate
operands, fixed register operands and fixed immediate operands.
Example:
class CompressPat<dag input, dag output> {
dag Input = input;
dag Output = output;
list<Predicate> Predicates = [];
}
let Predicates = [HasStdExtC] in {
def : CompressPat<(ADD GPRNoX0:$rs1, GPRNoX0:$rs1, GPRNoX0:$rs2),
(C_ADD GPRNoX0:$rs1, GPRNoX0:$rs2)>;
}
The result is an auto-generated header file
'RISCVGenCompressEmitter.inc' which exports two functions for
compressing/uncompressing MCInst instructions, plus
some helper functions:
bool compressInst(MCInst& OutInst, const MCInst &MI,
const MCSubtargetInfo &STI,
MCContext &Context);
bool uncompressInst(MCInst& OutInst, const MCInst &MI,
const MCRegisterInfo &MRI,
const MCSubtargetInfo &STI);
The clients that include this auto-generated header file and
invoke these functions can compress an instruction before emitting
it, in the target-specific ASM or ELF streamer, or can uncompress
an instruction before printing it, when the expanded instruction
format aliases is favored.
The following clients were added to implement compression\uncompression
for RISCV:
1) RISCVAsmParser::MatchAndEmitInstruction:
Inserted a call to compressInst() to compresses instructions
parsed by llvm-mc coming from an ASM input.
2) RISCVAsmPrinter::EmitInstruction:
Inserted a call to compressInst() to compress instructions that
were lowered from Machine Instructions (MachineInstr).
3) RVInstPrinter::printInst:
Inserted a call to uncompressInst() to print the expanded
version of the instruction instead of the compressed one (e.g,
add s0, s0, a5 instead of c.add s0, a5) when -riscv-no-aliases
is not passed.
This patch squashes D45119, D42780 and D41932. It was reviewed in smaller patches by
asb, efriedma, apazos and mgrang.
Reviewers: asb, efriedma, apazos, llvm-commits, sabuasal
Reviewed By: sabuasal
Subscribers: mgorny, eraman, asb, rbar, johnrusso, simoncook, jordy.potman.lists, apazos, niosHD, kito-cheng, shiva0217, zzheng
Differential Revision: https://reviews.llvm.org/D45385
llvm-svn: 329455
2018-04-07 05:07:05 +08:00
|
|
|
GenCompressInst,
|
2007-02-28 06:08:27 +08:00
|
|
|
GenCallingConv,
|
2005-09-03 09:14:03 +08:00
|
|
|
GenDAGISel,
|
2011-12-02 05:10:21 +08:00
|
|
|
GenDFAPacketizer,
|
2008-08-14 04:19:35 +08:00
|
|
|
GenFastISel,
|
2005-10-22 03:05:19 +08:00
|
|
|
GenSubtarget,
|
2018-06-23 10:02:38 +08:00
|
|
|
GenIntrinsicEnums,
|
|
|
|
GenIntrinsicImpl,
|
|
|
|
GenTgtIntrinsicEnums,
|
|
|
|
GenTgtIntrinsicImpl,
|
2011-06-04 12:11:37 +08:00
|
|
|
PrintEnums,
|
2012-12-05 08:29:32 +08:00
|
|
|
PrintSets,
|
2013-03-22 07:40:38 +08:00
|
|
|
GenOptParserDefs,
|
2015-11-12 04:35:42 +08:00
|
|
|
GenCTags,
|
2016-07-06 05:23:04 +08:00
|
|
|
GenAttributes,
|
|
|
|
GenSearchableTables,
|
2016-12-22 07:26:20 +08:00
|
|
|
GenGlobalISel,
|
2019-10-03 05:13:07 +08:00
|
|
|
GenGICombiner,
|
2017-03-07 16:11:19 +08:00
|
|
|
GenX86EVEX2VEXTables,
|
2017-10-08 17:20:32 +08:00
|
|
|
GenX86FoldTables,
|
Re-commit: [globalisel] Tablegen-erate current Register Bank Information
Summary:
Adds a RegisterBank tablegen class that can be used to declare the register
banks and an associated tablegen pass to generate the necessary code.
Changes since first commit attempt:
* Added missing guards
* Added more missing guards
* Found and fixed a use-after-free bug involving Twine locals
Reviewers: t.p.northover, ab, rovka, qcolombet
Reviewed By: qcolombet
Subscribers: aditya_nandakumar, rengolin, kristof.beyls, vkalintiris, mgorny, dberris, llvm-commits, rovka
Differential Revision: https://reviews.llvm.org/D27338
llvm-svn: 292478
2017-01-19 19:15:55 +08:00
|
|
|
GenRegisterBank,
|
2018-10-25 15:44:01 +08:00
|
|
|
GenExegesis,
|
2019-10-04 17:03:36 +08:00
|
|
|
GenAutomata,
|
2003-10-06 03:27:59 +08:00
|
|
|
};
|
|
|
|
|
2019-02-12 07:02:02 +08:00
|
|
|
namespace llvm {
|
|
|
|
/// Storage for TimeRegionsOpt as a global so that backends aren't required to
|
|
|
|
/// include CommandLine.h
|
|
|
|
bool TimeRegions = false;
|
|
|
|
} // end namespace llvm
|
|
|
|
|
2003-10-06 03:27:59 +08:00
|
|
|
namespace {
|
2019-10-03 03:56:04 +08:00
|
|
|
cl::opt<ActionType> Action(
|
|
|
|
cl::desc("Action to perform:"),
|
|
|
|
cl::values(
|
|
|
|
clEnumValN(PrintRecords, "print-records",
|
|
|
|
"Print all records to stdout (default)"),
|
|
|
|
clEnumValN(DumpJSON, "dump-json",
|
|
|
|
"Dump all records as machine-readable JSON"),
|
|
|
|
clEnumValN(GenEmitter, "gen-emitter", "Generate machine code emitter"),
|
|
|
|
clEnumValN(GenRegisterInfo, "gen-register-info",
|
|
|
|
"Generate registers and register classes info"),
|
|
|
|
clEnumValN(GenInstrInfo, "gen-instr-info",
|
|
|
|
"Generate instruction descriptions"),
|
|
|
|
clEnumValN(GenInstrDocs, "gen-instr-docs",
|
|
|
|
"Generate instruction documentation"),
|
|
|
|
clEnumValN(GenCallingConv, "gen-callingconv",
|
|
|
|
"Generate calling convention descriptions"),
|
|
|
|
clEnumValN(GenAsmWriter, "gen-asm-writer", "Generate assembly writer"),
|
|
|
|
clEnumValN(GenDisassembler, "gen-disassembler",
|
|
|
|
"Generate disassembler"),
|
|
|
|
clEnumValN(GenPseudoLowering, "gen-pseudo-lowering",
|
|
|
|
"Generate pseudo instruction lowering"),
|
|
|
|
clEnumValN(GenCompressInst, "gen-compress-inst-emitter",
|
|
|
|
"Generate RISCV compressed instructions."),
|
|
|
|
clEnumValN(GenAsmMatcher, "gen-asm-matcher",
|
|
|
|
"Generate assembly instruction matcher"),
|
|
|
|
clEnumValN(GenDAGISel, "gen-dag-isel",
|
|
|
|
"Generate a DAG instruction selector"),
|
|
|
|
clEnumValN(GenDFAPacketizer, "gen-dfa-packetizer",
|
|
|
|
"Generate DFA Packetizer for VLIW targets"),
|
|
|
|
clEnumValN(GenFastISel, "gen-fast-isel",
|
|
|
|
"Generate a \"fast\" instruction selector"),
|
|
|
|
clEnumValN(GenSubtarget, "gen-subtarget",
|
|
|
|
"Generate subtarget enumerations"),
|
|
|
|
clEnumValN(GenIntrinsicEnums, "gen-intrinsic-enums",
|
|
|
|
"Generate intrinsic enums"),
|
|
|
|
clEnumValN(GenIntrinsicImpl, "gen-intrinsic-impl",
|
|
|
|
"Generate intrinsic information"),
|
|
|
|
clEnumValN(GenTgtIntrinsicEnums, "gen-tgt-intrinsic-enums",
|
|
|
|
"Generate target intrinsic enums"),
|
|
|
|
clEnumValN(GenTgtIntrinsicImpl, "gen-tgt-intrinsic-impl",
|
|
|
|
"Generate target intrinsic information"),
|
|
|
|
clEnumValN(PrintEnums, "print-enums", "Print enum values for a class"),
|
|
|
|
clEnumValN(PrintSets, "print-sets",
|
|
|
|
"Print expanded sets for testing DAG exprs"),
|
|
|
|
clEnumValN(GenOptParserDefs, "gen-opt-parser-defs",
|
|
|
|
"Generate option definitions"),
|
|
|
|
clEnumValN(GenCTags, "gen-ctags", "Generate ctags-compatible index"),
|
|
|
|
clEnumValN(GenAttributes, "gen-attrs", "Generate attributes"),
|
|
|
|
clEnumValN(GenSearchableTables, "gen-searchable-tables",
|
|
|
|
"Generate generic binary-searchable table"),
|
|
|
|
clEnumValN(GenGlobalISel, "gen-global-isel",
|
|
|
|
"Generate GlobalISel selector"),
|
2019-10-03 05:13:07 +08:00
|
|
|
clEnumValN(GenGICombiner, "gen-global-isel-combiner",
|
|
|
|
"Generate GlobalISel combiner"),
|
2019-10-03 03:56:04 +08:00
|
|
|
clEnumValN(GenX86EVEX2VEXTables, "gen-x86-EVEX2VEX-tables",
|
|
|
|
"Generate X86 EVEX to VEX compress tables"),
|
|
|
|
clEnumValN(GenX86FoldTables, "gen-x86-fold-tables",
|
|
|
|
"Generate X86 fold tables"),
|
|
|
|
clEnumValN(GenRegisterBank, "gen-register-bank",
|
|
|
|
"Generate registers bank descriptions"),
|
|
|
|
clEnumValN(GenExegesis, "gen-exegesis",
|
2019-10-04 17:03:36 +08:00
|
|
|
"Generate llvm-exegesis tables"),
|
|
|
|
clEnumValN(GenAutomata, "gen-automata",
|
|
|
|
"Generate generic automata")));
|
2003-10-06 03:27:59 +08:00
|
|
|
|
2019-10-03 03:56:04 +08:00
|
|
|
cl::OptionCategory PrintEnumsCat("Options for -print-enums");
|
|
|
|
cl::opt<std::string> Class("class", cl::desc("Print Enum list for this class"),
|
|
|
|
cl::value_desc("class name"),
|
|
|
|
cl::cat(PrintEnumsCat));
|
2012-06-11 23:37:55 +08:00
|
|
|
|
2019-02-12 07:02:02 +08:00
|
|
|
cl::opt<bool, true>
|
|
|
|
TimeRegionsOpt("time-regions",
|
|
|
|
cl::desc("Time regions of tablegens execution"),
|
|
|
|
cl::location(TimeRegions));
|
|
|
|
|
2012-10-04 05:29:19 +08:00
|
|
|
bool LLVMTableGenMain(raw_ostream &OS, RecordKeeper &Records) {
|
|
|
|
switch (Action) {
|
|
|
|
case PrintRecords:
|
|
|
|
OS << Records; // No argument, dump all contents
|
|
|
|
break;
|
[TableGen] Add a general-purpose JSON backend.
The aim of this backend is to output everything TableGen knows about
the record set, similarly to the default -print-records backend. But
where -print-records produces output in TableGen's input syntax
(convenient for humans to read), this backend produces it as
structured JSON data, which is convenient for loading into standard
scripting languages such as Python, in order to extract information
from the data set in an automated way.
The output data contains a JSON representation of the variable
definitions in output 'def' records, and a few pieces of metadata such
as which of those definitions are tagged with the 'field' prefix and
which defs are derived from which classes. It doesn't dump out
absolutely every piece of knowledge it _could_ produce, such as type
information and complicated arithmetic operator nodes in abstract
superclasses; the main aim is to allow consumers of this JSON dump to
essentially act as new backends, and backends don't generally need to
depend on that kind of data.
The new backend is implemented as an EmitJSON() function similar to
all of llvm-tblgen's other EmitFoo functions, except that it lives in
lib/TableGen instead of utils/TableGen on the basis that I'm expecting
to add it to clang-tblgen too in a future patch.
To test it, I've written a Python script that loads the JSON output
and tests properties of it based on comments in the .td source - more
or less like FileCheck, except that the CHECK: lines have Python
expressions after them instead of textual pattern matches.
Reviewers: nhaehnle
Reviewed By: nhaehnle
Subscribers: arichardson, labath, mgorny, llvm-commits
Differential Revision: https://reviews.llvm.org/D46054
llvm-svn: 336771
2018-07-11 16:40:19 +08:00
|
|
|
case DumpJSON:
|
|
|
|
EmitJSON(Records, OS);
|
|
|
|
break;
|
2012-10-04 05:29:19 +08:00
|
|
|
case GenEmitter:
|
|
|
|
EmitCodeEmitter(Records, OS);
|
|
|
|
break;
|
|
|
|
case GenRegisterInfo:
|
|
|
|
EmitRegisterInfo(Records, OS);
|
|
|
|
break;
|
|
|
|
case GenInstrInfo:
|
|
|
|
EmitInstrInfo(Records, OS);
|
|
|
|
break;
|
2017-11-14 23:35:15 +08:00
|
|
|
case GenInstrDocs:
|
|
|
|
EmitInstrDocs(Records, OS);
|
|
|
|
break;
|
2012-10-04 05:29:19 +08:00
|
|
|
case GenCallingConv:
|
|
|
|
EmitCallingConv(Records, OS);
|
|
|
|
break;
|
|
|
|
case GenAsmWriter:
|
|
|
|
EmitAsmWriter(Records, OS);
|
|
|
|
break;
|
|
|
|
case GenAsmMatcher:
|
|
|
|
EmitAsmMatcher(Records, OS);
|
|
|
|
break;
|
|
|
|
case GenDisassembler:
|
|
|
|
EmitDisassembler(Records, OS);
|
|
|
|
break;
|
|
|
|
case GenPseudoLowering:
|
|
|
|
EmitPseudoLowering(Records, OS);
|
|
|
|
break;
|
[RISCV] Tablegen-driven Instruction Compression.
Summary:
This patch implements a tablegen-driven Instruction Compression
mechanism for generating RISCV compressed instructions
(C Extension) from the expanded instruction form.
This tablegen backend processes CompressPat declarations in a
td file and generates all the compile-time and runtime checks
required to validate the declarations, validate the input
operands and generate correct instructions.
The checks include validating register operands, immediate
operands, fixed register operands and fixed immediate operands.
Example:
class CompressPat<dag input, dag output> {
dag Input = input;
dag Output = output;
list<Predicate> Predicates = [];
}
let Predicates = [HasStdExtC] in {
def : CompressPat<(ADD GPRNoX0:$rs1, GPRNoX0:$rs1, GPRNoX0:$rs2),
(C_ADD GPRNoX0:$rs1, GPRNoX0:$rs2)>;
}
The result is an auto-generated header file
'RISCVGenCompressEmitter.inc' which exports two functions for
compressing/uncompressing MCInst instructions, plus
some helper functions:
bool compressInst(MCInst& OutInst, const MCInst &MI,
const MCSubtargetInfo &STI,
MCContext &Context);
bool uncompressInst(MCInst& OutInst, const MCInst &MI,
const MCRegisterInfo &MRI,
const MCSubtargetInfo &STI);
The clients that include this auto-generated header file and
invoke these functions can compress an instruction before emitting
it, in the target-specific ASM or ELF streamer, or can uncompress
an instruction before printing it, when the expanded instruction
format aliases is favored.
The following clients were added to implement compression\uncompression
for RISCV:
1) RISCVAsmParser::MatchAndEmitInstruction:
Inserted a call to compressInst() to compresses instructions
parsed by llvm-mc coming from an ASM input.
2) RISCVAsmPrinter::EmitInstruction:
Inserted a call to compressInst() to compress instructions that
were lowered from Machine Instructions (MachineInstr).
3) RVInstPrinter::printInst:
Inserted a call to uncompressInst() to print the expanded
version of the instruction instead of the compressed one (e.g,
add s0, s0, a5 instead of c.add s0, a5) when -riscv-no-aliases
is not passed.
This patch squashes D45119, D42780 and D41932. It was reviewed in smaller patches by
asb, efriedma, apazos and mgrang.
Reviewers: asb, efriedma, apazos, llvm-commits, sabuasal
Reviewed By: sabuasal
Subscribers: mgorny, eraman, asb, rbar, johnrusso, simoncook, jordy.potman.lists, apazos, niosHD, kito-cheng, shiva0217, zzheng
Differential Revision: https://reviews.llvm.org/D45385
llvm-svn: 329455
2018-04-07 05:07:05 +08:00
|
|
|
case GenCompressInst:
|
|
|
|
EmitCompressInst(Records, OS);
|
|
|
|
break;
|
2012-10-04 05:29:19 +08:00
|
|
|
case GenDAGISel:
|
|
|
|
EmitDAGISel(Records, OS);
|
|
|
|
break;
|
|
|
|
case GenDFAPacketizer:
|
|
|
|
EmitDFAPacketizer(Records, OS);
|
|
|
|
break;
|
|
|
|
case GenFastISel:
|
|
|
|
EmitFastISel(Records, OS);
|
|
|
|
break;
|
|
|
|
case GenSubtarget:
|
|
|
|
EmitSubtarget(Records, OS);
|
|
|
|
break;
|
2018-06-23 10:02:38 +08:00
|
|
|
case GenIntrinsicEnums:
|
|
|
|
EmitIntrinsicEnums(Records, OS);
|
2012-10-04 05:29:19 +08:00
|
|
|
break;
|
2018-06-23 10:02:38 +08:00
|
|
|
case GenIntrinsicImpl:
|
|
|
|
EmitIntrinsicImpl(Records, OS);
|
|
|
|
break;
|
|
|
|
case GenTgtIntrinsicEnums:
|
|
|
|
EmitIntrinsicEnums(Records, OS, true);
|
|
|
|
break;
|
|
|
|
case GenTgtIntrinsicImpl:
|
|
|
|
EmitIntrinsicImpl(Records, OS, true);
|
2012-10-04 05:29:19 +08:00
|
|
|
break;
|
2012-12-05 08:29:32 +08:00
|
|
|
case GenOptParserDefs:
|
|
|
|
EmitOptParser(Records, OS);
|
|
|
|
break;
|
2012-10-04 05:29:19 +08:00
|
|
|
case PrintEnums:
|
|
|
|
{
|
2014-12-11 15:04:54 +08:00
|
|
|
for (Record *Rec : Records.getAllDerivedDefinitions(Class))
|
|
|
|
OS << Rec->getName() << ", ";
|
2012-10-04 05:29:19 +08:00
|
|
|
OS << "\n";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case PrintSets:
|
|
|
|
{
|
|
|
|
SetTheory Sets;
|
|
|
|
Sets.addFieldExpander("Set", "Elements");
|
2014-12-11 15:04:54 +08:00
|
|
|
for (Record *Rec : Records.getAllDerivedDefinitions("Set")) {
|
|
|
|
OS << Rec->getName() << " = [";
|
|
|
|
const std::vector<Record*> *Elts = Sets.expand(Rec);
|
2012-10-04 05:29:19 +08:00
|
|
|
assert(Elts && "Couldn't expand Set instance");
|
2014-12-11 15:04:54 +08:00
|
|
|
for (Record *Elt : *Elts)
|
|
|
|
OS << ' ' << Elt->getName();
|
2012-10-04 05:29:19 +08:00
|
|
|
OS << " ]\n";
|
2003-11-12 06:41:34 +08:00
|
|
|
}
|
2012-10-04 05:29:19 +08:00
|
|
|
break;
|
|
|
|
}
|
2013-03-22 07:40:38 +08:00
|
|
|
case GenCTags:
|
|
|
|
EmitCTags(Records, OS);
|
|
|
|
break;
|
2015-11-12 04:35:42 +08:00
|
|
|
case GenAttributes:
|
|
|
|
EmitAttributes(Records, OS);
|
|
|
|
break;
|
2016-07-06 05:23:04 +08:00
|
|
|
case GenSearchableTables:
|
|
|
|
EmitSearchableTables(Records, OS);
|
|
|
|
break;
|
2016-12-22 07:26:20 +08:00
|
|
|
case GenGlobalISel:
|
|
|
|
EmitGlobalISel(Records, OS);
|
2017-02-03 22:18:35 +08:00
|
|
|
break;
|
2019-10-03 05:13:07 +08:00
|
|
|
case GenGICombiner:
|
|
|
|
EmitGICombiner(Records, OS);
|
|
|
|
break;
|
Re-commit: [globalisel] Tablegen-erate current Register Bank Information
Summary:
Adds a RegisterBank tablegen class that can be used to declare the register
banks and an associated tablegen pass to generate the necessary code.
Changes since first commit attempt:
* Added missing guards
* Added more missing guards
* Found and fixed a use-after-free bug involving Twine locals
Reviewers: t.p.northover, ab, rovka, qcolombet
Reviewed By: qcolombet
Subscribers: aditya_nandakumar, rengolin, kristof.beyls, vkalintiris, mgorny, dberris, llvm-commits, rovka
Differential Revision: https://reviews.llvm.org/D27338
llvm-svn: 292478
2017-01-19 19:15:55 +08:00
|
|
|
case GenRegisterBank:
|
|
|
|
EmitRegisterBank(Records, OS);
|
2016-12-22 07:26:20 +08:00
|
|
|
break;
|
2017-03-07 16:11:19 +08:00
|
|
|
case GenX86EVEX2VEXTables:
|
|
|
|
EmitX86EVEX2VEXTables(Records, OS);
|
|
|
|
break;
|
2017-10-08 17:20:32 +08:00
|
|
|
case GenX86FoldTables:
|
|
|
|
EmitX86FoldTables(Records, OS);
|
|
|
|
break;
|
2018-10-25 15:44:01 +08:00
|
|
|
case GenExegesis:
|
|
|
|
EmitExegesis(Records, OS);
|
|
|
|
break;
|
2019-10-04 17:03:36 +08:00
|
|
|
case GenAutomata:
|
|
|
|
EmitAutomata(Records, OS);
|
|
|
|
break;
|
2012-10-04 05:29:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2011-12-20 10:50:00 +08:00
|
|
|
}
|
2011-10-02 00:41:13 +08:00
|
|
|
|
|
|
|
int main(int argc, char **argv) {
|
2016-06-09 08:53:21 +08:00
|
|
|
sys::PrintStackTraceOnErrorSignal(argv[0]);
|
2011-10-02 00:41:13 +08:00
|
|
|
PrettyStackTraceProgram X(argc, argv);
|
|
|
|
cl::ParseCommandLineOptions(argc, argv);
|
2010-05-05 12:13:08 +08:00
|
|
|
|
2016-01-04 12:51:51 +08:00
|
|
|
llvm_shutdown_obj Y;
|
|
|
|
|
2012-10-04 05:29:19 +08:00
|
|
|
return TableGenMain(argv[0], &LLVMTableGenMain);
|
2003-10-06 03:27:59 +08:00
|
|
|
}
|
2014-01-10 16:05:42 +08:00
|
|
|
|
2019-09-24 19:22:34 +08:00
|
|
|
#ifndef __has_feature
|
|
|
|
#define __has_feature(x) 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__) || \
|
|
|
|
__has_feature(leak_sanitizer)
|
|
|
|
|
2014-01-15 15:59:37 +08:00
|
|
|
#include <sanitizer/lsan_interface.h>
|
2014-01-10 16:05:42 +08:00
|
|
|
// Disable LeakSanitizer for this binary as it has too many leaks that are not
|
2014-01-15 15:59:37 +08:00
|
|
|
// very interesting to fix. See compiler-rt/include/sanitizer/lsan_interface.h .
|
2017-09-11 21:50:39 +08:00
|
|
|
LLVM_ATTRIBUTE_USED int __lsan_is_turned_off() { return 1; }
|
2019-09-24 19:22:34 +08:00
|
|
|
|
|
|
|
#endif
|