llir-opt  0.0.1
Low-Level Post-Link Optimiser for OCaml and C
xtor.h
1 // This file if part of the llir-opt project.
2 // Licensing information can be found in the LICENSE file.
3 // (C) 2018 Nandor Licker. All rights reserved.
4 
5 #pragma once
6 
7 #include <memory>
8 
9 #include <llvm/ADT/ilist_node.h>
10 
11 #include "core/value.h"
12 
13 class Global;
14 class Func;
15 class Prog;
16 
17 
18 
20 class Xtor : public llvm::ilist_node_with_parent<Xtor, Prog> {
21 public:
23  enum class Kind {
24  CTOR,
25  DTOR,
26  };
27 
28 public:
29  Xtor(int priority, Global *g, Kind k);
30 
32  int GetPriority() const { return priority_; }
34  Func *GetFunc() const;
36  Kind GetKind() const { return kind_; }
37 
39  void removeFromParent();
41  void eraseFromParent();
43  Prog *getParent() const { return parent_; }
44 
45 private:
47  int priority_;
49  std::shared_ptr<Use> func_;
51  Kind kind_;
53  Prog *parent_;
54 };
Xtor::removeFromParent
void removeFromParent()
Removes an atom from the data section.
Definition: xtor.cpp:29
Xtor::GetFunc
Func * GetFunc() const
Return the function.
Definition: xtor.cpp:23
Xtor::GetPriority
int GetPriority() const
Returns the priority.
Definition: xtor.h:32
Func
Definition: func.h:30
Xtor::eraseFromParent
void eraseFromParent()
Removes an parent from the data section, erasing it.
Definition: xtor.cpp:35
Xtor::GetKind
Kind GetKind() const
Return the kind.
Definition: xtor.h:36
Xtor::Kind
Kind
Constructor/destructor kinds.
Definition: xtor.h:23
Xtor
Constructor/Destructor information.
Definition: xtor.h:20
Xtor::getParent
Prog * getParent() const
Returns a pointer to the parent program.
Definition: xtor.h:43
Prog
Definition: prog.h:33
Global
Definition: global.h:23