PPCCCState.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. //===---- PPCCCState.h - CCState with PowerPC specific extensions -----------===//
  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. #ifndef PPCCCSTATE_H
  9. #define PPCCCSTATE_H
  10. #include "PPCISelLowering.h"
  11. #include "llvm/ADT/BitVector.h"
  12. #include "llvm/ADT/SmallVector.h"
  13. #include "llvm/CodeGen/CallingConvLower.h"
  14. namespace llvm {
  15. class PPCCCState : public CCState {
  16. public:
  17. void
  18. PreAnalyzeCallOperands(const SmallVectorImpl<ISD::OutputArg> &Outs);
  19. void
  20. PreAnalyzeFormalArguments(const SmallVectorImpl<ISD::InputArg> &Ins);
  21. private:
  22. // Records whether the value has been lowered from an ppcf128.
  23. SmallVector<bool, 4> OriginalArgWasPPCF128;
  24. public:
  25. PPCCCState(CallingConv::ID CC, bool isVarArg, MachineFunction &MF,
  26. SmallVectorImpl<CCValAssign> &locs, LLVMContext &C)
  27. : CCState(CC, isVarArg, MF, locs, C) {}
  28. bool WasOriginalArgPPCF128(unsigned ValNo) { return OriginalArgWasPPCF128[ValNo]; }
  29. void clearWasPPCF128() { OriginalArgWasPPCF128.clear(); }
  30. };
  31. class AIXCCState : public CCState {
  32. private:
  33. BitVector IsFixed;
  34. public:
  35. AIXCCState(CallingConv::ID CC, bool IsVarArg, MachineFunction &MF,
  36. SmallVectorImpl<CCValAssign> &Locs, LLVMContext &C)
  37. : CCState(CC, IsVarArg, MF, Locs, C) {}
  38. void AnalyzeFormalArguments(const SmallVectorImpl<ISD::InputArg> &Ins,
  39. CCAssignFn Fn) {
  40. // All formal arguments are fixed.
  41. IsFixed.resize(Ins.size(), true);
  42. CCState::AnalyzeFormalArguments(Ins, Fn);
  43. }
  44. void AnalyzeCallOperands(const SmallVectorImpl<ISD::OutputArg> &Outs,
  45. CCAssignFn Fn) {
  46. // Record whether the call operand was a fixed argument.
  47. IsFixed.resize(Outs.size(), false);
  48. for (unsigned ValNo = 0, E = Outs.size(); ValNo != E; ++ValNo)
  49. if (Outs[ValNo].IsFixed)
  50. IsFixed.set(ValNo);
  51. CCState::AnalyzeCallOperands(Outs, Fn);
  52. }
  53. bool isFixed(unsigned ValNo) const { return IsFixed.test(ValNo); }
  54. };
  55. } // end namespace llvm
  56. #endif