Clean up exit status and globals procecessing in llvm2ice.
Makes IceTranslator.ExitStatus a boolean (rather than int), and changes
code to check flag when done. Fixes bug introduced in
https://codereview.chromium.org/387023002.
Also cleans up the (Ice) Converter class to handle globals processing,
rathe than doing it in llvm2ice.cpp.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3894
R=stichnot@chromium.org
Review URL: https://codereview.chromium.org/387023002
diff --git a/src/IceConverter.h b/src/IceConverter.h
index dc18e7a..30d3b60 100644
--- a/src/IceConverter.h
+++ b/src/IceConverter.h
@@ -25,11 +25,15 @@
class Converter : public Translator {
public:
Converter(GlobalContext *Ctx, Ice::ClFlags &Flags) : Translator(Ctx, Flags) {}
- /// Converts the LLVM Module to ICE. Returns exit status 0 if successful,
- /// Nonzero otherwise.
- int convertToIce(llvm::Module *Mod);
+ /// Converts the LLVM Module to ICE. Sets exit status to false if successful,
+ /// true otherwise.
+ void convertToIce(llvm::Module *Mod);
private:
+ // Converts globals to ICE, and then machine code.
+ void convertGlobals(llvm::Module *Mod);
+ // Converts functions to ICE, and then machine code.
+ void convertFunctions(llvm::Module *Mod);
Converter(const Converter &) LLVM_DELETED_FUNCTION;
Converter &operator=(const Converter &) LLVM_DELETED_FUNCTION;
};