Index: src/PNaClTranslator.cpp |
diff --git a/src/PNaClTranslator.cpp b/src/PNaClTranslator.cpp |
index bd25da72af5ba960c9b99b6f74a226cf2b900cfe..42d169a734025a59ceafce00852fc6d9f405287f 100644 |
--- a/src/PNaClTranslator.cpp |
+++ b/src/PNaClTranslator.cpp |
@@ -18,7 +18,6 @@ |
#include "llvm/Bitcode/NaCl/NaClBitcodeParser.h" |
#include "llvm/Bitcode/NaCl/NaClReaderWriter.h" |
#include "llvm/IR/LLVMContext.h" |
jvoung (off chromium)
2014/12/15 19:40:41
Can the LLVMContext header be removed too?
Karl
2014/12/15 20:27:54
Removed.
|
-#include "llvm/IR/Module.h" |
#include "llvm/Support/Format.h" |
#include "llvm/Support/MemoryBuffer.h" |
#include "llvm/Support/raw_ostream.h" |
@@ -32,7 +31,6 @@ |
#include "IceGlobalInits.h" |
#include "IceInst.h" |
#include "IceOperand.h" |
-#include "IceTypeConverter.h" |
#include "PNaClTranslator.h" |
#include <memory> |
@@ -173,11 +171,9 @@ public: |
TopLevelParser(Ice::Translator &Translator, const std::string &InputName, |
Jim Stichnoth
2014/12/15 20:17:08
Can you remove the InputName arg, or something? I
Karl
2014/12/15 20:27:54
Removed.
|
NaClBitcodeHeader &Header, NaClBitstreamCursor &Cursor, |
bool &ErrorStatus) |
- : NaClBitcodeParser(Cursor), Translator(Translator), |
- Mod(new Module(InputName, getGlobalContext())), Header(Header), |
- TypeConverter(Mod->getContext()), ErrorStatus(ErrorStatus), |
- NumErrors(0), NumFunctionIds(0), NumFunctionBlocks(0), |
- BlockParser(nullptr) { |
+ : NaClBitcodeParser(Cursor), Translator(Translator), Header(Header), |
+ ErrorStatus(ErrorStatus), NumErrors(0), NumFunctionIds(0), |
+ NumFunctionBlocks(0), BlockParser(nullptr) { |
setErrStream(Translator.getContext()->getStrDump()); |
} |
@@ -199,9 +195,6 @@ public: |
/// file. |
unsigned getNumErrors() const { return NumErrors; } |
- /// Returns the LLVM module associated with the translation. |
- Module *getModule() const { return Mod.get(); } |
- |
/// Returns the number of bytes in the bitcode header. |
size_t getHeaderSize() const { return Header.getHeaderSize(); } |
@@ -377,34 +370,11 @@ public: |
return VariableDeclarations; |
} |
- /// Returns the corresponding ICE type for LLVMTy. |
- Ice::Type convertToIceType(Type *LLVMTy) { |
- Ice::Type IceTy = TypeConverter.convertToIceType(LLVMTy); |
- if (IceTy >= Ice::IceType_NUM) { |
- return convertToIceTypeError(LLVMTy); |
- } |
- return IceTy; |
- } |
- |
- /// Returns the corresponding LLVM type for IceTy. |
- Type *convertToLLVMType(Ice::Type IceTy) const { |
- return TypeConverter.convertToLLVMType(IceTy); |
- } |
- |
- /// Returns the model for pointer types in ICE. |
- Ice::Type getIcePointerType() const { |
- return TypeConverter.getIcePointerType(); |
- } |
- |
private: |
// The translator associated with the parser. |
Ice::Translator &Translator; |
- // The parsed module. |
- std::unique_ptr<Module> Mod; |
// The bitcode header. |
NaClBitcodeHeader &Header; |
- // Converter between LLVM and ICE types. |
- Ice::TypeConverter TypeConverter; |
// The exit status that should be set to true if an error occurs. |
bool &ErrorStatus; |
// The number of errors reported. |
@@ -1407,7 +1377,7 @@ private: |
// the given InstructionName. Returns true if valid. Otherwise |
// generates an error message and returns false. |
bool isValidPointerType(Ice::Operand *Op, const char *InstructionName) { |
- Ice::Type PtrType = Context->getIcePointerType(); |
+ Ice::Type PtrType = Ice::getPointerType(); |
if (Op->getType() == PtrType) |
return true; |
std::string Buffer; |
@@ -2365,7 +2335,7 @@ void FunctionParser::ProcessRecord() { |
setNextLocalInstIndex(nullptr); |
return; |
} |
- Ice::Type PtrTy = Context->getIcePointerType(); |
+ Ice::Type PtrTy = Ice::getPointerType(); |
if (ByteCount->getType() != Ice::IceType_i32) { |
std::string Buffer; |
raw_string_ostream StrBuf(Buffer); |
@@ -2655,9 +2625,8 @@ void ConstantsParser::ProcessRecord() { |
FuncParser->setNextConstantID(nullptr); |
return; |
} |
- if (auto IType = dyn_cast<IntegerType>( |
- Context->convertToLLVMType(NextConstantType))) { |
- Ice::APInt Value(IType->getBitWidth(), |
+ if (Ice::isScalarIntegerType(NextConstantType)) { |
+ Ice::APInt Value(Ice::getScalarIntBitWidth(NextConstantType), |
NaClDecodeSignRotatedValue(Values[0])); |
if (Ice::Constant *C = getContext()->getConstantInt( |
NextConstantType, Value.getSExtValue())) { |