[Assembler] Fix RV32I pseudo load- and store
MODIFY
src/assembler/rv32i_assembler.cpp
src/assembler/rv32i_assembler.cpp
@@ -106,7 +106,9 @@ RV32I_Assembler::initInstructions(const std::set<Extensions>& extensions) const
name, {RegTok, ImmTok}, PseudoExpandFunc(line) { \
LineTokensVec v; \
v.push_back(QStringList() << "auipc" << line.tokens.at(1) << line.tokens.at(2)); \
- v.push_back(QStringList() << name << line.tokens.at(1) << line.tokens.at(2) << line.tokens.at(1)); \
+ v.push_back(QStringList() << name << line.tokens.at(1) \
+ << QString("((%1&0xfff)-(__address__-4))").arg(line.tokens.at(2)) \
+ << line.tokens.at(1)); \
return v; \
}))
@@ -121,8 +123,10 @@ RV32I_Assembler::initInstructions(const std::set<Extensions>& extensions) const
return PseudoExpandRes(Error(0, "Unused; will fallback to non-pseudo op sw")); \
} \
LineTokensVec v; \
- v.push_back(QStringList() << "auipc" << line.tokens.at(1) << line.tokens.at(2)); \
- v.push_back(QStringList() << name << line.tokens.at(1) << line.tokens.at(2) << line.tokens.at(3)); \
+ v.push_back(QStringList() << "auipc" << line.tokens.at(3) << line.tokens.at(2)); \
+ v.push_back(QStringList() << name << line.tokens.at(1) \
+ << QString("((%1&0xfff)-(__address__-4))").arg(line.tokens.at(2)) \
+ << line.tokens.at(3)); \
return PseudoExpandRes(v); \
}))

[Assembler] Fix RV32I pseudo load- and store