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

Unified Diff: src/IceTargetLoweringX8632.cpp

Issue 837393005: Subzero: Write float/double constant pools directly to the ELF file. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: use WriteAmt everywhere Created 5 years, 11 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/IceOperand.h ('k') | src/IceTranslator.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceTargetLoweringX8632.cpp
diff --git a/src/IceTargetLoweringX8632.cpp b/src/IceTargetLoweringX8632.cpp
index b8cbb9dee5c054cbfdfacdcf3a93a36f2393e3e4..85b752209187792b0d9711905d264bcb566fd11b 100644
--- a/src/IceTargetLoweringX8632.cpp
+++ b/src/IceTargetLoweringX8632.cpp
@@ -969,7 +969,6 @@ void TargetX8632::addEpilog(CfgNode *Node) {
template <typename T> struct PoolTypeConverter {};
template <> struct PoolTypeConverter<float> {
- typedef float PrimitiveFpType;
typedef uint32_t PrimitiveIntType;
typedef ConstantFloat IceType;
static const Type Ty = IceType_f32;
@@ -982,7 +981,6 @@ const char *PoolTypeConverter<float>::AsmTag = ".long";
const char *PoolTypeConverter<float>::PrintfString = "0x%x";
template <> struct PoolTypeConverter<double> {
- typedef double PrimitiveFpType;
typedef uint64_t PrimitiveIntType;
typedef ConstantDouble IceType;
static const Type Ty = IceType_f64;
@@ -1006,7 +1004,7 @@ template <typename T> void TargetX8632::emitConstantPool() const {
Str << "\t.align\t" << Align << "\n";
for (Constant *C : Pool) {
typename T::IceType *Const = llvm::cast<typename T::IceType>(C);
- typename T::PrimitiveFpType Value = Const->getValue();
+ typename T::IceType::PrimType Value = Const->getValue();
// Use memcpy() to copy bits from Value into RawValue in a way
// that avoids breaking strict-aliasing rules.
typename T::PrimitiveIntType RawValue;
@@ -1024,12 +1022,16 @@ template <typename T> void TargetX8632::emitConstantPool() const {
}
void TargetX8632::emitConstants() const {
- // Note: Still used by emit IAS.
- emitConstantPool<PoolTypeConverter<float>>();
- emitConstantPool<PoolTypeConverter<double>>();
-
// No need to emit constants from the int pool since (for x86) they
- // are embedded as immediates in the instructions.
+ // are embedded as immediates in the instructions, just emit float/double.
+ if (Ctx->getFlags().UseELFWriter) {
+ ELFObjectWriter *Writer = Ctx->getObjectWriter();
+ Writer->writeConstantPool<ConstantFloat>(IceType_f32);
+ Writer->writeConstantPool<ConstantDouble>(IceType_f64);
+ } else {
+ emitConstantPool<PoolTypeConverter<float>>();
+ emitConstantPool<PoolTypeConverter<double>>();
+ }
}
void TargetX8632::split64(Variable *Var) {
« no previous file with comments | « src/IceOperand.h ('k') | src/IceTranslator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698