The check to see if an item was already on the heap was randomly hitting.
[jitcs.git] / include / jitcs_function.h
blob516241663897cddf0536c1ec8a4b3f42d9cbf47c
1 //===-- jitcs_function.h - a representation of a function -------*- C++ -*-===//
2 //
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.
6 //
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"
18 namespace jitcs {
19 class BasicBlock;
20 class CallingConvention;
21 class MachineDumper;
22 struct VirtualRegister;
24 class Function {
25 public:
26 enum Strategy {
27 Direct_Code_Gen,
28 One_Pass_Linear_Scan,
29 Two_Pass_Linear_Scan,
31 public:
32 ~Function();
33 // this should make it impossible to actually create an object of type
34 // Function.
35 Function() = delete;
36 Function(const Function &) = delete;
37 void operator=(const Function &) = delete;
39 public:
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);
50 public:
51 //void check();
52 //void clean();
53 void dump(MachineDumper&) const;
55 Ref<BasicBlock> getStartBlock();
56 Ref<BasicBlock> createBasicBlock();
58 public:
59 MemoryMgr::CodeAndData generate(RefCounter<MemoryMgr>, Strategy);
62 } // End jitcs namespace
64 #endif
65 // _JITCS_FUNCTION_H_