ARMSelectionDAGInfo.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. //===-- ARMSelectionDAGInfo.h - ARM SelectionDAG Info -----------*- 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 defines the ARM subclass for SelectionDAGTargetInfo.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. #ifndef LLVM_LIB_TARGET_ARM_ARMSELECTIONDAGINFO_H
  13. #define LLVM_LIB_TARGET_ARM_ARMSELECTIONDAGINFO_H
  14. #include "MCTargetDesc/ARMAddressingModes.h"
  15. #include "llvm/CodeGen/RuntimeLibcalls.h"
  16. #include "llvm/CodeGen/SelectionDAGTargetInfo.h"
  17. namespace llvm {
  18. namespace ARM_AM {
  19. static inline ShiftOpc getShiftOpcForNode(unsigned Opcode) {
  20. switch (Opcode) {
  21. default: return ARM_AM::no_shift;
  22. case ISD::SHL: return ARM_AM::lsl;
  23. case ISD::SRL: return ARM_AM::lsr;
  24. case ISD::SRA: return ARM_AM::asr;
  25. case ISD::ROTR: return ARM_AM::ror;
  26. //case ISD::ROTL: // Only if imm -> turn into ROTR.
  27. // Can't handle RRX here, because it would require folding a flag into
  28. // the addressing mode. :( This causes us to miss certain things.
  29. //case ARMISD::RRX: return ARM_AM::rrx;
  30. }
  31. }
  32. } // end namespace ARM_AM
  33. class ARMSelectionDAGInfo : public SelectionDAGTargetInfo {
  34. public:
  35. SDValue EmitTargetCodeForMemcpy(SelectionDAG &DAG, const SDLoc &dl,
  36. SDValue Chain, SDValue Dst, SDValue Src,
  37. SDValue Size, Align Alignment,
  38. bool isVolatile, bool AlwaysInline,
  39. MachinePointerInfo DstPtrInfo,
  40. MachinePointerInfo SrcPtrInfo) const override;
  41. SDValue
  42. EmitTargetCodeForMemmove(SelectionDAG &DAG, const SDLoc &dl, SDValue Chain,
  43. SDValue Dst, SDValue Src, SDValue Size,
  44. Align Alignment, bool isVolatile,
  45. MachinePointerInfo DstPtrInfo,
  46. MachinePointerInfo SrcPtrInfo) const override;
  47. // Adjust parameters for memset, see RTABI section 4.3.4
  48. SDValue EmitTargetCodeForMemset(SelectionDAG &DAG, const SDLoc &dl,
  49. SDValue Chain, SDValue Op1, SDValue Op2,
  50. SDValue Op3, Align Alignment, bool isVolatile,
  51. bool AlwaysInline,
  52. MachinePointerInfo DstPtrInfo) const override;
  53. SDValue EmitSpecializedLibcall(SelectionDAG &DAG, const SDLoc &dl,
  54. SDValue Chain, SDValue Dst, SDValue Src,
  55. SDValue Size, unsigned Align,
  56. RTLIB::Libcall LC) const;
  57. };
  58. }
  59. #endif