mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-29 10:32:47 +00:00
Added instance variable/initializers/getter/setters for new keyword externally initialized to GlobalVariable. No *TRUE* functionality change.
I am going to add in the actual test cases with the actual functionality changes in a later patch because I want to include some test cases. To be clear when I say no *TRUE* functionality change I mean that this patch (like it says in the title) only contains getters/setters and sets up a default initial value of the instance variable to false so that this patch does not affect any other uses of Global Variable.h. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174295 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f841064592
commit
af2f494c2d
@ -40,9 +40,14 @@ class GlobalVariable : public GlobalValue, public ilist_node<GlobalVariable> {
|
||||
|
||||
void setParent(Module *parent);
|
||||
|
||||
bool isConstantGlobal : 1; // Is this a global constant?
|
||||
unsigned threadLocalMode : 3; // Is this symbol "Thread Local",
|
||||
// if so, what is the desired model?
|
||||
bool isConstantGlobal : 1; // Is this a global constant?
|
||||
unsigned threadLocalMode : 3; // Is this symbol "Thread Local",
|
||||
// if so, what is the desired
|
||||
// model?
|
||||
bool isExternallyInitializedConstant : 1; // Is this a global whose value
|
||||
// can change from its initial
|
||||
// value before global
|
||||
// initializers are run?
|
||||
|
||||
public:
|
||||
// allocate space for exactly one operand
|
||||
@ -62,15 +67,15 @@ public:
|
||||
/// automatically inserted into the end of the specified modules global list.
|
||||
GlobalVariable(Type *Ty, bool isConstant, LinkageTypes Linkage,
|
||||
Constant *Initializer = 0, const Twine &Name = "",
|
||||
ThreadLocalMode = NotThreadLocal, unsigned AddressSpace = 0);
|
||||
ThreadLocalMode = NotThreadLocal, unsigned AddressSpace = 0,
|
||||
bool isExternallyInitialized = false);
|
||||
/// GlobalVariable ctor - This creates a global and inserts it before the
|
||||
/// specified other global.
|
||||
GlobalVariable(Module &M, Type *Ty, bool isConstant,
|
||||
LinkageTypes Linkage, Constant *Initializer,
|
||||
const Twine &Name = "",
|
||||
GlobalVariable *InsertBefore = 0,
|
||||
ThreadLocalMode = NotThreadLocal,
|
||||
unsigned AddressSpace = 0);
|
||||
const Twine &Name = "", GlobalVariable *InsertBefore = 0,
|
||||
ThreadLocalMode = NotThreadLocal, unsigned AddressSpace = 0,
|
||||
bool isExternallyInitialized = false);
|
||||
|
||||
~GlobalVariable() {
|
||||
NumOperands = 1; // FIXME: needed by operator delete
|
||||
@ -155,6 +160,13 @@ public:
|
||||
return static_cast<ThreadLocalMode>(threadLocalMode);
|
||||
}
|
||||
|
||||
bool isExternallyInitialized() const {
|
||||
return isExternallyInitializedConstant;
|
||||
}
|
||||
void setExternallyInitialized(bool Val) {
|
||||
isExternallyInitializedConstant = Val;
|
||||
}
|
||||
|
||||
/// copyAttributesFrom - copy all additional attributes (those not needed to
|
||||
/// create a GlobalVariable) from the GlobalVariable Src to this one.
|
||||
void copyAttributesFrom(const GlobalValue *Src);
|
||||
|
@ -82,13 +82,16 @@ bool GlobalValue::isDeclaration() const {
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
GlobalVariable::GlobalVariable(Type *Ty, bool constant, LinkageTypes Link,
|
||||
Constant *InitVal, const Twine &Name,
|
||||
ThreadLocalMode TLMode, unsigned AddressSpace)
|
||||
Constant *InitVal,
|
||||
const Twine &Name, ThreadLocalMode TLMode,
|
||||
unsigned AddressSpace,
|
||||
bool isExternallyInitialized)
|
||||
: GlobalValue(PointerType::get(Ty, AddressSpace),
|
||||
Value::GlobalVariableVal,
|
||||
OperandTraits<GlobalVariable>::op_begin(this),
|
||||
InitVal != 0, Link, Name),
|
||||
isConstantGlobal(constant), threadLocalMode(TLMode) {
|
||||
isConstantGlobal(constant), threadLocalMode(TLMode),
|
||||
isExternallyInitializedConstant(isExternallyInitialized) {
|
||||
if (InitVal) {
|
||||
assert(InitVal->getType() == Ty &&
|
||||
"Initializer should be the same type as the GlobalVariable!");
|
||||
@ -102,12 +105,14 @@ GlobalVariable::GlobalVariable(Module &M, Type *Ty, bool constant,
|
||||
LinkageTypes Link, Constant *InitVal,
|
||||
const Twine &Name,
|
||||
GlobalVariable *Before, ThreadLocalMode TLMode,
|
||||
unsigned AddressSpace)
|
||||
unsigned AddressSpace,
|
||||
bool isExternallyInitialized)
|
||||
: GlobalValue(PointerType::get(Ty, AddressSpace),
|
||||
Value::GlobalVariableVal,
|
||||
OperandTraits<GlobalVariable>::op_begin(this),
|
||||
InitVal != 0, Link, Name),
|
||||
isConstantGlobal(constant), threadLocalMode(TLMode) {
|
||||
isConstantGlobal(constant), threadLocalMode(TLMode),
|
||||
isExternallyInitializedConstant(isExternallyInitialized) {
|
||||
if (InitVal) {
|
||||
assert(InitVal->getType() == Ty &&
|
||||
"Initializer should be the same type as the GlobalVariable!");
|
||||
|
Loading…
Reference in New Issue
Block a user