1 //===-- jitcs_callconv.h - --------------------------------------*- C++ -*-===//
4 //===----------------------------------------------------------------------===//
6 #ifndef _JITCS_INT_CALLINGCONVENTION_IMPL_H_
7 #define _JITCS_INT_CALLINGCONVENTION_IMPL_H_
9 #include "jitcs_callingconvention.h"
14 class CallingConventionImpl
: public CallingConvention
{
17 RefOrNull
<const VirtualRegister
> reg
;
22 CallingConventionImpl(const RefCounter
<IMachineInfo
>& m
);
23 virtual ~CallingConventionImpl() = default;
26 virtual RefCounter
<IMachineInfo
> getMachineInfo() const { return _machine
; }
27 virtual size_t getResultCount() const { return _results
.size(); }
28 virtual size_t getParamCount() const { return _params
.size(); }
29 virtual size_t getParamAreaSize() const { return _paramArea
; }
30 virtual SpillSlotInfo
getResultSpillSlotInfo(size_t r
) const { return _results
[r
].save
; }
31 virtual RefOrNull
<const VirtualRegister
> getResultRegister(size_t r
) const { return _results
[r
].reg
; }
32 virtual SpillSlotInfo
getParamSpillSlotInfo(size_t p
) const { return _params
[p
].save
; }
33 virtual RefOrNull
<const VirtualRegister
> getParamRegister(size_t p
) const { return _params
[p
].reg
; }
34 virtual size_t getRequiredStackAlignment() const { return _alignment
; }
35 virtual size_t getRequiredStackAlignmentOffset() const { return _alignmentOffset
; }
36 virtual CallerCalleeStrategyId
getStackCleaningStrategy() const { return _stackCleaning
; }
39 virtual void setTypeInfo(FTSubType
,Slice
<FTTypeId
> res
,Slice
<FTTypeId
> par
);
40 virtual void addResult(const VirtualRegister
*, SpillSlotInfo
);
41 virtual void addParam(const VirtualRegister
*, SpillSlotInfo
);
42 virtual void setStackAlignment(size_t align
, size_t ofs
);
43 virtual void setParamAreaSize(size_t);
44 virtual void setCleanStack(CallerCalleeStrategyId
);
45 //virtual void initSaveResource(uint resNo, CallerCalleeStrategyId);
46 //virtual void changeSaveResource(uint res, CallerCalleeStrategyId);
47 //virtual void finalize();
50 RefCounter
<IMachineInfo
> _machine
;
51 std::vector
<IOParamInfo
> _results
, _params
;
52 //ConstBitmapRef _callerSave, _calleeSave;
53 //std::vector< std::vector<u32> > _callerSaveList, _calleeSaveList;
55 size_t _alignment
, _alignmentOffset
, _paramArea
;
56 CallerCalleeStrategyId _stackCleaning
;
58 std::vector
<FTTypeId
> _outtypes
, _intypes
;
61 } // end of namespace jitcs
64 // _JITCS_INT_CALLINGCONVENTION_IMPL_H_