Index: src/llvm2ice.cpp |
diff --git a/src/llvm2ice.cpp b/src/llvm2ice.cpp |
index 822a0ce0389554614f88a2048c7bcc0e1aa5c966..bf7de31a233df13fbae0cdc575e1a709e8c412d8 100644 |
--- a/src/llvm2ice.cpp |
+++ b/src/llvm2ice.cpp |
@@ -16,14 +16,9 @@ |
#include "IceCfg.h" |
#include "IceClFlags.h" |
#include "IceConverter.h" |
-#include "IceDefs.h" |
-#include "IceTargetLowering.h" |
-#include "IceTypes.h" |
#include "PNaClTranslator.h" |
-#include "llvm/IR/Constants.h" |
#include "llvm/IR/LLVMContext.h" |
-#include "llvm/IR/Module.h" |
#include "llvm/IRReader/IRReader.h" |
#include "llvm/Support/CommandLine.h" |
#include "llvm/Support/raw_os_ostream.h" |
@@ -137,7 +132,7 @@ int main(int argc, char **argv) { |
if (BuildOnRead) { |
Ice::PNaClTranslator Translator(&Ctx, Flags); |
Translator.translate(IRFilename); |
- return Translator.getExitStatus(); |
+ return Translator.getErrorStatus(); |
} else { |
// Parse the input LLVM IR file into a module. |
SMDiagnostic Err; |
@@ -155,48 +150,8 @@ int main(int argc, char **argv) { |
return 1; |
} |
- // TODO(stichnot): Move this into IceConverter.cpp. |
- OwningPtr<Ice::TargetGlobalInitLowering> GlobalLowering( |
- Ice::TargetGlobalInitLowering::createLowering(TargetArch, &Ctx)); |
- for (Module::const_global_iterator I = Mod->global_begin(), |
- E = Mod->global_end(); |
- I != E; ++I) { |
- if (!I->hasInitializer()) |
- continue; |
- const Constant *Initializer = I->getInitializer(); |
- Ice::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, DisableTranslation); |
- } |
- GlobalLowering.reset(); |
- |
Ice::Converter Converter(&Ctx, Flags); |
- return Converter.convertToIce(Mod); |
+ Converter.convertToIce(Mod); |
+ return Converter.getErrorStatus(); |
} |
} |