Add instrinsics from aweinstock314's llvmint as well

This commit is contained in:
Guillaume Gomez 2022-05-15 15:13:48 +02:00
parent e25e2c3b94
commit bac878c9a3

View File

@ -16,7 +16,7 @@ def run_command(command, cwd=None):
def clone_repository(repo_name, path, repo_url, sub_path=None): def clone_repository(repo_name, path, repo_url, sub_path=None):
if os.path.exists(path): if os.path.exists(path):
while True: while True:
choice = input("There is already a `{}` folder, do you want to update it? [y/N]".format(repo_name)) choice = input("There is already a `{}` folder, do you want to update it? [y/N]".format(path))
if choice == "" or choice.lower() == "n": if choice == "" or choice.lower() == "n":
print("Skipping repository update.") print("Skipping repository update.")
return return
@ -159,13 +159,14 @@ def fill_intrinsics(intrinsics, from_intrinsics, all_intrinsics):
all_intrinsics[entry[0]] = entry[1] all_intrinsics[entry[0]] = entry[1]
def update_intrinsics(llvm_path, llvmint): def update_intrinsics(llvm_path, llvmint, llvmint2):
intrinsics_llvm = {} intrinsics_llvm = {}
intrinsics_llvmint = {} intrinsics_llvmint = {}
all_intrinsics = {} all_intrinsics = {}
extract_instrinsics_from_llvm(llvm_path, intrinsics_llvm) extract_instrinsics_from_llvm(llvm_path, intrinsics_llvm)
extract_instrinsics_from_llvmint(llvmint, intrinsics_llvmint) extract_instrinsics_from_llvmint(llvmint, intrinsics_llvmint)
extract_instrinsics_from_llvmint(llvmint2, intrinsics_llvmint)
intrinsics = {} intrinsics = {}
# We give priority to translations from LLVM over the ones from llvmint. # We give priority to translations from LLVM over the ones from llvmint.
@ -208,6 +209,10 @@ def main():
os.path.dirname(os.path.abspath(__file__)), os.path.dirname(os.path.abspath(__file__)),
"llvmint", "llvmint",
) )
llvmint2_path = os.path.join(
os.path.dirname(os.path.abspath(__file__)),
"llvmint-2",
)
# First, we clone the LLVM repository if it's not already here. # First, we clone the LLVM repository if it's not already here.
clone_repository( clone_repository(
@ -221,7 +226,12 @@ def main():
llvmint_path, llvmint_path,
"https://github.com/GuillaumeGomez/llvmint", "https://github.com/GuillaumeGomez/llvmint",
) )
update_intrinsics(llvm_path, llvmint_path) clone_repository(
"llvmint2",
llvmint2_path,
"https://github.com/antoyo/llvmint",
)
update_intrinsics(llvm_path, llvmint_path, llvmint2_path)
if __name__ == "__main__": if __name__ == "__main__":