You've already forked linux-packaging-mono
acceptance-tests
data
debian
docs
external
Newtonsoft.Json
api-doc-tools
api-snapshot
aspnetwebstack
bdwgc
binary-reference-assemblies
bockbuild
boringssl
cecil
cecil-legacy
corefx
corert
helix-binaries
ikdasm
ikvm
illinker-test-assets
linker
llvm-project
clang
clang-tools-extra
compiler-rt
eng
libcxx
libcxxabi
libunwind
lld
lldb
llvm
bindings
cmake
docs
examples
include
lib
projects
resources
runtimes
scripts
test
tools
unittests
utils
FileCheck
KillTheDoctor
LLVMVisualizers
Misc
PerfectShuffle
TableGen
AsmMatcherEmitter.cpp.REMOVED.git-id
AsmWriterEmitter.cpp
AsmWriterInst.cpp
AsmWriterInst.h
Attributes.cpp
CMakeLists.txt
CTagsEmitter.cpp
CallingConvEmitter.cpp
CodeEmitterGen.cpp
CodeGenDAGPatterns.cpp.REMOVED.git-id
CodeGenDAGPatterns.h
CodeGenHwModes.cpp
CodeGenHwModes.h
CodeGenInstruction.cpp
CodeGenInstruction.h
CodeGenIntrinsics.h
CodeGenMapTable.cpp
CodeGenRegisters.cpp
CodeGenRegisters.h
CodeGenSchedule.cpp
CodeGenSchedule.h
CodeGenTarget.cpp
CodeGenTarget.h
DAGISelEmitter.cpp
DAGISelMatcher.cpp
DAGISelMatcher.h
DAGISelMatcherEmitter.cpp
DAGISelMatcherGen.cpp
DAGISelMatcherOpt.cpp
DFAPacketizerEmitter.cpp
DisassemblerEmitter.cpp
FastISelEmitter.cpp
FixedLenDecoderEmitter.cpp
GlobalISelEmitter.cpp.REMOVED.git-id
InfoByHwMode.cpp
InfoByHwMode.h
InstrDocsEmitter.cpp
InstrInfoEmitter.cpp
IntrinsicEmitter.cpp
LLVMBuild.txt
OptParserEmitter.cpp
PseudoLoweringEmitter.cpp
RegisterBankEmitter.cpp
RegisterInfoEmitter.cpp
SDNodeProperties.cpp
SDNodeProperties.h
SearchableTableEmitter.cpp
SequenceToOffsetTable.h
SubtargetEmitter.cpp
SubtargetFeatureInfo.cpp
SubtargetFeatureInfo.h
TableGen.cpp
TableGenBackends.h
Types.cpp
Types.h
X86DisassemblerShared.h
X86DisassemblerTables.cpp
X86DisassemblerTables.h
X86EVEX2VEXTablesEmitter.cpp
X86FoldTablesEmitter.cpp
X86ModRMFilters.cpp
X86ModRMFilters.h
X86RecognizableInstr.cpp
X86RecognizableInstr.h
tdtags
Target
bugpoint
count
crosstool
docker
emacs
fpcmp
gdb-scripts
git
git-svn
jedit
kate
lint
lit
llvm-build
llvm-lit
not
release
sanitizers
testgen
textmate
unittest
valgrind
vim
vscode
yaml-bench
DSAclean.py
DSAextract.py
GenLibDeps.pl
GetRepositoryPath
GetSourceVersion
LLVMBuild.txt
UpdateCMakeLists.pl
abtest.py
bisect
bisect-skip-count
check-each-file
clang-parse-diagnostics-file
codegen-diff
countloc.sh
create_ladder_graph.py
extract_symbols.py
findmisopt
findoptdiff
findsym.pl
getsrcs.sh
lldbDataFormatters.py
llvm-compilers-check
llvm-gisel-cov.py
llvm-native-gxx
llvm.grm
llvmdo
llvmgrep
makellvm
prepare-code-coverage-artifact.py
schedcover.py
shuffle_fuzz.py
shuffle_select_fuzz_tester.py
sort_includes.py
update_llc_test_checks.py
update_mir_test_checks.py
update_test_checks.py
wciia.py
.arcconfig
.clang-format
.clang-tidy
.gitattributes
.gitignore
CMakeLists.txt
CODE_OWNERS.TXT
CREDITS.TXT
LICENSE.TXT
LLVMBuild.txt
README.txt
RELEASE_TESTERS.TXT
configure
llvm.spec.in
version.txt.in
nuget
openmp
polly
Directory.Build.props
Directory.Build.targets
NuGet.config
azure-pipelines.yml
build.cmd
build.sh
dir.common.props
global.json
llvm.proj
mxe-Win64.cmake.in
nuget-buildtasks
nunit-lite
roslyn-binaries
rx
xunit-binaries
how-to-bump-roslyn-binaries.md
ikvm-native
llvm
m4
man
mcs
mono
msvc
netcore
po
runtime
samples
scripts
support
tools
COPYING.LIB
LICENSE
Makefile.am
Makefile.in
NEWS
README.md
acinclude.m4
aclocal.m4
autogen.sh
code_of_conduct.md
compile
config.guess
config.h.in
config.rpath
config.sub
configure.REMOVED.git-id
configure.ac.REMOVED.git-id
depcomp
install-sh
ltmain.sh.REMOVED.git-id
missing
mkinstalldirs
mono-uninstalled.pc.in
test-driver
winconfig.h
115 lines
3.4 KiB
C++
115 lines
3.4 KiB
C++
![]() |
//===--- CodeGenHwModes.cpp -----------------------------------------------===//
|
||
|
//
|
||
|
// The LLVM Compiler Infrastructure
|
||
|
//
|
||
|
// This file is distributed under the University of Illinois Open Source
|
||
|
// License. See LICENSE.TXT for details.
|
||
|
//
|
||
|
//===----------------------------------------------------------------------===//
|
||
|
// Classes to parse and store HW mode information for instruction selection
|
||
|
//===----------------------------------------------------------------------===//
|
||
|
|
||
|
#include "CodeGenHwModes.h"
|
||
|
#include "llvm/Support/Debug.h"
|
||
|
#include "llvm/Support/raw_ostream.h"
|
||
|
#include "llvm/TableGen/Error.h"
|
||
|
#include "llvm/TableGen/Record.h"
|
||
|
|
||
|
using namespace llvm;
|
||
|
|
||
|
StringRef CodeGenHwModes::DefaultModeName = "DefaultMode";
|
||
|
|
||
|
HwMode::HwMode(Record *R) {
|
||
|
Name = R->getName();
|
||
|
Features = R->getValueAsString("Features");
|
||
|
}
|
||
|
|
||
|
LLVM_DUMP_METHOD
|
||
|
void HwMode::dump() const {
|
||
|
dbgs() << Name << ": " << Features << '\n';
|
||
|
}
|
||
|
|
||
|
HwModeSelect::HwModeSelect(Record *R, CodeGenHwModes &CGH) {
|
||
|
std::vector<Record*> Modes = R->getValueAsListOfDefs("Modes");
|
||
|
std::vector<Record*> Objects = R->getValueAsListOfDefs("Objects");
|
||
|
if (Modes.size() != Objects.size()) {
|
||
|
PrintError(R->getLoc(), "in record " + R->getName() +
|
||
|
" derived from HwModeSelect: the lists Modes and Objects should "
|
||
|
"have the same size");
|
||
|
report_fatal_error("error in target description.");
|
||
|
}
|
||
|
for (unsigned i = 0, e = Modes.size(); i != e; ++i) {
|
||
|
unsigned ModeId = CGH.getHwModeId(Modes[i]->getName());
|
||
|
Items.push_back(std::make_pair(ModeId, Objects[i]));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
LLVM_DUMP_METHOD
|
||
|
void HwModeSelect::dump() const {
|
||
|
dbgs() << '{';
|
||
|
for (const PairType &P : Items)
|
||
|
dbgs() << " (" << P.first << ',' << P.second->getName() << ')';
|
||
|
dbgs() << " }\n";
|
||
|
}
|
||
|
|
||
|
CodeGenHwModes::CodeGenHwModes(RecordKeeper &RK) : Records(RK) {
|
||
|
std::vector<Record*> MRs = Records.getAllDerivedDefinitions("HwMode");
|
||
|
// The default mode needs a definition in the .td sources for TableGen
|
||
|
// to accept references to it. We need to ignore the definition here.
|
||
|
for (auto I = MRs.begin(), E = MRs.end(); I != E; ++I) {
|
||
|
if ((*I)->getName() != DefaultModeName)
|
||
|
continue;
|
||
|
MRs.erase(I);
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
for (Record *R : MRs) {
|
||
|
Modes.emplace_back(R);
|
||
|
unsigned NewId = Modes.size();
|
||
|
ModeIds.insert(std::make_pair(Modes[NewId-1].Name, NewId));
|
||
|
}
|
||
|
|
||
|
std::vector<Record*> MSs = Records.getAllDerivedDefinitions("HwModeSelect");
|
||
|
for (Record *R : MSs) {
|
||
|
auto P = ModeSelects.emplace(std::make_pair(R, HwModeSelect(R, *this)));
|
||
|
assert(P.second);
|
||
|
(void)P;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
unsigned CodeGenHwModes::getHwModeId(StringRef Name) const {
|
||
|
if (Name == DefaultModeName)
|
||
|
return DefaultMode;
|
||
|
auto F = ModeIds.find(Name);
|
||
|
assert(F != ModeIds.end() && "Unknown mode name");
|
||
|
return F->second;
|
||
|
}
|
||
|
|
||
|
const HwModeSelect &CodeGenHwModes::getHwModeSelect(Record *R) const {
|
||
|
auto F = ModeSelects.find(R);
|
||
|
assert(F != ModeSelects.end() && "Record is not a \"mode select\"");
|
||
|
return F->second;
|
||
|
}
|
||
|
|
||
|
LLVM_DUMP_METHOD
|
||
|
void CodeGenHwModes::dump() const {
|
||
|
dbgs() << "Modes: {\n";
|
||
|
for (const HwMode &M : Modes) {
|
||
|
dbgs() << " ";
|
||
|
M.dump();
|
||
|
}
|
||
|
dbgs() << "}\n";
|
||
|
|
||
|
dbgs() << "ModeIds: {\n";
|
||
|
for (const auto &P : ModeIds)
|
||
|
dbgs() << " " << P.first() << " -> " << P.second << '\n';
|
||
|
dbgs() << "}\n";
|
||
|
|
||
|
dbgs() << "ModeSelects: {\n";
|
||
|
for (const auto &P : ModeSelects) {
|
||
|
dbgs() << " " << P.first->getName() << " -> ";
|
||
|
P.second.dump();
|
||
|
}
|
||
|
dbgs() << "}\n";
|
||
|
}
|