Index: src/IceTargetLoweringX8632.cpp |
diff --git a/src/IceTargetLoweringX8632.cpp b/src/IceTargetLoweringX8632.cpp |
index 343113cfeeb16f74ef321bc4dc7867a16567e6ba..07d1867bbc0eb066744c2415b0c3061fd5f09457 100644 |
--- a/src/IceTargetLoweringX8632.cpp |
+++ b/src/IceTargetLoweringX8632.cpp |
@@ -4427,7 +4427,7 @@ void ConstantUndef::emit(GlobalContext *) const { |
TargetGlobalInitX8632::TargetGlobalInitX8632(GlobalContext *Ctx) |
: TargetGlobalInitLowering(Ctx) {} |
-void TargetGlobalInitX8632::lower(const GlobalAddress &Global, |
+void TargetGlobalInitX8632::lower(const GlobalVariable &Global, |
bool DisableTranslation) { |
if (Ctx->isVerbose()) { |
Global.dump(Ctx->getStrDump()); |
@@ -4442,17 +4442,15 @@ void TargetGlobalInitX8632::lower(const GlobalAddress &Global, |
// will allow us to cross test relocations for references to external |
// global variables. |
- const GlobalAddress::InitializerListType &Initializers = |
+ const GlobalVariable::InitializerListType &Initializers = |
Global.getInitializers(); |
assert(Initializers.size()); |
- bool HasInitializer = |
- !(Initializers.size() == 1 && |
- llvm::isa<GlobalAddress::ZeroInitializer>(Initializers[0])); |
+ bool HasInitializer = Global.hasInitializer(); |
bool IsConstant = Global.getIsConstant(); |
- bool IsExternal = !Global.getIsInternal(); |
+ bool IsExternal = Global.getIsExternal(); |
uint32_t Align = Global.getAlignment(); |
SizeT Size = Global.getNumBytes(); |
- IceString MangledName = Ctx->mangleName(Global.getName()); |
+ IceString MangledName = Global.mangleName(Ctx); |
IceString SectionSuffix = ""; |
if (Ctx->getFlags().DataSections) |
SectionSuffix = "." + MangledName; |
@@ -4483,29 +4481,25 @@ void TargetGlobalInitX8632::lower(const GlobalAddress &Global, |
Str << "\t.comm\t" << MangledName << "," << Size << "," << Align << "\n"; |
if (HasInitializer) { |
- for (GlobalAddress::Initializer *Init : Initializers) { |
+ for (GlobalVariable::Initializer *Init : Initializers) { |
switch (Init->getKind()) { |
- case GlobalAddress::Initializer::DataInitializerKind: { |
+ case GlobalVariable::Initializer::DataInitializerKind: { |
const auto Data = |
- llvm::cast<GlobalAddress::DataInitializer>(Init)->getContents(); |
+ llvm::cast<GlobalVariable::DataInitializer>(Init)->getContents(); |
for (SizeT i = 0; i < Init->getNumBytes(); ++i) { |
Str << "\t.byte\t" << (((unsigned)Data[i]) & 0xff) << "\n"; |
} |
break; |
} |
- case GlobalAddress::Initializer::ZeroInitializerKind: |
+ case GlobalVariable::Initializer::ZeroInitializerKind: |
Str << "\t.zero\t" << Init->getNumBytes() << "\n"; |
break; |
- case GlobalAddress::Initializer::RelocInitializerKind: { |
- const auto Reloc = llvm::cast<GlobalAddress::RelocInitializer>(Init); |
+ case GlobalVariable::Initializer::RelocInitializerKind: { |
+ const auto Reloc = llvm::cast<GlobalVariable::RelocInitializer>(Init); |
Str << "\t.long\t"; |
- // TODO(kschimpf): Once the representation of a relocation has |
- // been modified to reference the corresponding global |
- // address, modify to not mangle the name if the global is |
- // external and uninitialized. This will allow us to better |
- // test cross test relocations. |
- Str << Ctx->mangleName(Reloc->getName()); |
- if (GlobalAddress::RelocOffsetType Offset = Reloc->getOffset()) { |
+ const GlobalAddress *RelocAddr = Reloc->getAddress(); |
+ Str << RelocAddr->mangleName(Ctx); |
+ if (GlobalVariable::RelocOffsetType Offset = Reloc->getOffset()) { |
Str << " + " << Offset; |
} |
Str << "\n"; |