The check to see if an item was already on the heap was randomly hitting.
[jitcs.git] / include / jitcs_callingconvention.h
blobfab7959a7fe1ab4c416cc7a9798d71a5b82624d2
1 //===-- jitcs_callconv.h - --------------------------------------*- C++ -*-===//
2 //
3 //
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"
16 #include <memory>
18 namespace jitcs {
19 class MachineDumper;
20 class IMachineInfo;
21 struct VirtualRegister;
23 enum CallerCalleeStrategyId {
24 CCS_Scratch,
25 CCS_ByCaller,
26 CCS_ByCallee,
29 class CallingConvention {
30 public:
31 CallingConvention() = default;
32 virtual ~CallingConvention() = default;
34 public:
35 void dump(MachineDumper&) const;
37 public:
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;
57 public:
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
71 #endif
72 // _JITCS_CALLINGCONVENTION_H_