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 //===-- src/x86/jitcs_int_x86_%(N)_machine.h ----------------------*- C++ -*-===//
19 // X86, %(N)-bit, target machine info.
21 // Copyright (C) 2013-2014 Dirk Steinke.
22 // See copyright and license notice in COPYRIGHT or include/jitcs.h
23 //===----------------------------------------------------------------------===//
25 #ifndef _JITCS_INT_X86_%(N)_MACHINE_H_
26 #define _JITCS_INT_X86_%(N)_MACHINE_H_
28 #include "jitcs_machine.h"
29 #include "jitcs_int_machine.h"
30 #include "jitcs_x86_%(N).h"
34 class CallingConvention;
40 class X86_%(N)MachineInfo : public IMachineInfo, public IMachineDetails {
42 enum ABIEnum { ABI_Win, ABI_Posix };
44 X86_%(N)MachineInfo(ABIEnum, bool asHost = false);
46 X86_%(N)MachineInfo() = delete;
47 X86_%(N)MachineInfo(const X86_%(N)MachineInfo&) = delete;
48 X86_%(N)MachineInfo& operator =(const X86_%(N)MachineInfo&) = delete;
51 virtual Ref<const IMachineDetails> details() const { return this; }
52 /*[[override]]*/ virtual std::shared_ptr<const CallingConvention>
53 getCC(FTSubType, Slice<FTTypeId>, Slice<FTTypeId>);
55 //static std::string GetInsName(InsId id);
56 //static std::string GetRegName(RegId r);
57 //static std::string GetRegClassName(RegClassId r);
58 //static void dump(IDumper&, Ref<Instruction>, const Function&);
60 virtual Ref<const VirtualRegister> stackFrameRegister() const;
62 virtual ResId getResOfReg(RegId r) const;
63 virtual RegClassId getRegClassOfReg(RegId r) const;
64 virtual ResClassId getResClassOfReg(RegId r) const;
66 virtual RegClassId getRegClassCount() const;
67 virtual ResClassId getResClassOfRegClass(RegClassId rc) const;
68 virtual u32 getLogSizeOfRegClass(RegClassId rc) const;
69 virtual u32 getDontAllocOfRegClass(RegClassId rc) const;
71 virtual ResId getResCount() const;
72 virtual ResClassId getResClassOfRes(ResId r) const;
73 virtual RegId getRegIdForRes(RegClassId rc, ResId res) const;
75 virtual ResClassId getResClassCount() const;
76 virtual u32 getResIndexOfResClass(ResClassId r) const;
79 virtual size_t getInsIdInfo(InsId) const;
81 virtual void buildCtrlFlow(Ref<Instruction> ins, Ref<BasicBlockImpl> src) const;
83 virtual void extractDefUse(Slice<const Instruction*> insns,
84 Ref<const BasicBlockImpl> bb,
85 SetupBlockResourceInfo& dfh) const ;
87 virtual size_t estimateCodeSize(Slice<const Instruction*> insns,
88 Ref<const BasicBlockImpl> bb,
89 CodeGenerator& cg) const;
90 virtual Slice<u8> generateCode(Slice<u8> space,
91 Slice<const Instruction*> insns,
92 Ref<const BasicBlockImpl> bb,
93 CodeGenerator& cg) const;
95 RefOrNull<const BasicBlockImpl> getFailedFallthru
96 (Ref<const Instruction> ins, Ref<const BasicBlockImpl> src) const;
97 void handleSymbol(RefOrNull<Symbol>, int ofs, RefOrNull<u8> symboltail, Ref<u8> instail,
98 CodeGenerator& cg) const;
103 } // end of namespace jitcs::x86_%(N)
104 } // end of namespace jitcs
107 // _JITCS_INT_X86_%(N)_MACHINE_H_