[llvm-commits] CVS: llvm/include/llvm/Function.h GlobalValue.h GlobalVariable.h
Chris Lattner
lattner at cs.uiuc.edu
Wed Apr 16 15:30:00 PDT 2003
Changes in directory llvm/include/llvm:
Function.h updated: 1.40 -> 1.41
GlobalValue.h updated: 1.8 -> 1.9
GlobalVariable.h updated: 1.18 -> 1.19
---
Log message:
Add new linkage types to support a real frontend
---
Diffs of the changes:
Index: llvm/include/llvm/Function.h
diff -u llvm/include/llvm/Function.h:1.40 llvm/include/llvm/Function.h:1.41
--- llvm/include/llvm/Function.h:1.40 Wed Nov 20 12:31:31 2002
+++ llvm/include/llvm/Function.h Wed Apr 16 15:28:30 2003
@@ -71,8 +71,8 @@
/// function is automatically inserted into the end of the function list for
/// the module.
///
- Function(const FunctionType *Ty, bool isInternal, const std::string &N = "",
- Module *M = 0);
+ Function(const FunctionType *Ty, LinkageTypes Linkage,
+ const std::string &N = "", Module *M = 0);
~Function();
// Specialize setName to handle symbol table majik...
Index: llvm/include/llvm/GlobalValue.h
diff -u llvm/include/llvm/GlobalValue.h:1.8 llvm/include/llvm/GlobalValue.h:1.9
--- llvm/include/llvm/GlobalValue.h:1.8 Wed Oct 9 18:11:33 2002
+++ llvm/include/llvm/GlobalValue.h Wed Apr 16 15:28:30 2003
@@ -16,12 +16,19 @@
class GlobalValue : public User {
GlobalValue(const GlobalValue &); // do not implement
+public:
+ enum LinkageTypes {
+ ExternalLinkage, // Externally visible function
+ LinkOnceLinkage, // Keep one copy of named function when linking (inline)
+ AppendingLinkage, // Special purpose, only applies to global arrays
+ InternalLinkage // Rename collisions when linking (static functions)
+ };
protected:
- GlobalValue(const Type *Ty, ValueTy vty, bool hasInternalLinkage,
+ GlobalValue(const Type *Ty, ValueTy vty, LinkageTypes linkage,
const std::string &name = "")
- : User(Ty, vty, name), HasInternalLinkage(hasInternalLinkage), Parent(0) {}
+ : User(Ty, vty, name), Linkage(linkage), Parent(0) {}
- bool HasInternalLinkage; // Is this value accessable externally?
+ LinkageTypes Linkage; // The linkage of this global
Module *Parent;
public:
~GlobalValue() {}
@@ -31,10 +38,12 @@
return (const PointerType*)User::getType();
}
- /// Internal Linkage - True if the global value is inaccessible to
- bool hasInternalLinkage() const { return HasInternalLinkage; }
- bool hasExternalLinkage() const { return !HasInternalLinkage; }
- void setInternalLinkage(bool HIL) { HasInternalLinkage = HIL; }
+ bool hasExternalLinkage() const { return Linkage == ExternalLinkage; }
+ bool hasLinkOnceLinkage() const { return Linkage == LinkOnceLinkage; }
+ bool hasAppendingLinkage() const { return Linkage == AppendingLinkage; }
+ bool hasInternalLinkage() const { return Linkage == InternalLinkage; }
+ void setLinkage(LinkageTypes LT) { Linkage = LT; }
+ LinkageTypes getLinkage() const { return Linkage; }
/// isExternal - Return true if the primary definition of this global value is
/// outside of the current translation unit...
Index: llvm/include/llvm/GlobalVariable.h
diff -u llvm/include/llvm/GlobalVariable.h:1.18 llvm/include/llvm/GlobalVariable.h:1.19
--- llvm/include/llvm/GlobalVariable.h:1.18 Sun Feb 2 10:40:40 2003
+++ llvm/include/llvm/GlobalVariable.h Wed Apr 16 15:28:30 2003
@@ -35,7 +35,7 @@
/// GlobalVariable ctor - If a parent module is specified, the global is
/// automatically inserted into the end of the specified modules global list.
///
- GlobalVariable(const Type *Ty, bool isConstant, bool isInternal,
+ GlobalVariable(const Type *Ty, bool isConstant, LinkageTypes Linkage,
Constant *Initializer = 0, const std::string &Name = "",
Module *Parent = 0);
More information about the llvm-commits
mailing list