Skip to content

Commit 77fd98c

Browse files
BajtazarGrzegorz Czarnecki
and
Grzegorz Czarnecki
authored
[RISC-V] Added designated output instruction emitters (#96741)
* Added declarations and r-type definition with assert helper * Added insEncodeITypeInstr * Added definition of S type instr * Added definition of U type instr * Added definition of B type instr * Added definition of J type instr * Restructurized bit operations * Improved checks in insEncode functions * Fixed some of the encoding methods * Bugfix * Fixed comparation sign * Revert "Fixed comparation sign" This reverts commit c238b82. * Fixed comparation sign * Reverted changes in emitOutputInstrJumpDistanceHelper * Fixed misspell * Fixes after review * Fixes in insEncodeJTypeInstr * Added emitOutput_RTypeInstr * Added emitOutput_ITypeInstr * Added emitOutput_STypeInstr * Added emitOutput_UTypeInstr * Added emitOutput_BTypeInstr * Added emitOutput_JTypeInstr * Fixes in emitOutput_ methods * Replaced reloc with new code * Removed invalid code * Added emit output rellocation * Minor changes * Added emitOutputInstr_Addi8 * Implemented further addi32 * Reverted changes from la * Fixed format bug * Fixed comment * Renamed some of the emitters * Added some comments * Improved implementation and finished addi32 * Microimprovements * Quickfix to upperNBitsOfWord * Finished substituting instr_optsi * Fixed bug in mask * Added emitOutputInstr_OptsRcReloc and prelimiary parent function * Added emitOutput_OptsRcNoReloc * Improvements in OptsRc * Fixes and introduced an emitOutputInstr_OptsRc * Added emitOutputInstr_OptsRl and removed unused args from other functions * Added emitOutputInstr_OptsRlReloc * Finished emitOutputInstr_OptsRcNoReloc * Fixed bugs and finished opts rl * Added emitOutputInstr_OptsJalr * Added emitOutputInstr_OptsJalr8 * Added special comparation inverter * Add emitOutputInstr_OptsJalr24 * Added emitOutputInstr_OptsJalr28 * Improved emitOutputInstr_OptsJalr28 * Enabled new opts jalr impl * Added emitOutputInstr_OptsJCond * Added emitOutputInstr_OptsJ * Replaced old code with the new one * Added emitOutputInstr_OptsC * Fixed last piece of switch * Removed old code * Simplified code * Other fixes * Fixes in emitOutput_* instr * Fixed bitmask bug * Added temporary reinforced assers * Added shift ins * Improved shift func * Inserted shift func * Fixed minor bug * Other fixes * Added checks to r type emitter * Improved sanity checks in the emitOutput_RTypeInstr * Added ITypeInstr sanity checks * Moved ITypeInstr_Shift sanity Check * Added comment to the emitriscv64 * Added S-type sanity checks * Removed Shift ITypeInstr Variant * Fixes * Added BType sanity check * Added csr operations to sanity checks * Added ITypeInstr sanity check * Fixes * Removed duplicated code * Fixed bug in noreloc * Removed dead asserts * Removed now unused asserts * Fixed format * Fixed missing const * Removed useless ifdef * Fixed missing asserts * Added a new assert * Added zero assert * Removed useless FALLTHROUGH statements * Added trimmers * Added explicit signed integers trimming * Fixes to prev commit * Added castFloatOrIntegralReg and fixed invalid asserts * Renamed upper word helpers * Spell fix * Moved castFloat... to the emitter * Changes after code review * Removed bitcast * Added additional check * Removed unnecessary reinterpret casts * Removed redundant asserts --------- Co-authored-by: Grzegorz Czarnecki <g.czarnecki@samsung.com>
1 parent b79a1fd commit 77fd98c

File tree

4 files changed

+1029
-643
lines changed

4 files changed

+1029
-643
lines changed

src/coreclr/jit/emit.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ void emitLclVarAddr::initLclVarAddr(int varNum, unsigned offset)
707707
}
708708

709709
// Returns the variable to access. Note that it returns a negative number for compiler spill temps.
710-
int emitLclVarAddr::lvaVarNum()
710+
int emitLclVarAddr::lvaVarNum() const
711711
{
712712
switch (_lvaTag)
713713
{
@@ -721,7 +721,7 @@ int emitLclVarAddr::lvaVarNum()
721721
}
722722
}
723723

724-
unsigned emitLclVarAddr::lvaOffset() // returns the offset into the variable to access
724+
unsigned emitLclVarAddr::lvaOffset() const // returns the offset into the variable to access
725725
{
726726
switch (_lvaTag)
727727
{
@@ -9777,7 +9777,7 @@ void emitter::emitRemoveLastInstruction()
97779777
* emitGetInsSC: Get the instruction's constant value.
97789778
*/
97799779

9780-
cnsval_ssize_t emitter::emitGetInsSC(instrDesc* id)
9780+
cnsval_ssize_t emitter::emitGetInsSC(const instrDesc* id) const
97819781
{
97829782
#ifdef TARGET_ARM // should it be TARGET_ARMARCH? Why do we need this? Note that on ARM64 we store scaled immediates
97839783
// for some formats

src/coreclr/jit/emit.h

+4-3
Original file line numberDiff line numberDiff line change
@@ -418,8 +418,9 @@ struct emitLclVarAddr
418418
// Constructor
419419
void initLclVarAddr(int varNum, unsigned offset);
420420

421-
int lvaVarNum(); // Returns the variable to access. Note that it returns a negative number for compiler spill temps.
422-
unsigned lvaOffset(); // returns the offset into the variable to access
421+
int lvaVarNum() const; // Returns the variable to access. Note that it returns a negative number for compiler spill
422+
// temps.
423+
unsigned lvaOffset() const; // returns the offset into the variable to access
423424

424425
// This struct should be 32 bits in size for the release build.
425426
// We have this constraint because this type is used in a union
@@ -2164,7 +2165,7 @@ class emitter
21642165
static const IS_INFO emitGetSchedInfo(insFormat f);
21652166
#endif // TARGET_XARCH
21662167

2167-
cnsval_ssize_t emitGetInsSC(instrDesc* id);
2168+
cnsval_ssize_t emitGetInsSC(const instrDesc* id) const;
21682169
unsigned emitInsCount;
21692170

21702171
/************************************************************************/

0 commit comments

Comments
 (0)