* PIC codegen for X86/Linux has been implemented

* PIC-aware internal structures in X86 Codegen have been refactored
* Visibility (default/weak) has been added
* Docs fixes (external weak linkage, visibility, formatting)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33136 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Anton Korobeynikov
2007-01-12 19:20:47 +00:00
parent ab7752c149
commit 7f70559bc4
31 changed files with 607 additions and 178 deletions

View File

@@ -112,6 +112,7 @@ public:
const Type* ElemType, ///< The type of the global variable
bool isConstant, ///< Whether the GV is constant or not
GlobalValue::LinkageTypes,///< The linkage type of the GV
GlobalValue::VisibilityTypes,///< The visibility style of the GV
unsigned SlotNum, ///< Slot number of GV
unsigned initSlot ///< Slot number of GV's initializer (0 if none)
) {}

View File

@@ -38,14 +38,19 @@ public:
ExternalWeakLinkage, /// ExternalWeak linkage description
GhostLinkage /// Stand-in functions for streaming fns from BC files
};
enum VisibilityTypes {
DefaultVisibility,
HiddenVisibility
};
protected:
GlobalValue(const Type *Ty, ValueTy vty, Use *Ops, unsigned NumOps,
LinkageTypes linkage, const std::string &name = "")
: Constant(Ty, vty, Ops, NumOps, name),
Parent(0), Linkage(linkage), Alignment(0) { }
: Constant(Ty, vty, Ops, NumOps, name), Parent(0),
Linkage(linkage), Visibility(DefaultVisibility), Alignment(0) { }
Module *Parent;
LinkageTypes Linkage; // The linkage of this global
VisibilityTypes Visibility; // The visibility style of this global
unsigned Alignment; // Alignment of this symbol, must be power of two
std::string Section; // Section to emit this into, empty mean default
public:
@@ -58,6 +63,10 @@ public:
assert((Align & (Align-1)) == 0 && "Alignment is not a power of 2!");
Alignment = Align;
}
VisibilityTypes getVisibility() const { return Visibility; }
bool hasHiddenVisibility() const { return Visibility == HiddenVisibility; }
void setVisibility(VisibilityTypes V) { Visibility = V; }
bool hasSection() const { return !Section.empty(); }
const std::string &getSection() const { return Section; }