blob: 685598e1a5eaa4b79c594c5bb0996fc134859e0c [file] [log] [blame]
Anders Waldenborgb932c662013-10-23 08:10:20 +00001/*===-- targets.c - tool for testing libLLVM and llvm-c API ---------------===*\
2|* *|
Chandler Carruth2946cd72019-01-19 08:50:56 +00003|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
4|* Exceptions. *|
5|* See https://llvm.org/LICENSE.txt for license information. *|
6|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
Anders Waldenborgb932c662013-10-23 08:10:20 +00007|* *|
8|*===----------------------------------------------------------------------===*|
9|* *|
10|* This file implements the --targets command in llvm-c-test. *|
11|* *|
12\*===----------------------------------------------------------------------===*/
13
14#include "llvm-c/TargetMachine.h"
15#include <stdio.h>
16
Benjamin Kramer9a3bd232016-02-05 13:31:14 +000017int llvm_targets_list(void) {
NAKAMURA Takumic4914692013-10-23 17:56:37 +000018 LLVMTargetRef t;
Anders Waldenborgb932c662013-10-23 08:10:20 +000019 LLVMInitializeAllTargetInfos();
20 LLVMInitializeAllTargets();
21
NAKAMURA Takumic4914692013-10-23 17:56:37 +000022 for (t = LLVMGetFirstTarget(); t; t = LLVMGetNextTarget(t)) {
Anders Waldenborgb932c662013-10-23 08:10:20 +000023 printf("%s", LLVMGetTargetName(t));
24 if (LLVMTargetHasJIT(t))
25 printf(" (+jit)");
26 printf("\n - %s\n", LLVMGetTargetDescription(t));
27 }
28
29 return 0;
30}