LRDE Tiger Compiler  1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
instrs.hh
Go to the documentation of this file.
1 
6 #ifndef ASSEM_INSTRS_HH
7 # define ASSEM_INSTRS_HH
8 
9 # include <iosfwd>
10 # include <list>
11 
12 # include <assem/fwd.hh>
13 
14 namespace assem
15 {
16 
17  /* FIXME: assem::Instrs shall not derive from std::list. This class
18  has only move semantics, whereas std::list has both move *and*
19  copy semantics. This is a form of inheritance by restriction,
20  which is usually bad practice. */
21 
26  class Instrs : public std::list<Instr*>
27  {
28  public:
30  typedef std::list<Instr*> super_type;
31 
32  Instrs() = default;
33  Instrs(std::initializer_list<Instr*> l);
34 
37  Instrs(const Instrs&) = delete;
38  Instrs& operator=(const Instrs&) = delete;
40 
43  Instrs(Instrs&&) = default;
44  Instrs& operator=(Instrs&&) = default;
46 
47  virtual ~Instrs();
48 
50  iterator label_find(const temp::Label &l);
51 
53  virtual std::ostream& dump(std::ostream& ostr) const;
54  };
55 
57  std::ostream&
58  operator<< (std::ostream& ostr, const Instrs& instrs);
59 
60 } // namespace assem
61 
62 #endif // !ASSEM_INSTRS_HH