This commit breaks up CodeGen/TargetInfo.cpp into a set of *.cpp files,
one file per target. There are no functional changes, mostly just code moving.
Non-code-moving changes are:
* A virtual destructor has been added to DefaultABIInfo to pin the vtable to a cpp file.
* A few methods of ABIInfo and DefaultABIInfo were split into declaration + definition
in order to reduce the number of transitive includes.
* Several functions that used to be static have been placed in clang::CodeGen
namespace so that they can be accessed from other cpp files.
RFC: https://discourse.llvm.org/t/rfc-splitting-clangs-targetinfo-cpp/69883
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D148094
Follow-up to da54bd230a.
* Add dep to _cg and _sema targets only to CodeGen and Sema,
like with the other Basic clang_tablegen()s
* Make tablegen_headers depend on arm_sme_draft_spec_subject_to_change
so that the header gets installed
This adds all the CodeGen deps all over the place.
I ran
git show 9cfeba5b12b6 > foo2.txt
to get the original patch into a text file and then ran
#!/usr/bin/env python3
import os
in_cmake = False
for l in open('foo2.txt'):
if l.startswith('+++ b/'):
cmake = l[len('+++ b/'):-1]
in_cmake = 'CMakeLists.txt' in cmake
if not in_cmake:
continue
prefix = 'llvm/utils/gn/secondary/'
gn_file = os.path.join(prefix, os.path.dirname(cmake), 'BUILD.gn')
if l.startswith('+ '):
add = l[1:].strip()
if add == 'CodeGen':
try:
with open(gn_file) as f:
contents = f.read()
except:
print(f'skipping {gn_file}')
continue
contents = contents.replace(' deps = [', ' deps = ["//llvm/lib/CodeGen",')
with open(gn_file, 'w') as f:
f.write(contents)
to update all the GN files.
(I manually removed the dep on CodeGen that this added to llvm-min-tblgen.)
Finally, I ran
git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format
to fix up the formatting.
This diff was generated by the following script:
#!/usr/bin/env python3
import os, subprocess
r = subprocess.run('git show --pretty='' --name-only f09cf34d00'.split(),
stdout=subprocess.PIPE, text=True)
for line in r.stdout.splitlines():
if not line.endswith('CMakeLists.txt'): continue
gn = 'llvm/utils/gn/secondary/' + os.path.dirname(line) + '/BUILD.gn'
if not os.path.exists(gn): continue
with open(gn) as f:
contents = f.read()
if contents.count('"//llvm/lib/Support",') == 1:
contents = contents.replace(
'"//llvm/lib/Support",',
'"//llvm/lib/Support", "//llvm/lib/TargetParser",')
elif contents.count(' deps = [') == 1:
contents = contents.replace(
' deps = [',
' deps = [ "//llvm/lib/TargetParser",')
else:
print('needs manual fixup:', gn)
continue
with open(gn, 'w') as f:
f.write(contents)
I then manually fixed up the BUILD.gn files for Support (should not depend on
TargetParser) and TargetParser (should depend on Support) and ran `gn format`
on all touched files.
To avoid using the AST when emitting diagnostics, split the "dontcall"
attribute into "dontcall-warn" and "dontcall-error", and also add the
frontend attribute value as the LLVM attribute value. This gives us all
the information to report diagnostics we need from within the IR (aside
from access to the original source).
One downside is we directly use LLVM's demangler rather than using the
existing Clang diagnostic pretty printing of symbols.
Previous revisions didn't properly declare the new dependencies.
Reviewed By: nickdesaulniers
Differential Revision: https://reviews.llvm.org/D110364