1e682b80bSStrahinja Petrovic //===---- PPCCCState.h - CCState with PowerPC specific extensions -----------===// 2e682b80bSStrahinja Petrovic // 32946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 42946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information. 52946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6e682b80bSStrahinja Petrovic // 7e682b80bSStrahinja Petrovic //===----------------------------------------------------------------------===// 8e682b80bSStrahinja Petrovic 9e682b80bSStrahinja Petrovic #ifndef PPCCCSTATE_H 10e682b80bSStrahinja Petrovic #define PPCCCSTATE_H 11e682b80bSStrahinja Petrovic 12e682b80bSStrahinja Petrovic #include "PPCISelLowering.h" 13*aaeffbe0SSean Fertile #include "llvm/ADT/BitVector.h" 14e682b80bSStrahinja Petrovic #include "llvm/ADT/SmallVector.h" 15e682b80bSStrahinja Petrovic #include "llvm/CodeGen/CallingConvLower.h" 16e682b80bSStrahinja Petrovic 17e682b80bSStrahinja Petrovic namespace llvm { 18e682b80bSStrahinja Petrovic 19e682b80bSStrahinja Petrovic class PPCCCState : public CCState { 20e682b80bSStrahinja Petrovic public: 21e682b80bSStrahinja Petrovic 22e682b80bSStrahinja Petrovic void 23e682b80bSStrahinja Petrovic PreAnalyzeCallOperands(const SmallVectorImpl<ISD::OutputArg> &Outs); 24e682b80bSStrahinja Petrovic void 25e682b80bSStrahinja Petrovic PreAnalyzeFormalArguments(const SmallVectorImpl<ISD::InputArg> &Ins); 26e682b80bSStrahinja Petrovic 27e682b80bSStrahinja Petrovic private: 28e682b80bSStrahinja Petrovic 29e682b80bSStrahinja Petrovic // Records whether the value has been lowered from an ppcf128. 30e682b80bSStrahinja Petrovic SmallVector<bool, 4> OriginalArgWasPPCF128; 31e682b80bSStrahinja Petrovic 32e682b80bSStrahinja Petrovic public: PPCCCState(CallingConv::ID CC,bool isVarArg,MachineFunction & MF,SmallVectorImpl<CCValAssign> & locs,LLVMContext & C)33e682b80bSStrahinja Petrovic PPCCCState(CallingConv::ID CC, bool isVarArg, MachineFunction &MF, 34e682b80bSStrahinja Petrovic SmallVectorImpl<CCValAssign> &locs, LLVMContext &C) 35e682b80bSStrahinja Petrovic : CCState(CC, isVarArg, MF, locs, C) {} 36e682b80bSStrahinja Petrovic WasOriginalArgPPCF128(unsigned ValNo)37e682b80bSStrahinja Petrovic bool WasOriginalArgPPCF128(unsigned ValNo) { return OriginalArgWasPPCF128[ValNo]; } clearWasPPCF128()38e682b80bSStrahinja Petrovic void clearWasPPCF128() { OriginalArgWasPPCF128.clear(); } 39e682b80bSStrahinja Petrovic }; 40*aaeffbe0SSean Fertile 41*aaeffbe0SSean Fertile class AIXCCState : public CCState { 42*aaeffbe0SSean Fertile private: 43*aaeffbe0SSean Fertile BitVector IsFixed; 44*aaeffbe0SSean Fertile 45*aaeffbe0SSean Fertile public: AIXCCState(CallingConv::ID CC,bool IsVarArg,MachineFunction & MF,SmallVectorImpl<CCValAssign> & Locs,LLVMContext & C)46*aaeffbe0SSean Fertile AIXCCState(CallingConv::ID CC, bool IsVarArg, MachineFunction &MF, 47*aaeffbe0SSean Fertile SmallVectorImpl<CCValAssign> &Locs, LLVMContext &C) 48*aaeffbe0SSean Fertile : CCState(CC, IsVarArg, MF, Locs, C) {} 49*aaeffbe0SSean Fertile AnalyzeFormalArguments(const SmallVectorImpl<ISD::InputArg> & Ins,CCAssignFn Fn)50*aaeffbe0SSean Fertile void AnalyzeFormalArguments(const SmallVectorImpl<ISD::InputArg> &Ins, 51*aaeffbe0SSean Fertile CCAssignFn Fn) { 52*aaeffbe0SSean Fertile // All formal arguments are fixed. 53*aaeffbe0SSean Fertile IsFixed.resize(Ins.size(), true); 54*aaeffbe0SSean Fertile CCState::AnalyzeFormalArguments(Ins, Fn); 55e682b80bSStrahinja Petrovic } 56e682b80bSStrahinja Petrovic AnalyzeCallOperands(const SmallVectorImpl<ISD::OutputArg> & Outs,CCAssignFn Fn)57*aaeffbe0SSean Fertile void AnalyzeCallOperands(const SmallVectorImpl<ISD::OutputArg> &Outs, 58*aaeffbe0SSean Fertile CCAssignFn Fn) { 59*aaeffbe0SSean Fertile // Record whether the call operand was a fixed argument. 60*aaeffbe0SSean Fertile IsFixed.resize(Outs.size(), false); 61*aaeffbe0SSean Fertile for (unsigned ValNo = 0, E = Outs.size(); ValNo != E; ++ValNo) 62*aaeffbe0SSean Fertile if (Outs[ValNo].IsFixed) 63*aaeffbe0SSean Fertile IsFixed.set(ValNo); 64*aaeffbe0SSean Fertile 65*aaeffbe0SSean Fertile CCState::AnalyzeCallOperands(Outs, Fn); 66*aaeffbe0SSean Fertile } 67*aaeffbe0SSean Fertile isFixed(unsigned ValNo)68*aaeffbe0SSean Fertile bool isFixed(unsigned ValNo) const { return IsFixed.test(ValNo); } 69*aaeffbe0SSean Fertile }; 70*aaeffbe0SSean Fertile 71*aaeffbe0SSean Fertile } // end namespace llvm 72*aaeffbe0SSean Fertile 73e682b80bSStrahinja Petrovic #endif 74