targets.c 1.3 KB

123456789101112131415161718192021222324252627282930
  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. #include "llvm-c/TargetMachine.h"
  14. #include <stdio.h>
  15. int targets_list(void) {
  16. LLVMTargetRef t;
  17. LLVMInitializeAllTargetInfos();
  18. LLVMInitializeAllTargets();
  19. for (t = LLVMGetFirstTarget(); t; t = LLVMGetNextTarget(t)) {
  20. printf("%s", LLVMGetTargetName(t));
  21. if (LLVMTargetHasJIT(t))
  22. printf(" (+jit)");
  23. printf("\n - %s\n", LLVMGetTargetDescription(t));
  24. }
  25. return 0;
  26. }