1 #/bin/emblua LUAPREFIX=/*|
7 /*| function pred_ipairs(t, pred)
8 /*| return function(t,k)
13 /*| until not v or pred(k, v)
17 /*| function isaN(k,v) return not v[N==32 and "x64" or "x32"] end
18 //===-- jitcs_x86_%(N)_machine.h - Machine info -------------------*- C++ -*-===//
20 //===----------------------------------------------------------------------===//
22 #ifndef _JITCS_INT_X86_%(N)_MACHINE_H_
23 #define _JITCS_INT_X86_%(N)_MACHINE_H_
25 #include "jitcs_machine.h"
26 #include "jitcs_int_machine.h"
27 #include "jitcs_x86_%(N).h"
31 class CallingConvention;
37 class X86_%(N)MachineInfo : public IMachineInfo, public IMachineDetails {
39 enum ABIEnum { ABI_Win, ABI_Posix };
41 X86_%(N)MachineInfo(ABIEnum, bool asHost = false);
43 X86_%(N)MachineInfo() = delete;
44 X86_%(N)MachineInfo(const X86_%(N)MachineInfo&) = delete;
45 X86_%(N)MachineInfo& operator =(const X86_%(N)MachineInfo&) = delete;
48 virtual Ref<const IMachineDetails> details() const { return this; }
49 /*[[override]]*/ virtual std::shared_ptr<const CallingConvention>
50 getCC(FTSubType, Slice<FTTypeId>, Slice<FTTypeId>);
52 //static std::string GetInsName(InsId id);
53 //static std::string GetRegName(RegId r);
54 //static std::string GetRegClassName(RegClassId r);
55 //static void dump(IDumper&, Ref<Instruction>, const Function&);
57 virtual Ref<const VirtualRegister> stackFrameRegister() const;
59 virtual ResId getResOfReg(RegId r) const;
60 virtual RegClassId getRegClassOfReg(RegId r) const;
61 virtual ResClassId getResClassOfReg(RegId r) const;
63 virtual RegClassId getRegClassCount() const;
64 virtual ResClassId getResClassOfRegClass(RegClassId rc) const;
65 virtual u32 getLogSizeOfRegClass(RegClassId rc) const;
66 virtual u32 getDontAllocOfRegClass(RegClassId rc) const;
68 virtual ResId getResCount() const;
69 virtual ResClassId getResClassOfRes(ResId r) const;
70 virtual RegId getRegIdForRes(RegClassId rc, ResId res) const;
72 virtual ResClassId getResClassCount() const;
73 virtual u32 getResIndexOfResClass(ResClassId r) const;
76 virtual size_t getInsIdInfo(InsId) const;
78 virtual void buildCtrlFlow(Ref<Instruction> ins, Ref<BasicBlockImpl> src) const;
80 virtual void extractDefUse(Slice<const Instruction*> insns,
81 Ref<const BasicBlockImpl> bb,
82 SetupBlockResourceInfo& dfh) const ;
84 virtual size_t estimateCodeSize(Slice<const Instruction*> insns,
85 Ref<const BasicBlockImpl> bb,
86 CodeGenerator& cg) const;
87 virtual Slice<u8> generateCode(Slice<u8> space,
88 Slice<const Instruction*> insns,
89 Ref<const BasicBlockImpl> bb,
90 CodeGenerator& cg) const;
92 RefOrNull<const BasicBlockImpl> getFailedFallthru
93 (Ref<const Instruction> ins, Ref<const BasicBlockImpl> src) const;
94 void handleSymbol(RefOrNull<Symbol>, int ofs, RefOrNull<u8> symboltail, Ref<u8> instail,
95 CodeGenerator& cg) const;
100 } // end of namespace jitcs::x86_%(N)
101 } // end of namespace jitcs
104 // _JITCS_INT_X86_%(N)_MACHINE_H_