LRDE Tiger Compiler  1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
codegen.hh
Go to the documentation of this file.
1 
6 #ifndef TARGET_CODEGEN_HH
7 # define TARGET_CODEGEN_HH
8 
9 # include <temp/fwd.hh>
10 # include <tree/fwd.hh>
11 
12 # include <assem/fwd.hh>
13 # include <assem/instrs.hh>
14 
15 # include <frame/fwd.hh>
16 # include <target/fwd.hh>
17 
18 namespace target
19 {
20 
22  class Codegen
23  {
26  public:
28  Codegen(bool rule_trace_p = false);
30  virtual ~Codegen();
36  protected:
38  virtual void codegen(const tree::rStm& root) = 0;
39 
40  public:
42  assem::Instrs& codegen(const tree::rStm& stm, frame::Frame& frame);
43 
49  virtual void fragment_entry_exit_build(assem::ProcFrag& frag) = 0;
50 
51 
56  virtual void frame_build(assem::ProcFrag& frag) const = 0;
57 
58 
64  virtual void rewrite_program(assem::ProcFrag& frag,
65  const temp::temp_set_type& spilled) const = 0;
71  public:
74 
75  protected:
80  public:
82  void emit(assem::Instr* instr);
84  void emit(assem::Instrs instrs);
85 
86  protected:
89 
92 
93  private:
96  }; // class Codegen
97 
98 } // namespace target
99 
100 # include <target/codegen.hxx>
101 
102 #endif // !TARGET_CODEGEN_HH