mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
Move TableGen's parser and entry point into a library
This is the first step towards splitting LLVM and Clang's tblgen executables. llvm-svn: 140951
This commit is contained in:
parent
d6d232142d
commit
01246536d9
@ -195,6 +195,7 @@ endif()
|
||||
|
||||
# Put this before tblgen. Else we have a circular dependence.
|
||||
add_subdirectory(lib/Support)
|
||||
add_subdirectory(lib/TableGen)
|
||||
|
||||
set(LLVM_TABLEGEN "tblgen" CACHE
|
||||
STRING "Native TableGen executable. Saves building one when cross-compiling.")
|
||||
|
6
Makefile
6
Makefile
@ -10,7 +10,7 @@
|
||||
LEVEL := .
|
||||
|
||||
# Top-Level LLVM Build Stages:
|
||||
# 1. Build lib/Support, which is used by utils (tblgen).
|
||||
# 1. Build lib/Support and lib/TableGen, which are used by utils (tblgen).
|
||||
# 2. Build utils, which is used by VMCore.
|
||||
# 3. Build VMCore, which builds the Intrinsics.inc file used by libs.
|
||||
# 4. Build libs, which are needed by llvm-config.
|
||||
@ -27,10 +27,10 @@ LEVEL := .
|
||||
ifneq ($(findstring llvmCore, $(RC_ProjectName)),llvmCore) # Normal build (not "Apple-style").
|
||||
|
||||
ifeq ($(BUILD_DIRS_ONLY),1)
|
||||
DIRS := lib/Support utils
|
||||
DIRS := lib/Support lib/TableGen utils
|
||||
OPTIONAL_DIRS :=
|
||||
else
|
||||
DIRS := lib/Support utils lib/VMCore lib tools/llvm-shlib \
|
||||
DIRS := lib/Support lib/TableGen utils lib/VMCore lib tools/llvm-shlib \
|
||||
tools/llvm-config tools runtime docs unittests
|
||||
OPTIONAL_DIRS := projects bindings
|
||||
endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===- Error.h - tblgen error handling helper routines ----------*- C++ -*-===//
|
||||
//===- llvm/TableGen/Error.h - tblgen error handling helpers ----*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -12,8 +12,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef ERROR_H
|
||||
#define ERROR_H
|
||||
#ifndef LLVM_TABLEGEN_ERROR_H
|
||||
#define LLVM_TABLEGEN_ERROR_H
|
||||
|
||||
#include "llvm/Support/SourceMgr.h"
|
||||
|
26
include/llvm/TableGen/Main.h
Normal file
26
include/llvm/TableGen/Main.h
Normal file
@ -0,0 +1,26 @@
|
||||
//===- llvm/TableGen/Main.h - tblgen entry point ----------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file declares the common entry point for tblgen tools.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_TABLEGEN_MAIN_H
|
||||
#define LLVM_TABLEGEN_MAIN_H
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class TableGenAction;
|
||||
|
||||
/// Run the table generator, performing the specified Action on parsed records.
|
||||
int TableGenMain(char *argv0, TableGenAction &Action);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -1,5 +1,4 @@
|
||||
|
||||
//===- Record.h - Classes to represent Table Records ------------*- C++ -*-===//
|
||||
//===- llvm/TableGen/Record.h - Classes for Table Records -------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -13,8 +12,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef RECORD_H
|
||||
#define RECORD_H
|
||||
#ifndef LLVM_TABLEGEN_RECORD_H
|
||||
#define LLVM_TABLEGEN_RECORD_H
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/FoldingSet.h"
|
34
include/llvm/TableGen/TableGenAction.h
Normal file
34
include/llvm/TableGen/TableGenAction.h
Normal file
@ -0,0 +1,34 @@
|
||||
//===- llvm/TableGen/TableGenAction.h - defines TableGenAction --*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines the TableGenAction base class to be derived from by
|
||||
// tblgen tools.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_TABLEGEN_TABLEGENACTION_H
|
||||
#define LLVM_TABLEGEN_TABLEGENACTION_H
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class raw_ostream;
|
||||
class RecordKeeper;
|
||||
|
||||
class TableGenAction {
|
||||
public:
|
||||
virtual ~TableGenAction() {}
|
||||
|
||||
/// Perform the action using Records, and write output to OS.
|
||||
/// @returns true on error, false otherwise
|
||||
virtual bool operator()(raw_ostream &OS, RecordKeeper &Records) = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -1,4 +1,4 @@
|
||||
//===- TableGenBackend.h - Base class for TableGen Backends -----*- C++ -*-===//
|
||||
//===- llvm/TableGen/TableGenBackend.h - Backend base class -----*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -12,8 +12,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef TABLEGENBACKEND_H
|
||||
#define TABLEGENBACKEND_H
|
||||
#ifndef LLVM_TABLEGEN_TABLEGENBACKEND_H
|
||||
#define LLVM_TABLEGEN_TABLEGENBACKEND_H
|
||||
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <string>
|
@ -1,4 +1,4 @@
|
||||
# `Support' library is added on the top-level CMakeLists.txt
|
||||
# `Support' and `TableGen' libraries are added on the top-level CMakeLists.txt
|
||||
|
||||
add_subdirectory(VMCore)
|
||||
add_subdirectory(CodeGen)
|
||||
|
16
lib/TableGen/CMakeLists.txt
Normal file
16
lib/TableGen/CMakeLists.txt
Normal file
@ -0,0 +1,16 @@
|
||||
## FIXME: This only requires RTTI because tblgen uses it. Fix that.
|
||||
set(LLVM_REQUIRES_RTTI 1)
|
||||
set(LLVM_REQUIRES_EH 1)
|
||||
|
||||
add_llvm_library(LLVMTableGen
|
||||
Error.cpp
|
||||
Main.cpp
|
||||
Record.cpp
|
||||
TableGenBackend.cpp
|
||||
TGLexer.cpp
|
||||
TGParser.cpp
|
||||
)
|
||||
|
||||
add_llvm_library_dependencies(LLVMTableGen
|
||||
LLVMSupport
|
||||
)
|
@ -12,7 +12,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "Error.h"
|
||||
#include "llvm/TableGen/Error.h"
|
||||
#include "llvm/ADT/Twine.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
|
124
lib/TableGen/Main.cpp
Normal file
124
lib/TableGen/Main.cpp
Normal file
@ -0,0 +1,124 @@
|
||||
//===- Main.cpp - Top-Level TableGen implementation -----------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// TableGen is a tool which can be used to build up a description of something,
|
||||
// then invoke one or more "tablegen backends" to emit information about the
|
||||
// description in some predefined format. In practice, this is used by the LLVM
|
||||
// code generators to automate generation of a code generator through a
|
||||
// high-level description of the target.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "TGParser.h"
|
||||
#include "llvm/ADT/OwningPtr.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/Support/ToolOutputFile.h"
|
||||
#include "llvm/Support/system_error.h"
|
||||
#include "llvm/TableGen/Error.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
#include "llvm/TableGen/TableGenAction.h"
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
cl::opt<std::string>
|
||||
OutputFilename("o", cl::desc("Output filename"), cl::value_desc("filename"),
|
||||
cl::init("-"));
|
||||
|
||||
cl::opt<std::string>
|
||||
DependFilename("d", cl::desc("Dependency filename"), cl::value_desc("filename"),
|
||||
cl::init(""));
|
||||
|
||||
cl::opt<std::string>
|
||||
InputFilename(cl::Positional, cl::desc("<input file>"), cl::init("-"));
|
||||
|
||||
cl::list<std::string>
|
||||
IncludeDirs("I", cl::desc("Directory of include files"),
|
||||
cl::value_desc("directory"), cl::Prefix);
|
||||
}
|
||||
|
||||
namespace llvm {
|
||||
|
||||
int TableGenMain(char *argv0, TableGenAction &Action) {
|
||||
RecordKeeper Records;
|
||||
|
||||
try {
|
||||
// Parse the input file.
|
||||
OwningPtr<MemoryBuffer> File;
|
||||
if (error_code ec = MemoryBuffer::getFileOrSTDIN(InputFilename.c_str(), File)) {
|
||||
errs() << "Could not open input file '" << InputFilename << "': "
|
||||
<< ec.message() <<"\n";
|
||||
return 1;
|
||||
}
|
||||
MemoryBuffer *F = File.take();
|
||||
|
||||
// Tell SrcMgr about this buffer, which is what TGParser will pick up.
|
||||
SrcMgr.AddNewSourceBuffer(F, SMLoc());
|
||||
|
||||
// Record the location of the include directory so that the lexer can find
|
||||
// it later.
|
||||
SrcMgr.setIncludeDirs(IncludeDirs);
|
||||
|
||||
TGParser Parser(SrcMgr, Records);
|
||||
|
||||
if (Parser.ParseFile())
|
||||
return 1;
|
||||
|
||||
std::string Error;
|
||||
tool_output_file Out(OutputFilename.c_str(), Error);
|
||||
if (!Error.empty()) {
|
||||
errs() << argv0 << ": error opening " << OutputFilename
|
||||
<< ":" << Error << "\n";
|
||||
return 1;
|
||||
}
|
||||
if (!DependFilename.empty()) {
|
||||
if (OutputFilename == "-") {
|
||||
errs() << argv0 << ": the option -d must be used together with -o\n";
|
||||
return 1;
|
||||
}
|
||||
tool_output_file DepOut(DependFilename.c_str(), Error);
|
||||
if (!Error.empty()) {
|
||||
errs() << argv0 << ": error opening " << DependFilename
|
||||
<< ":" << Error << "\n";
|
||||
return 1;
|
||||
}
|
||||
DepOut.os() << OutputFilename << ":";
|
||||
const std::vector<std::string> &Dependencies = Parser.getDependencies();
|
||||
for (std::vector<std::string>::const_iterator I = Dependencies.begin(),
|
||||
E = Dependencies.end();
|
||||
I != E; ++I) {
|
||||
DepOut.os() << " " << (*I);
|
||||
}
|
||||
DepOut.os() << "\n";
|
||||
DepOut.keep();
|
||||
}
|
||||
|
||||
if (Action(Out.os(), Records))
|
||||
return 1;
|
||||
|
||||
// Declare success.
|
||||
Out.keep();
|
||||
return 0;
|
||||
|
||||
} catch (const TGError &Error) {
|
||||
PrintError(Error);
|
||||
} catch (const std::string &Error) {
|
||||
PrintError(Error);
|
||||
} catch (const char *Error) {
|
||||
PrintError(Error);
|
||||
} catch (...) {
|
||||
errs() << argv0 << ": Unknown unexpected exception occurred.\n";
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
18
lib/TableGen/Makefile
Normal file
18
lib/TableGen/Makefile
Normal file
@ -0,0 +1,18 @@
|
||||
##===- lib/TableGen/Makefile -------------------------------*- Makefile -*-===##
|
||||
#
|
||||
# The LLVM Compiler Infrastructure
|
||||
#
|
||||
# This file is distributed under the University of Illinois Open Source
|
||||
# License. See LICENSE.TXT for details.
|
||||
#
|
||||
##===----------------------------------------------------------------------===##
|
||||
|
||||
LEVEL = ../..
|
||||
LIBRARYNAME = LLVMTableGen
|
||||
BUILD_ARCHIVE = 1
|
||||
|
||||
## FIXME: This only requires RTTI because tblgen uses it. Fix that.
|
||||
REQUIRES_RTTI = 1
|
||||
REQUIRES_EH = 1
|
||||
|
||||
include $(LEVEL)/Makefile.common
|
@ -11,8 +11,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "Record.h"
|
||||
#include "Error.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
#include "llvm/TableGen/Error.h"
|
||||
#include "llvm/Support/DataTypes.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/Format.h"
|
@ -12,7 +12,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "TGLexer.h"
|
||||
#include "Error.h"
|
||||
#include "llvm/TableGen/Error.h"
|
||||
#include "llvm/Support/SourceMgr.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/Config/config.h"
|
@ -12,7 +12,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "TGParser.h"
|
||||
#include "Record.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
@ -15,7 +15,7 @@
|
||||
#define TGPARSER_H
|
||||
|
||||
#include "TGLexer.h"
|
||||
#include "Error.h"
|
||||
#include "llvm/TableGen/Error.h"
|
||||
#include "llvm/ADT/Twine.h"
|
||||
#include "llvm/Support/SourceMgr.h"
|
||||
#include <map>
|
@ -11,8 +11,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "TableGenBackend.h"
|
||||
#include "Record.h"
|
||||
#include "llvm/TableGen/TableGenBackend.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
using namespace llvm;
|
||||
|
||||
void TableGenBackend::EmitSourceFileHeader(const std::string &Desc,
|
@ -18,10 +18,10 @@
|
||||
|
||||
#include "ARMDecoderEmitter.h"
|
||||
#include "CodeGenTarget.h"
|
||||
#include "Record.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
@ -15,9 +15,8 @@
|
||||
#ifndef ARMDECODEREMITTER_H
|
||||
#define ARMDECODEREMITTER_H
|
||||
|
||||
#include "TableGenBackend.h"
|
||||
|
||||
#include "llvm/Support/DataTypes.h"
|
||||
#include "llvm/TableGen/TableGenBackend.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
|
@ -98,8 +98,6 @@
|
||||
|
||||
#include "AsmMatcherEmitter.h"
|
||||
#include "CodeGenTarget.h"
|
||||
#include "Error.h"
|
||||
#include "Record.h"
|
||||
#include "StringMatcher.h"
|
||||
#include "llvm/ADT/OwningPtr.h"
|
||||
#include "llvm/ADT/PointerUnion.h"
|
||||
@ -109,6 +107,8 @@
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/TableGen/Error.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
#include <map>
|
||||
#include <set>
|
||||
using namespace llvm;
|
||||
|
@ -15,7 +15,7 @@
|
||||
#ifndef ASMMATCHER_EMITTER_H
|
||||
#define ASMMATCHER_EMITTER_H
|
||||
|
||||
#include "TableGenBackend.h"
|
||||
#include "llvm/TableGen/TableGenBackend.h"
|
||||
#include <cassert>
|
||||
|
||||
namespace llvm {
|
||||
|
@ -14,13 +14,13 @@
|
||||
|
||||
#include "AsmWriterEmitter.h"
|
||||
#include "AsmWriterInst.h"
|
||||
#include "Error.h"
|
||||
#include "CodeGenTarget.h"
|
||||
#include "Record.h"
|
||||
#include "StringToOffsetTable.h"
|
||||
#include "llvm/ADT/Twine.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include "llvm/TableGen/Error.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
#include <algorithm>
|
||||
using namespace llvm;
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
#ifndef ASMWRITER_EMITTER_H
|
||||
#define ASMWRITER_EMITTER_H
|
||||
|
||||
#include "TableGenBackend.h"
|
||||
#include "llvm/TableGen/TableGenBackend.h"
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
|
@ -13,8 +13,8 @@
|
||||
|
||||
#include "AsmWriterInst.h"
|
||||
#include "CodeGenTarget.h"
|
||||
#include "Record.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
|
@ -25,7 +25,6 @@ add_llvm_utility(tblgen
|
||||
DAGISelMatcher.cpp
|
||||
DisassemblerEmitter.cpp
|
||||
EDEmitter.cpp
|
||||
Error.cpp
|
||||
FastISelEmitter.cpp
|
||||
FixedLenDecoderEmitter.cpp
|
||||
InstrEnumEmitter.cpp
|
||||
@ -34,21 +33,16 @@ add_llvm_utility(tblgen
|
||||
NeonEmitter.cpp
|
||||
OptParserEmitter.cpp
|
||||
PseudoLoweringEmitter.cpp
|
||||
Record.cpp
|
||||
RegisterInfoEmitter.cpp
|
||||
SetTheory.cpp
|
||||
StringMatcher.cpp
|
||||
SubtargetEmitter.cpp
|
||||
TGLexer.cpp
|
||||
TGParser.cpp
|
||||
TGValueTypes.cpp
|
||||
TableGen.cpp
|
||||
TableGenBackend.cpp
|
||||
X86DisassemblerTables.cpp
|
||||
X86RecognizableInstr.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(tblgen LLVMSupport)
|
||||
target_link_libraries(tblgen LLVMSupport LLVMTableGen)
|
||||
if( MINGW )
|
||||
target_link_libraries(tblgen imagehlp psapi)
|
||||
if(CMAKE_SIZEOF_VOID_P MATCHES "8")
|
||||
|
@ -13,8 +13,8 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "CallingConvEmitter.h"
|
||||
#include "Record.h"
|
||||
#include "CodeGenTarget.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
using namespace llvm;
|
||||
|
||||
void CallingConvEmitter::run(raw_ostream &O) {
|
||||
|
@ -15,7 +15,7 @@
|
||||
#ifndef CALLINGCONV_EMITTER_H
|
||||
#define CALLINGCONV_EMITTER_H
|
||||
|
||||
#include "TableGenBackend.h"
|
||||
#include "llvm/TableGen/TableGenBackend.h"
|
||||
#include <cassert>
|
||||
|
||||
namespace llvm {
|
||||
|
@ -14,8 +14,8 @@
|
||||
#ifndef CLANGAST_EMITTER_H
|
||||
#define CLANGAST_EMITTER_H
|
||||
|
||||
#include "TableGenBackend.h"
|
||||
#include "Record.h"
|
||||
#include "llvm/TableGen/TableGenBackend.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
#include <string>
|
||||
#include <cctype>
|
||||
#include <map>
|
||||
|
@ -12,8 +12,8 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "ClangAttrEmitter.h"
|
||||
#include "Record.h"
|
||||
#include "llvm/ADT/StringSwitch.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
#ifndef CLANGATTR_EMITTER_H
|
||||
#define CLANGATTR_EMITTER_H
|
||||
|
||||
#include "TableGenBackend.h"
|
||||
#include "llvm/TableGen/TableGenBackend.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "ClangDiagnosticsEmitter.h"
|
||||
#include "Record.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
#include "llvm/ADT/DenseSet.h"
|
||||
|
@ -14,7 +14,7 @@
|
||||
#ifndef CLANGDIAGS_EMITTER_H
|
||||
#define CLANGDIAGS_EMITTER_H
|
||||
|
||||
#include "TableGenBackend.h"
|
||||
#include "llvm/TableGen/TableGenBackend.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "ClangSACheckersEmitter.h"
|
||||
#include "Record.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
#include "llvm/ADT/DenseSet.h"
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
@ -14,7 +14,7 @@
|
||||
#ifndef CLANGSACHECKERS_EMITTER_H
|
||||
#define CLANGSACHECKERS_EMITTER_H
|
||||
|
||||
#include "TableGenBackend.h"
|
||||
#include "llvm/TableGen/TableGenBackend.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#include "CodeEmitterGen.h"
|
||||
#include "CodeGenTarget.h"
|
||||
#include "Record.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
|
@ -14,7 +14,7 @@
|
||||
#ifndef CODEMITTERGEN_H
|
||||
#define CODEMITTERGEN_H
|
||||
|
||||
#include "TableGenBackend.h"
|
||||
#include "llvm/TableGen/TableGenBackend.h"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
|
@ -13,8 +13,8 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "CodeGenDAGPatterns.h"
|
||||
#include "Error.h"
|
||||
#include "Record.h"
|
||||
#include "llvm/TableGen/Error.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
|
@ -13,8 +13,8 @@
|
||||
|
||||
#include "CodeGenInstruction.h"
|
||||
#include "CodeGenTarget.h"
|
||||
#include "Error.h"
|
||||
#include "Record.h"
|
||||
#include "llvm/TableGen/Error.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
#include "CodeGenRegisters.h"
|
||||
#include "CodeGenTarget.h"
|
||||
#include "Error.h"
|
||||
#include "llvm/TableGen/Error.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
|
@ -15,8 +15,8 @@
|
||||
#ifndef CODEGEN_REGISTERS_H
|
||||
#define CODEGEN_REGISTERS_H
|
||||
|
||||
#include "Record.h"
|
||||
#include "SetTheory.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
#include "llvm/CodeGen/ValueTypes.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/BitVector.h"
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include "CodeGenTarget.h"
|
||||
#include "CodeGenIntrinsics.h"
|
||||
#include "Record.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#include "CodeGenRegisters.h"
|
||||
#include "CodeGenInstruction.h"
|
||||
#include "Record.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <algorithm>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#include "DAGISelEmitter.h"
|
||||
#include "DAGISelMatcher.h"
|
||||
#include "Record.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
using namespace llvm;
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
#ifndef DAGISEL_EMITTER_H
|
||||
#define DAGISEL_EMITTER_H
|
||||
|
||||
#include "TableGenBackend.h"
|
||||
#include "llvm/TableGen/TableGenBackend.h"
|
||||
#include "CodeGenDAGPatterns.h"
|
||||
|
||||
namespace llvm {
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "DAGISelMatcher.h"
|
||||
#include "CodeGenDAGPatterns.h"
|
||||
#include "CodeGenTarget.h"
|
||||
#include "Record.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
using namespace llvm;
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#include "DAGISelMatcher.h"
|
||||
#include "CodeGenDAGPatterns.h"
|
||||
#include "Record.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "DAGISelMatcher.h"
|
||||
#include "CodeGenDAGPatterns.h"
|
||||
#include "CodeGenRegisters.h"
|
||||
#include "Record.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
|
@ -9,12 +9,12 @@
|
||||
|
||||
#include "DisassemblerEmitter.h"
|
||||
#include "CodeGenTarget.h"
|
||||
#include "Error.h"
|
||||
#include "Record.h"
|
||||
#include "X86DisassemblerTables.h"
|
||||
#include "X86RecognizableInstr.h"
|
||||
#include "ARMDecoderEmitter.h"
|
||||
#include "FixedLenDecoderEmitter.h"
|
||||
#include "llvm/TableGen/Error.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::X86Disassembler;
|
||||
|
@ -10,7 +10,7 @@
|
||||
#ifndef DISASSEMBLEREMITTER_H
|
||||
#define DISASSEMBLEREMITTER_H
|
||||
|
||||
#include "TableGenBackend.h"
|
||||
#include "llvm/TableGen/TableGenBackend.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
|
@ -17,8 +17,8 @@
|
||||
|
||||
#include "AsmWriterInst.h"
|
||||
#include "CodeGenTarget.h"
|
||||
#include "Record.h"
|
||||
|
||||
#include "llvm/TableGen/Record.h"
|
||||
#include "llvm/MC/EDInstInfo.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/Format.h"
|
||||
|
@ -16,7 +16,7 @@
|
||||
#ifndef SEMANTIC_INFO_EMITTER_H
|
||||
#define SEMANTIC_INFO_EMITTER_H
|
||||
|
||||
#include "TableGenBackend.h"
|
||||
#include "llvm/TableGen/TableGenBackend.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
|
@ -18,8 +18,8 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "FastISelEmitter.h"
|
||||
#include "Error.h"
|
||||
#include "Record.h"
|
||||
#include "llvm/TableGen/Error.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/VectorExtras.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
|
@ -14,8 +14,8 @@
|
||||
#ifndef FASTISEL_EMITTER_H
|
||||
#define FASTISEL_EMITTER_H
|
||||
|
||||
#include "TableGenBackend.h"
|
||||
#include "CodeGenDAGPatterns.h"
|
||||
#include "llvm/TableGen/TableGenBackend.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include "FixedLenDecoderEmitter.h"
|
||||
#include "CodeGenTarget.h"
|
||||
#include "Record.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
|
@ -16,8 +16,8 @@
|
||||
#define FixedLenDECODEREMITTER_H
|
||||
|
||||
#include "CodeGenTarget.h"
|
||||
#include "TableGenBackend.h"
|
||||
|
||||
#include "llvm/TableGen/TableGenBackend.h"
|
||||
#include "llvm/Support/DataTypes.h"
|
||||
|
||||
namespace llvm {
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
#include "InstrEnumEmitter.h"
|
||||
#include "CodeGenTarget.h"
|
||||
#include "Record.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
#include <cstdio>
|
||||
using namespace llvm;
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
#ifndef INSTRENUM_EMITTER_H
|
||||
#define INSTRENUM_EMITTER_H
|
||||
|
||||
#include "TableGenBackend.h"
|
||||
#include "llvm/TableGen/TableGenBackend.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
#include "InstrInfoEmitter.h"
|
||||
#include "CodeGenTarget.h"
|
||||
#include "Record.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include <algorithm>
|
||||
using namespace llvm;
|
||||
|
@ -15,8 +15,8 @@
|
||||
#ifndef INSTRINFO_EMITTER_H
|
||||
#define INSTRINFO_EMITTER_H
|
||||
|
||||
#include "TableGenBackend.h"
|
||||
#include "CodeGenDAGPatterns.h"
|
||||
#include "llvm/TableGen/TableGenBackend.h"
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
|
@ -13,8 +13,8 @@
|
||||
|
||||
#include "CodeGenTarget.h"
|
||||
#include "IntrinsicEmitter.h"
|
||||
#include "Record.h"
|
||||
#include "StringMatcher.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include <algorithm>
|
||||
using namespace llvm;
|
||||
|
@ -15,7 +15,7 @@
|
||||
#define INTRINSIC_EMITTER_H
|
||||
|
||||
#include "CodeGenIntrinsics.h"
|
||||
#include "TableGenBackend.h"
|
||||
#include "llvm/TableGen/TableGenBackend.h"
|
||||
|
||||
namespace llvm {
|
||||
class IntrinsicEmitter : public TableGenBackend {
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
LEVEL = ../..
|
||||
TOOLNAME = tblgen
|
||||
USEDLIBS = LLVMSupport.a
|
||||
USEDLIBS = LLVMTableGen.a LLVMSupport.a
|
||||
REQUIRES_EH := 1
|
||||
REQUIRES_RTTI := 1
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "NeonEmitter.h"
|
||||
#include "Error.h"
|
||||
#include "llvm/TableGen/Error.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
|
@ -16,8 +16,8 @@
|
||||
#ifndef NEON_EMITTER_H
|
||||
#define NEON_EMITTER_H
|
||||
|
||||
#include "Record.h"
|
||||
#include "TableGenBackend.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
#include "llvm/TableGen/TableGenBackend.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "OptParserEmitter.h"
|
||||
#include "Record.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
using namespace llvm;
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
#ifndef UTILS_TABLEGEN_OPTPARSEREMITTER_H
|
||||
#define UTILS_TABLEGEN_OPTPARSEREMITTER_H
|
||||
|
||||
#include "TableGenBackend.h"
|
||||
#include "llvm/TableGen/TableGenBackend.h"
|
||||
|
||||
namespace llvm {
|
||||
/// OptParserEmitter - This tablegen backend takes an input .td file
|
||||
|
@ -8,10 +8,10 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#define DEBUG_TYPE "pseudo-lowering"
|
||||
#include "Error.h"
|
||||
#include "CodeGenInstruction.h"
|
||||
#include "PseudoLoweringEmitter.h"
|
||||
#include "Record.h"
|
||||
#include "llvm/TableGen/Error.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
#include "llvm/ADT/IndexedMap.h"
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
#include "CodeGenInstruction.h"
|
||||
#include "CodeGenTarget.h"
|
||||
#include "TableGenBackend.h"
|
||||
#include "llvm/TableGen/TableGenBackend.h"
|
||||
#include "llvm/ADT/IndexedMap.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "RegisterInfoEmitter.h"
|
||||
#include "CodeGenTarget.h"
|
||||
#include "CodeGenRegisters.h"
|
||||
#include "Record.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
#include "llvm/ADT/BitVector.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
|
@ -16,7 +16,7 @@
|
||||
#ifndef REGISTER_INFO_EMITTER_H
|
||||
#define REGISTER_INFO_EMITTER_H
|
||||
|
||||
#include "TableGenBackend.h"
|
||||
#include "llvm/TableGen/TableGenBackend.h"
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
|
@ -13,8 +13,8 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "SetTheory.h"
|
||||
#include "Error.h"
|
||||
#include "Record.h"
|
||||
#include "llvm/TableGen/Error.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
#include "llvm/Support/Format.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#include "SubtargetEmitter.h"
|
||||
#include "CodeGenTarget.h"
|
||||
#include "Record.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include <algorithm>
|
||||
|
@ -14,7 +14,7 @@
|
||||
#ifndef SUBTARGET_EMITTER_H
|
||||
#define SUBTARGET_EMITTER_H
|
||||
|
||||
#include "TableGenBackend.h"
|
||||
#include "llvm/TableGen/TableGenBackend.h"
|
||||
#include "llvm/MC/MCInstrItineraries.h"
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===- TableGen.cpp - Top-Level TableGen implementation -------------------===//
|
||||
//===- TableGen.cpp - Top-Level TableGen implementation for LLVM ----------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -7,11 +7,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// TableGen is a tool which can be used to build up a description of something,
|
||||
// then invoke one or more "tablegen backends" to emit information about the
|
||||
// description in some predefined format. In practice, this is used by the LLVM
|
||||
// code generators to automate generation of a code generator through a
|
||||
// high-level description of the target.
|
||||
// This file contains the main function for LLVM's TableGen.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@ -26,28 +22,25 @@
|
||||
#include "DAGISelEmitter.h"
|
||||
#include "DisassemblerEmitter.h"
|
||||
#include "EDEmitter.h"
|
||||
#include "Error.h"
|
||||
#include "FastISelEmitter.h"
|
||||
#include "InstrInfoEmitter.h"
|
||||
#include "IntrinsicEmitter.h"
|
||||
#include "NeonEmitter.h"
|
||||
#include "OptParserEmitter.h"
|
||||
#include "PseudoLoweringEmitter.h"
|
||||
#include "Record.h"
|
||||
#include "RegisterInfoEmitter.h"
|
||||
#include "ARMDecoderEmitter.h"
|
||||
#include "SubtargetEmitter.h"
|
||||
#include "SetTheory.h"
|
||||
#include "TGParser.h"
|
||||
#include "llvm/ADT/OwningPtr.h"
|
||||
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/Support/PrettyStackTrace.h"
|
||||
#include "llvm/Support/ToolOutputFile.h"
|
||||
#include "llvm/Support/Signals.h"
|
||||
#include "llvm/Support/system_error.h"
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include "llvm/TableGen/Error.h"
|
||||
#include "llvm/TableGen/Main.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
#include "llvm/TableGen/TableGenAction.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
enum ActionType {
|
||||
@ -172,197 +165,125 @@ namespace {
|
||||
Class("class", cl::desc("Print Enum list for this class"),
|
||||
cl::value_desc("class name"));
|
||||
|
||||
cl::opt<std::string>
|
||||
OutputFilename("o", cl::desc("Output filename"), cl::value_desc("filename"),
|
||||
cl::init("-"));
|
||||
|
||||
cl::opt<std::string>
|
||||
DependFilename("d", cl::desc("Dependency filename"), cl::value_desc("filename"),
|
||||
cl::init(""));
|
||||
|
||||
cl::opt<std::string>
|
||||
InputFilename(cl::Positional, cl::desc("<input file>"), cl::init("-"));
|
||||
|
||||
cl::list<std::string>
|
||||
IncludeDirs("I", cl::desc("Directory of include files"),
|
||||
cl::value_desc("directory"), cl::Prefix);
|
||||
|
||||
cl::opt<std::string>
|
||||
ClangComponent("clang-component",
|
||||
cl::desc("Only use warnings from specified component"),
|
||||
cl::value_desc("component"), cl::Hidden);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
RecordKeeper Records;
|
||||
|
||||
sys::PrintStackTraceOnErrorSignal();
|
||||
PrettyStackTraceProgram X(argc, argv);
|
||||
cl::ParseCommandLineOptions(argc, argv);
|
||||
|
||||
|
||||
try {
|
||||
// Parse the input file.
|
||||
OwningPtr<MemoryBuffer> File;
|
||||
if (error_code ec = MemoryBuffer::getFileOrSTDIN(InputFilename.c_str(), File)) {
|
||||
errs() << "Could not open input file '" << InputFilename << "': "
|
||||
<< ec.message() <<"\n";
|
||||
return 1;
|
||||
}
|
||||
MemoryBuffer *F = File.take();
|
||||
|
||||
// Tell SrcMgr about this buffer, which is what TGParser will pick up.
|
||||
SrcMgr.AddNewSourceBuffer(F, SMLoc());
|
||||
|
||||
// Record the location of the include directory so that the lexer can find
|
||||
// it later.
|
||||
SrcMgr.setIncludeDirs(IncludeDirs);
|
||||
|
||||
TGParser Parser(SrcMgr, Records);
|
||||
|
||||
if (Parser.ParseFile())
|
||||
return 1;
|
||||
|
||||
std::string Error;
|
||||
tool_output_file Out(OutputFilename.c_str(), Error);
|
||||
if (!Error.empty()) {
|
||||
errs() << argv[0] << ": error opening " << OutputFilename
|
||||
<< ":" << Error << "\n";
|
||||
return 1;
|
||||
}
|
||||
if (!DependFilename.empty()) {
|
||||
if (OutputFilename == "-") {
|
||||
errs() << argv[0] << ": the option -d must be used together with -o\n";
|
||||
return 1;
|
||||
}
|
||||
tool_output_file DepOut(DependFilename.c_str(), Error);
|
||||
if (!Error.empty()) {
|
||||
errs() << argv[0] << ": error opening " << DependFilename
|
||||
<< ":" << Error << "\n";
|
||||
return 1;
|
||||
}
|
||||
DepOut.os() << OutputFilename << ":";
|
||||
const std::vector<std::string> &Dependencies = Parser.getDependencies();
|
||||
for (std::vector<std::string>::const_iterator I = Dependencies.begin(),
|
||||
E = Dependencies.end();
|
||||
I != E; ++I) {
|
||||
DepOut.os() << " " << (*I);
|
||||
}
|
||||
DepOut.os() << "\n";
|
||||
DepOut.keep();
|
||||
}
|
||||
|
||||
class LLVMTableGenAction : public TableGenAction {
|
||||
public:
|
||||
bool operator()(raw_ostream &OS, RecordKeeper &Records) {
|
||||
switch (Action) {
|
||||
case PrintRecords:
|
||||
Out.os() << Records; // No argument, dump all contents
|
||||
OS << Records; // No argument, dump all contents
|
||||
break;
|
||||
case GenEmitter:
|
||||
CodeEmitterGen(Records).run(Out.os());
|
||||
CodeEmitterGen(Records).run(OS);
|
||||
break;
|
||||
case GenRegisterInfo:
|
||||
RegisterInfoEmitter(Records).run(Out.os());
|
||||
RegisterInfoEmitter(Records).run(OS);
|
||||
break;
|
||||
case GenInstrInfo:
|
||||
InstrInfoEmitter(Records).run(Out.os());
|
||||
InstrInfoEmitter(Records).run(OS);
|
||||
break;
|
||||
case GenCallingConv:
|
||||
CallingConvEmitter(Records).run(Out.os());
|
||||
CallingConvEmitter(Records).run(OS);
|
||||
break;
|
||||
case GenAsmWriter:
|
||||
AsmWriterEmitter(Records).run(Out.os());
|
||||
AsmWriterEmitter(Records).run(OS);
|
||||
break;
|
||||
case GenARMDecoder:
|
||||
ARMDecoderEmitter(Records).run(Out.os());
|
||||
ARMDecoderEmitter(Records).run(OS);
|
||||
break;
|
||||
case GenAsmMatcher:
|
||||
AsmMatcherEmitter(Records).run(Out.os());
|
||||
AsmMatcherEmitter(Records).run(OS);
|
||||
break;
|
||||
case GenClangAttrClasses:
|
||||
ClangAttrClassEmitter(Records).run(Out.os());
|
||||
ClangAttrClassEmitter(Records).run(OS);
|
||||
break;
|
||||
case GenClangAttrImpl:
|
||||
ClangAttrImplEmitter(Records).run(Out.os());
|
||||
ClangAttrImplEmitter(Records).run(OS);
|
||||
break;
|
||||
case GenClangAttrList:
|
||||
ClangAttrListEmitter(Records).run(Out.os());
|
||||
ClangAttrListEmitter(Records).run(OS);
|
||||
break;
|
||||
case GenClangAttrPCHRead:
|
||||
ClangAttrPCHReadEmitter(Records).run(Out.os());
|
||||
ClangAttrPCHReadEmitter(Records).run(OS);
|
||||
break;
|
||||
case GenClangAttrPCHWrite:
|
||||
ClangAttrPCHWriteEmitter(Records).run(Out.os());
|
||||
ClangAttrPCHWriteEmitter(Records).run(OS);
|
||||
break;
|
||||
case GenClangAttrSpellingList:
|
||||
ClangAttrSpellingListEmitter(Records).run(Out.os());
|
||||
ClangAttrSpellingListEmitter(Records).run(OS);
|
||||
break;
|
||||
case GenClangAttrLateParsedList:
|
||||
ClangAttrLateParsedListEmitter(Records).run(Out.os());
|
||||
ClangAttrLateParsedListEmitter(Records).run(OS);
|
||||
break;
|
||||
case GenClangDiagsDefs:
|
||||
ClangDiagsDefsEmitter(Records, ClangComponent).run(Out.os());
|
||||
ClangDiagsDefsEmitter(Records, ClangComponent).run(OS);
|
||||
break;
|
||||
case GenClangDiagGroups:
|
||||
ClangDiagGroupsEmitter(Records).run(Out.os());
|
||||
ClangDiagGroupsEmitter(Records).run(OS);
|
||||
break;
|
||||
case GenClangDiagsIndexName:
|
||||
ClangDiagsIndexNameEmitter(Records).run(Out.os());
|
||||
ClangDiagsIndexNameEmitter(Records).run(OS);
|
||||
break;
|
||||
case GenClangDeclNodes:
|
||||
ClangASTNodesEmitter(Records, "Decl", "Decl").run(Out.os());
|
||||
ClangDeclContextEmitter(Records).run(Out.os());
|
||||
ClangASTNodesEmitter(Records, "Decl", "Decl").run(OS);
|
||||
ClangDeclContextEmitter(Records).run(OS);
|
||||
break;
|
||||
case GenClangStmtNodes:
|
||||
ClangASTNodesEmitter(Records, "Stmt", "").run(Out.os());
|
||||
ClangASTNodesEmitter(Records, "Stmt", "").run(OS);
|
||||
break;
|
||||
case GenClangSACheckers:
|
||||
ClangSACheckersEmitter(Records).run(Out.os());
|
||||
ClangSACheckersEmitter(Records).run(OS);
|
||||
break;
|
||||
case GenDisassembler:
|
||||
DisassemblerEmitter(Records).run(Out.os());
|
||||
DisassemblerEmitter(Records).run(OS);
|
||||
break;
|
||||
case GenPseudoLowering:
|
||||
PseudoLoweringEmitter(Records).run(Out.os());
|
||||
PseudoLoweringEmitter(Records).run(OS);
|
||||
break;
|
||||
case GenOptParserDefs:
|
||||
OptParserEmitter(Records, true).run(Out.os());
|
||||
OptParserEmitter(Records, true).run(OS);
|
||||
break;
|
||||
case GenOptParserImpl:
|
||||
OptParserEmitter(Records, false).run(Out.os());
|
||||
OptParserEmitter(Records, false).run(OS);
|
||||
break;
|
||||
case GenDAGISel:
|
||||
DAGISelEmitter(Records).run(Out.os());
|
||||
DAGISelEmitter(Records).run(OS);
|
||||
break;
|
||||
case GenFastISel:
|
||||
FastISelEmitter(Records).run(Out.os());
|
||||
FastISelEmitter(Records).run(OS);
|
||||
break;
|
||||
case GenSubtarget:
|
||||
SubtargetEmitter(Records).run(Out.os());
|
||||
SubtargetEmitter(Records).run(OS);
|
||||
break;
|
||||
case GenIntrinsic:
|
||||
IntrinsicEmitter(Records).run(Out.os());
|
||||
IntrinsicEmitter(Records).run(OS);
|
||||
break;
|
||||
case GenTgtIntrinsic:
|
||||
IntrinsicEmitter(Records, true).run(Out.os());
|
||||
IntrinsicEmitter(Records, true).run(OS);
|
||||
break;
|
||||
case GenEDInfo:
|
||||
EDEmitter(Records).run(Out.os());
|
||||
EDEmitter(Records).run(OS);
|
||||
break;
|
||||
case GenArmNeon:
|
||||
NeonEmitter(Records).run(Out.os());
|
||||
NeonEmitter(Records).run(OS);
|
||||
break;
|
||||
case GenArmNeonSema:
|
||||
NeonEmitter(Records).runHeader(Out.os());
|
||||
NeonEmitter(Records).runHeader(OS);
|
||||
break;
|
||||
case GenArmNeonTest:
|
||||
NeonEmitter(Records).runTests(Out.os());
|
||||
NeonEmitter(Records).runTests(OS);
|
||||
break;
|
||||
case PrintEnums:
|
||||
{
|
||||
std::vector<Record*> Recs = Records.getAllDerivedDefinitions(Class);
|
||||
for (unsigned i = 0, e = Recs.size(); i != e; ++i)
|
||||
Out.os() << Recs[i]->getName() << ", ";
|
||||
Out.os() << "\n";
|
||||
OS << Recs[i]->getName() << ", ";
|
||||
OS << "\n";
|
||||
break;
|
||||
}
|
||||
case PrintSets:
|
||||
@ -371,33 +292,29 @@ int main(int argc, char **argv) {
|
||||
Sets.addFieldExpander("Set", "Elements");
|
||||
std::vector<Record*> Recs = Records.getAllDerivedDefinitions("Set");
|
||||
for (unsigned i = 0, e = Recs.size(); i != e; ++i) {
|
||||
Out.os() << Recs[i]->getName() << " = [";
|
||||
OS << Recs[i]->getName() << " = [";
|
||||
const std::vector<Record*> *Elts = Sets.expand(Recs[i]);
|
||||
assert(Elts && "Couldn't expand Set instance");
|
||||
for (unsigned ei = 0, ee = Elts->size(); ei != ee; ++ei)
|
||||
Out.os() << ' ' << (*Elts)[ei]->getName();
|
||||
Out.os() << " ]\n";
|
||||
OS << ' ' << (*Elts)[ei]->getName();
|
||||
OS << " ]\n";
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
assert(1 && "Invalid Action");
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Declare success.
|
||||
Out.keep();
|
||||
return 0;
|
||||
|
||||
} catch (const TGError &Error) {
|
||||
PrintError(Error);
|
||||
} catch (const std::string &Error) {
|
||||
PrintError(Error);
|
||||
} catch (const char *Error) {
|
||||
PrintError(Error);
|
||||
} catch (...) {
|
||||
errs() << argv[0] << ": Unknown unexpected exception occurred.\n";
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
return 1;
|
||||
int main(int argc, char **argv) {
|
||||
sys::PrintStackTraceOnErrorSignal();
|
||||
PrettyStackTraceProgram X(argc, argv);
|
||||
cl::ParseCommandLineOptions(argc, argv);
|
||||
|
||||
LLVMTableGenAction Action;
|
||||
return TableGenMain(argv[0], Action);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include "X86DisassemblerShared.h"
|
||||
#include "X86DisassemblerTables.h"
|
||||
|
||||
#include "TableGenBackend.h"
|
||||
#include "llvm/TableGen/TableGenBackend.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/Format.h"
|
||||
|
@ -20,8 +20,8 @@
|
||||
#include "X86DisassemblerTables.h"
|
||||
|
||||
#include "CodeGenTarget.h"
|
||||
#include "Record.h"
|
||||
|
||||
#include "llvm/TableGen/Record.h"
|
||||
#include "llvm/Support/DataTypes.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user