1 //===-- jitcs_function.h - a representation of a function -------*- C++ -*-===//
3 // The Function class is an interface to the actual function provided by the
4 // library. All implementation details are hidden from outside users.
5 // Enumeration of basic blocks and virtual registers is possible, but slow.
7 //===----------------------------------------------------------------------===//
9 #ifndef _JITCS_FUNCTION_H_
10 #define _JITCS_FUNCTION_H_
12 #include "jitcs_adt_enumerator.h"
13 #include "jitcs_adt_ref.h"
14 #include "jitcs_base.h"
15 #include "jitcs_ids.h"
16 #include "jitcs_memmgr.h"
20 class CallingConvention
;
22 struct VirtualRegister
;
32 // factory method to hide implementation detail
33 //static std::unique_ptr<Function> Create(TempAllocator& ins, const std::shared_ptr<const CallingConvention>& cc);
37 // this should make it impossible to actually create an object of type
40 Function(const Function
&) = delete;
41 void operator=(const Function
&) = delete;
44 Enumerator
<const BasicBlock
> enumerateBasicBlocks();
45 //Enumerator<const VirtualRegister> enumerateVirtualRegisters();
46 std::shared_ptr
<const CallingConvention
> getCallingConvention() const;
47 //RefOrNull<VirtualRegister> getArgumentRegister(uint n);
48 //RefOrNull<VirtualRegister> getResultRegister(uint n);
53 void dump(IMachineDumper
&) const;
55 Ref
<BasicBlock
> getStartBlock();
56 Ref
<BasicBlock
> createBasicBlock();
58 //Ref<VirtualRegister> createVirtualRegister(RegClassId regclass, int sz = 0);
59 //Ref<VirtualRegister> allocateTemporary(Ref<VirtualRegister> compatibleTo);
60 //void deallocateTemporary(Ref<VirtualRegister> id);
63 //MemMgr::CodeAndData generate(MemMgr&, Strategy, RefOrNull<IMachineDumper>);
66 } // End jitcs namespace