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

Unified Diff: src/PNaClTranslator.cpp

Issue 797323002: Simplify LLVM's APInt and APFloat for use in Subzero. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix nits. Created 6 years 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
« src/IceAPInt.h ('K') | « src/IceAPInt.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/PNaClTranslator.cpp
diff --git a/src/PNaClTranslator.cpp b/src/PNaClTranslator.cpp
index 124ed894f34fd72da298a1c43b253227479e7179..3c251546150c8ce5f9897467d34b1cde0aed4fad 100644
--- a/src/PNaClTranslator.cpp
+++ b/src/PNaClTranslator.cpp
@@ -24,6 +24,8 @@
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/raw_ostream.h"
+#include "IceAPInt.h"
+#include "IceAPFloat.h"
#include "IceCfg.h"
#include "IceCfgNode.h"
#include "IceClFlags.h"
@@ -2188,9 +2190,8 @@ void FunctionParser::ProcessRecord() {
Error(StrBuf.str());
return;
}
- APInt Value(BitWidth,
- NaClDecodeSignRotatedValue(Values[ValCaseIndex + 2]),
- true);
+ Ice::APInt Value(BitWidth,
+ NaClDecodeSignRotatedValue(Values[ValCaseIndex + 2]));
if (isIRGenDisabled)
continue;
Ice::CfgNode *Label = getBranchBasicBlock(Values[ValCaseIndex + 3]);
@@ -2563,7 +2564,8 @@ void ConstantsParser::ProcessRecord() {
}
if (auto IType = dyn_cast<IntegerType>(
Context->convertToLLVMType(NextConstantType))) {
- APInt Value(IType->getBitWidth(), NaClDecodeSignRotatedValue(Values[0]));
+ Ice::APInt Value(IType->getBitWidth(),
+ NaClDecodeSignRotatedValue(Values[0]));
if (Ice::Constant *C = getContext()->getConstantInt(
NextConstantType, Value.getSExtValue())) {
FuncParser->setNextConstantID(C);
@@ -2589,16 +2591,15 @@ void ConstantsParser::ProcessRecord() {
}
switch (NextConstantType) {
case Ice::IceType_f32: {
- APFloat Value(APFloat::IEEEsingle,
- APInt(32, static_cast<uint32_t>(Values[0])));
+ const Ice::APInt Value(32, static_cast<uint32_t>(Values[0]));
FuncParser->setNextConstantID(
- getContext()->getConstantFloat(Value.convertToFloat()));
+ getContext()->getConstantFloat(Ice::convertAPIntToFloat(Value)));
return;
}
case Ice::IceType_f64: {
- APFloat Value(APFloat::IEEEdouble, APInt(64, Values[0]));
+ const Ice::APInt Value(64, Values[0]);
FuncParser->setNextConstantID(
- getContext()->getConstantDouble(Value.convertToDouble()));
+ getContext()->getConstantDouble(Ice::convertAPIntToDouble(Value)));
return;
}
default: {
« src/IceAPInt.h ('K') | « src/IceAPInt.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698