Anders Waldenborg | 2bef1a6 | 2013-10-23 08:10:20 +0000 | [diff] [blame] | 1 | /*===-- targets.c - tool for testing libLLVM and llvm-c API ---------------===*\ |
| 2 | |* *| |
| 3 | |* The LLVM Compiler Infrastructure *| |
| 4 | |* *| |
| 5 | |* This file is distributed under the University of Illinois Open Source *| |
| 6 | |* License. See LICENSE.TXT for details. *| |
| 7 | |* *| |
| 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 Kramer | 2e13053 | 2016-02-05 13:31:14 +0000 | [diff] [blame] | 17 | int llvm_targets_list(void) { |
NAKAMURA Takumi | 90fd79a | 2013-10-23 17:56:37 +0000 | [diff] [blame] | 18 | LLVMTargetRef t; |
Anders Waldenborg | 2bef1a6 | 2013-10-23 08:10:20 +0000 | [diff] [blame] | 19 | LLVMInitializeAllTargetInfos(); |
| 20 | LLVMInitializeAllTargets(); |
| 21 | |
NAKAMURA Takumi | 90fd79a | 2013-10-23 17:56:37 +0000 | [diff] [blame] | 22 | for (t = LLVMGetFirstTarget(); t; t = LLVMGetNextTarget(t)) { |
Anders Waldenborg | 2bef1a6 | 2013-10-23 08:10:20 +0000 | [diff] [blame] | 23 | printf("%s", LLVMGetTargetName(t)); |
| 24 | if (LLVMTargetHasJIT(t)) |
| 25 | printf(" (+jit)"); |
| 26 | printf("\n - %s\n", LLVMGetTargetDescription(t)); |
| 27 | } |
| 28 | |
| 29 | return 0; |
| 30 | } |