1 //===-- jitcs_callconv.h - --------------------------------------*- C++ -*-===//
4 //===----------------------------------------------------------------------===//
6 #ifndef _JITCS_CALLINGCONVENTION_H_
7 #define _JITCS_CALLINGCONVENTION_H_
9 #include "jitcs_adt_ref.h"
10 #include "jitcs_adt_refcounter.h"
11 #include "jitcs_adt_slice.h"
12 #include "jitcs_base.h"
13 #include "jitcs_fnctypeinfo.h"
14 #include "jitcs_spillslotinfo.h"
15 #include "jitcs_ids.h"
21 struct VirtualRegister
;
23 enum CallerCalleeStrategyId
{
29 class CallingConvention
{
31 CallingConvention() = default;
32 virtual ~CallingConvention() = default;
35 void dump(MachineDumper
&) const;
38 virtual RefCounter
<IMachineInfo
> getMachineInfo() const = 0;
39 virtual size_t getResultCount() const = 0;
40 virtual size_t getParamCount() const = 0;
41 virtual size_t getParamAreaSize() const = 0;
42 virtual SpillSlotInfo
getResultSpillSlotInfo(size_t r
) const = 0;
43 virtual RefOrNull
<const VirtualRegister
> getResultRegister(size_t r
) const = 0;
44 virtual SpillSlotInfo
getParamSpillSlotInfo(size_t p
) const = 0;
45 virtual RefOrNull
<const VirtualRegister
> getParamRegister(size_t p
) const = 0;
46 virtual size_t getRequiredStackAlignment() const = 0;
47 virtual size_t getRequiredStackAlignmentOffset() const = 0;
48 virtual CallerCalleeStrategyId
getStackCleaningStrategy() const = 0;
50 virtual FTSubType
getSubType() const = 0;
51 virtual FTTypeId
getResultType(size_t r
) const = 0;
52 virtual FTTypeId
getParamType(size_t p
) const = 0;
54 virtual u32
getScratchResources(ResClassId
) const = 0;
55 virtual u32
getReservedResources(ResClassId
) const = 0;
58 virtual void setTypeInfo(FTSubType
,Slice
<FTTypeId
> res
,Slice
<FTTypeId
> par
) = 0;
59 virtual void addResult(const VirtualRegister
*, SpillSlotInfo
) = 0;
60 virtual void addParam(const VirtualRegister
*, SpillSlotInfo
) = 0;
61 virtual void setStackAlignment(size_t align
, size_t ofs
) = 0;
62 virtual void setParamAreaSize(size_t) = 0;
63 virtual void setCleanStack(CallerCalleeStrategyId
) = 0;
64 virtual void setResClassCount(size_t resNo
) = 0;
65 virtual void setScratchResources(ResClassId
, u32
) = 0;
66 virtual void setReservedResources(ResClassId
, u32
) = 0;
69 } // end of namespace jitcs
72 // _JITCS_CALLINGCONVENTION_H_