mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-30 00:16:48 +00:00
Fix a FIXME by making GlobalVariable::getInitializer() return a
const Constant *. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133400 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -465,8 +465,8 @@ namespace llvm {
|
|||||||
void EmitJumpTableEntry(const MachineJumpTableInfo *MJTI,
|
void EmitJumpTableEntry(const MachineJumpTableInfo *MJTI,
|
||||||
const MachineBasicBlock *MBB,
|
const MachineBasicBlock *MBB,
|
||||||
unsigned uid) const;
|
unsigned uid) const;
|
||||||
void EmitLLVMUsedList(Constant *List);
|
void EmitLLVMUsedList(const Constant *List);
|
||||||
void EmitXXStructorList(Constant *List);
|
void EmitXXStructorList(const Constant *List);
|
||||||
GCMetadataPrinter *GetOrCreateGCPrinter(GCStrategy *C);
|
GCMetadataPrinter *GetOrCreateGCPrinter(GCStrategy *C);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ public:
|
|||||||
/// illegal to call this method if the global is external, because we cannot
|
/// illegal to call this method if the global is external, because we cannot
|
||||||
/// tell what the value is initialized to!
|
/// tell what the value is initialized to!
|
||||||
///
|
///
|
||||||
inline /*const FIXME*/ Constant *getInitializer() const {
|
inline const Constant *getInitializer() const {
|
||||||
assert(hasInitializer() && "GV doesn't have initializer!");
|
assert(hasInitializer() && "GV doesn't have initializer!");
|
||||||
return static_cast<Constant*>(Op<0>().get());
|
return static_cast<Constant*>(Op<0>().get());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1211,9 +1211,9 @@ bool AsmPrinter::EmitSpecialLLVMGlobal(const GlobalVariable *GV) {
|
|||||||
/// EmitLLVMUsedList - For targets that define a MAI::UsedDirective, mark each
|
/// EmitLLVMUsedList - For targets that define a MAI::UsedDirective, mark each
|
||||||
/// global in the specified llvm.used list for which emitUsedDirectiveFor
|
/// global in the specified llvm.used list for which emitUsedDirectiveFor
|
||||||
/// is true, as being used with this directive.
|
/// is true, as being used with this directive.
|
||||||
void AsmPrinter::EmitLLVMUsedList(Constant *List) {
|
void AsmPrinter::EmitLLVMUsedList(const Constant *List) {
|
||||||
// Should be an array of 'i8*'.
|
// Should be an array of 'i8*'.
|
||||||
ConstantArray *InitList = dyn_cast<ConstantArray>(List);
|
const ConstantArray *InitList = dyn_cast<ConstantArray>(List);
|
||||||
if (InitList == 0) return;
|
if (InitList == 0) return;
|
||||||
|
|
||||||
for (unsigned i = 0, e = InitList->getNumOperands(); i != e; ++i) {
|
for (unsigned i = 0, e = InitList->getNumOperands(); i != e; ++i) {
|
||||||
@@ -1226,11 +1226,11 @@ void AsmPrinter::EmitLLVMUsedList(Constant *List) {
|
|||||||
|
|
||||||
/// EmitXXStructorList - Emit the ctor or dtor list. This just prints out the
|
/// EmitXXStructorList - Emit the ctor or dtor list. This just prints out the
|
||||||
/// function pointers, ignoring the init priority.
|
/// function pointers, ignoring the init priority.
|
||||||
void AsmPrinter::EmitXXStructorList(Constant *List) {
|
void AsmPrinter::EmitXXStructorList(const Constant *List) {
|
||||||
// Should be an array of '{ int, void ()* }' structs. The first value is the
|
// Should be an array of '{ int, void ()* }' structs. The first value is the
|
||||||
// init priority, which we ignore.
|
// init priority, which we ignore.
|
||||||
if (!isa<ConstantArray>(List)) return;
|
if (!isa<ConstantArray>(List)) return;
|
||||||
ConstantArray *InitList = cast<ConstantArray>(List);
|
const ConstantArray *InitList = cast<ConstantArray>(List);
|
||||||
for (unsigned i = 0, e = InitList->getNumOperands(); i != e; ++i)
|
for (unsigned i = 0, e = InitList->getNumOperands(); i != e; ++i)
|
||||||
if (ConstantStruct *CS = dyn_cast<ConstantStruct>(InitList->getOperand(i))){
|
if (ConstantStruct *CS = dyn_cast<ConstantStruct>(InitList->getOperand(i))){
|
||||||
if (CS->getNumOperands() != 2) return; // Not array of 2-element structs.
|
if (CS->getNumOperands() != 2) return; // Not array of 2-element structs.
|
||||||
|
|||||||
@@ -659,11 +659,11 @@ bool ELFWriter::EmitSpecialLLVMGlobal(const GlobalVariable *GV) {
|
|||||||
|
|
||||||
/// EmitXXStructorList - Emit the ctor or dtor list. This just emits out the
|
/// EmitXXStructorList - Emit the ctor or dtor list. This just emits out the
|
||||||
/// function pointers, ignoring the init priority.
|
/// function pointers, ignoring the init priority.
|
||||||
void ELFWriter::EmitXXStructorList(Constant *List, ELFSection &Xtor) {
|
void ELFWriter::EmitXXStructorList(const Constant *List, ELFSection &Xtor) {
|
||||||
// Should be an array of '{ i32, void ()* }' structs. The first value is the
|
// Should be an array of '{ i32, void ()* }' structs. The first value is the
|
||||||
// init priority, which we ignore.
|
// init priority, which we ignore.
|
||||||
if (List->isNullValue()) return;
|
if (List->isNullValue()) return;
|
||||||
ConstantArray *InitList = cast<ConstantArray>(List);
|
const ConstantArray *InitList = cast<ConstantArray>(List);
|
||||||
for (unsigned i = 0, e = InitList->getNumOperands(); i != e; ++i) {
|
for (unsigned i = 0, e = InitList->getNumOperands(); i != e; ++i) {
|
||||||
if (InitList->getOperand(i)->isNullValue())
|
if (InitList->getOperand(i)->isNullValue())
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ namespace llvm {
|
|||||||
void EmitGlobalDataRelocation(const GlobalValue *GV, unsigned Size,
|
void EmitGlobalDataRelocation(const GlobalValue *GV, unsigned Size,
|
||||||
ELFSection &GblS, int64_t Offset = 0);
|
ELFSection &GblS, int64_t Offset = 0);
|
||||||
bool EmitSpecialLLVMGlobal(const GlobalVariable *GV);
|
bool EmitSpecialLLVMGlobal(const GlobalVariable *GV);
|
||||||
void EmitXXStructorList(Constant *List, ELFSection &Xtor);
|
void EmitXXStructorList(const Constant *List, ELFSection &Xtor);
|
||||||
void EmitRelocations();
|
void EmitRelocations();
|
||||||
void EmitRelocation(BinaryObject &RelSec, ELFRelocation &Rel, bool HasRelA);
|
void EmitRelocation(BinaryObject &RelSec, ELFRelocation &Rel, bool HasRelA);
|
||||||
void EmitSectionHeader(BinaryObject &SHdrTab, const ELFSection &SHdr);
|
void EmitSectionHeader(BinaryObject &SHdrTab, const ELFSection &SHdr);
|
||||||
|
|||||||
@@ -989,12 +989,12 @@ void CppWriter::printVariableUses(const GlobalVariable *GV) {
|
|||||||
nl(Out);
|
nl(Out);
|
||||||
printType(GV->getType());
|
printType(GV->getType());
|
||||||
if (GV->hasInitializer()) {
|
if (GV->hasInitializer()) {
|
||||||
Constant *Init = GV->getInitializer();
|
const Constant *Init = GV->getInitializer();
|
||||||
printType(Init->getType());
|
printType(Init->getType());
|
||||||
if (Function *F = dyn_cast<Function>(Init)) {
|
if (const Function *F = dyn_cast<Function>(Init)) {
|
||||||
nl(Out)<< "/ Function Declarations"; nl(Out);
|
nl(Out)<< "/ Function Declarations"; nl(Out);
|
||||||
printFunctionHead(F);
|
printFunctionHead(F);
|
||||||
} else if (GlobalVariable* gv = dyn_cast<GlobalVariable>(Init)) {
|
} else if (const GlobalVariable* gv = dyn_cast<GlobalVariable>(Init)) {
|
||||||
nl(Out) << "// Global Variable Declarations"; nl(Out);
|
nl(Out) << "// Global Variable Declarations"; nl(Out);
|
||||||
printVariableHead(gv);
|
printVariableHead(gv);
|
||||||
|
|
||||||
|
|||||||
@@ -346,7 +346,7 @@ void PTXAsmPrinter::EmitVariableDeclaration(const GlobalVariable *gv) {
|
|||||||
|
|
||||||
if (gv->hasInitializer())
|
if (gv->hasInitializer())
|
||||||
{
|
{
|
||||||
Constant *C = gv->getInitializer();
|
const Constant *C = gv->getInitializer();
|
||||||
if (const ConstantArray *CA = dyn_cast<ConstantArray>(C))
|
if (const ConstantArray *CA = dyn_cast<ConstantArray>(C))
|
||||||
{
|
{
|
||||||
decl += " = {";
|
decl += " = {";
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ TargetLoweringObjectFile::~TargetLoweringObjectFile() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool isSuitableForBSS(const GlobalVariable *GV) {
|
static bool isSuitableForBSS(const GlobalVariable *GV) {
|
||||||
Constant *C = GV->getInitializer();
|
const Constant *C = GV->getInitializer();
|
||||||
|
|
||||||
// Must have zero initializer.
|
// Must have zero initializer.
|
||||||
if (!C->isNullValue())
|
if (!C->isNullValue())
|
||||||
@@ -168,7 +168,7 @@ SectionKind TargetLoweringObjectFile::getKindForGlobal(const GlobalValue *GV,
|
|||||||
return SectionKind::getBSS();
|
return SectionKind::getBSS();
|
||||||
}
|
}
|
||||||
|
|
||||||
Constant *C = GVar->getInitializer();
|
const Constant *C = GVar->getInitializer();
|
||||||
|
|
||||||
// If the global is marked constant, we can put it into a mergable section,
|
// If the global is marked constant, we can put it into a mergable section,
|
||||||
// a mergable string section, or general .data if it contains relocations.
|
// a mergable string section, or general .data if it contains relocations.
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ void XCoreAsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
|
|||||||
|
|
||||||
|
|
||||||
MCSymbol *GVSym = Mang->getSymbol(GV);
|
MCSymbol *GVSym = Mang->getSymbol(GV);
|
||||||
Constant *C = GV->getInitializer();
|
const Constant *C = GV->getInitializer();
|
||||||
unsigned Align = (unsigned)TD->getPreferredTypeAlignmentShift(C->getType());
|
unsigned Align = (unsigned)TD->getPreferredTypeAlignmentShift(C->getType());
|
||||||
|
|
||||||
// Mark the start of the global
|
// Mark the start of the global
|
||||||
|
|||||||
Reference in New Issue
Block a user