Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Unified Diff: src/IceConverter.cpp

Issue 587893003: Test generation of global initializers in Subzero bitcode reader. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix nit Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceConverter.h ('k') | src/IceTranslator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceConverter.cpp
diff --git a/src/IceConverter.cpp b/src/IceConverter.cpp
index ec797c19144055955d68ea31958e737f385b5aa7..9991ab214bb652d0cc0738674eb687cea6075882 100644
--- a/src/IceConverter.cpp
+++ b/src/IceConverter.cpp
@@ -627,53 +627,10 @@ namespace Ice {
void Converter::convertToIce() {
nameUnnamedGlobalAddresses(Mod);
if (!Ctx->getFlags().DisableGlobals)
- convertGlobals();
+ convertGlobals(Mod);
convertFunctions();
}
-void Converter::convertGlobals() {
- OwningPtr<TargetGlobalInitLowering> GlobalLowering(
- TargetGlobalInitLowering::createLowering(Ctx->getTargetArch(), Ctx));
- for (Module::const_global_iterator I = Mod->global_begin(),
- E = Mod->global_end();
- I != E; ++I) {
- if (!I->hasInitializer())
- continue;
- const llvm::Constant *Initializer = I->getInitializer();
- IceString Name = I->getName();
- unsigned Align = I->getAlignment();
- uint64_t NumElements = 0;
- const char *Data = NULL;
- bool IsInternal = I->hasInternalLinkage();
- bool IsConst = I->isConstant();
- bool IsZeroInitializer = false;
-
- if (const ConstantDataArray *CDA =
- dyn_cast<ConstantDataArray>(Initializer)) {
- NumElements = CDA->getNumElements();
- assert(isa<IntegerType>(CDA->getElementType()) &&
- cast<IntegerType>(CDA->getElementType())->getBitWidth() == 8);
- Data = CDA->getRawDataValues().data();
- } else if (isa<ConstantAggregateZero>(Initializer)) {
- if (const ArrayType *AT = dyn_cast<ArrayType>(Initializer->getType())) {
- assert(isa<IntegerType>(AT->getElementType()) &&
- cast<IntegerType>(AT->getElementType())->getBitWidth() == 8);
- NumElements = AT->getNumElements();
- IsZeroInitializer = true;
- } else {
- llvm_unreachable("Unhandled constant aggregate zero type");
- }
- } else {
- llvm_unreachable("Unhandled global initializer");
- }
-
- GlobalLowering->lower(Name, Align, IsInternal, IsConst, IsZeroInitializer,
- NumElements, Data,
- Ctx->getFlags().DisableTranslation);
- }
- GlobalLowering.reset();
-}
-
void Converter::convertFunctions() {
for (Module::const_iterator I = Mod->begin(), E = Mod->end(); I != E; ++I) {
if (I->empty())
« no previous file with comments | « src/IceConverter.h ('k') | src/IceTranslator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698