llir-opt
0.0.1
Low-Level Post-Link Optimiser for OCaml and C
|
10 #include <llvm/ADT/StringRef.h>
11 #include <llvm/Support/Alignment.h>
13 #include "core/user.h"
14 #include "core/visibility.h"
40 const std::string_view name,
41 Visibility visibility = Visibility::LOCAL,
52 const std::string_view
GetName()
const {
return name_; }
54 llvm::StringRef
getName()
const {
return name_; }
57 virtual std::optional<llvm::Align>
GetAlignment()
const = 0;
80 virtual void dump(llvm::raw_ostream &os = llvm::errs())
const = 0;
89 Visibility visibility_;
virtual void removeFromParent()=0
Removes the global from the parent container.
virtual Prog * getProg()=0
Returns the program to which the global belongs.
Visibility GetVisibility() const
Returns the visibilty of a global.
Definition: global.h:62
bool IsRoot() const
Checks if the symbol can be externally referenced.
Definition: global.cpp:30
Kind
Enumeration of global kinds.
Definition: global.h:30
bool IsWeak() const
Checks if a symbol is weak.
Definition: global.cpp:64
virtual void dump(llvm::raw_ostream &os=llvm::errs()) const =0
Dumps the representation of the function.
virtual std::optional< llvm::Align > GetAlignment() const =0
Externs have no known alignment.
const std::string_view GetName() const
Returns the name of the global.
Definition: global.h:52
bool Is(Kind kind) const
Checks if the global is of a specific kind.
Definition: global.h:49
Kind
Enumeration of value types.
Definition: value.h:133
llvm::StringRef getName() const
Returns the name of the basic block for LLVM.
Definition: global.h:54
Kind GetKind() const
Returns the kind of the global.
Definition: global.h:47
bool IsLocal() const
Checks if the global is hidden in the compilation unit.
Definition: global.cpp:47
static constexpr Value::Kind kValueKind
Kind of the global.
Definition: global.h:26
virtual void eraseFromParent()=0
Removes the global from the parent container, deleting it.
void SetVisibility(Visibility visibility)
Sets the visibilty of the global.
Definition: global.h:60