Add emitAnyConst
authorMike Danes <onemihaid@hotmail.com>
Sat, 28 Oct 2017 08:15:41 +0000 (11:15 +0300)
committerMike Danes <onemihaid@hotmail.com>
Sat, 28 Oct 2017 08:15:41 +0000 (11:15 +0300)
Like emitDataConst but returns CORINFO_FIELD_HANDLE, it's more useful in codegen. emitDataConst should probably be private.

src/jit/codegenxarch.cpp
src/jit/emit.cpp
src/jit/emit.h

index c6337288cf26304d2de528dd30e5c4e54b1be95b..8c403dc4f1f33e44eaedd577cd24308372293fca 100644 (file)
@@ -7331,7 +7331,7 @@ void CodeGen::genSSE2BitwiseOp(GenTreePtr treeNode)
     if (*bitMask == nullptr)
     {
         assert(cnsAddr != nullptr);
-        *bitMask = compiler->eeFindJitDataOffs(getEmitter()->emitDataConst(cnsAddr, genTypeSize(targetType), dblAlign));
+        *bitMask = getEmitter()->emitAnyConst(cnsAddr, genTypeSize(targetType), dblAlign);
     }
 
     // We need an additional register for bitmask.
index bb4db5fb6ec296ecd625a5f7ae58ea3ec739c0c5..970362768cc36b417785e131089e56a0519ca8e2 100644 (file)
@@ -5364,6 +5364,13 @@ UNATIVE_OFFSET emitter::emitDataConst(const void* cnsAddr, unsigned cnsSize, boo
 }
 
 #ifndef LEGACY_BACKEND
+
+CORINFO_FIELD_HANDLE emitter::emitAnyConst(const void* cnsAddr, unsigned cnsSize, bool dblAlign)
+{
+    UNATIVE_OFFSET cnum = emitDataConst(cnsAddr, cnsSize, dblAlign);
+    return emitComp->eeFindJitDataOffs(cnum);
+}
+
 // Generates a float or double data section constant and returns field handle representing
 // the data offset to access the constant.  This is called by emitInsBinary() in case
 // of contained float of double constants.
index 9092652afef711e0c0ce8edc33dc900068566aec..e438d85329efc60783a1411a1a111a74e9a9450c 100644 (file)
@@ -1710,6 +1710,7 @@ private:
     UNATIVE_OFFSET emitInstCodeSz(instrDesc* id);
 
 #ifndef LEGACY_BACKEND
+    CORINFO_FIELD_HANDLE emitAnyConst(const void* cnsAddr, unsigned cnsSize, bool dblAlign);
     CORINFO_FIELD_HANDLE emitFltOrDblConst(double constValue, emitAttr attr);
     regNumber emitInsBinary(instruction ins, emitAttr attr, GenTree* dst, GenTree* src);
     regNumber emitInsTernary(instruction ins, emitAttr attr, GenTree* dst, GenTree* src1, GenTree* src2);