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
;
33 // this should make it impossible to actually create an object of type
36 Function(const Function
&) = delete;
37 void operator=(const Function
&) = delete;
40 Enumerator
<const BasicBlock
> enumerateBasicBlocks();
41 //Enumerator<const VirtualRegister> enumerateVirtualRegisters();
42 std::shared_ptr
<const CallingConvention
> getCallingConvention() const;
43 Ref
<const VirtualRegister
> getArgumentRegister(uint n
, RegClassId
);
44 Ref
<const VirtualRegister
> getResultRegister(uint n
, RegClassId
);
45 Ref
<const VirtualRegister
> createRegister(RegClassId
, int logSz
= 0);
47 //Ref<VirtualRegister> allocateTemporary(Ref<VirtualRegister> compatibleTo);
48 //void deallocateTemporary(Ref<VirtualRegister> id);
53 void dump(MachineDumper
&) const;
55 Ref
<BasicBlock
> getStartBlock();
56 Ref
<BasicBlock
> createBasicBlock();
59 MemoryMgr::CodeAndData
generate(RefCounter
<MemoryMgr
>, Strategy
);
62 } // End jitcs namespace