LoongArchBaseInfo.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //= LoongArchBaseInfo.cpp - Top level definitions for LoongArch MC -*- C++ -*-//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //
  9. // This file implements helper functions for the LoongArch target useful for the
  10. // compiler back-end and the MC libraries.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #include "LoongArchBaseInfo.h"
  14. #include "llvm/ADT/ArrayRef.h"
  15. #include "llvm/ADT/Triple.h"
  16. #include "llvm/MC/MCSubtargetInfo.h"
  17. namespace llvm {
  18. namespace LoongArchABI {
  19. ABI getTargetABI(StringRef ABIName) {
  20. auto TargetABI = StringSwitch<ABI>(ABIName)
  21. .Case("ilp32s", ABI_ILP32S)
  22. .Case("ilp32f", ABI_ILP32F)
  23. .Case("ilp32d", ABI_ILP32D)
  24. .Case("lp64s", ABI_LP64S)
  25. .Case("lp64f", ABI_LP64F)
  26. .Case("lp64d", ABI_LP64D)
  27. .Default(ABI_Unknown);
  28. return TargetABI;
  29. }
  30. // FIXME: other register?
  31. MCRegister getBPReg() { return LoongArch::R31; }
  32. } // end namespace LoongArchABI
  33. } // end namespace llvm