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

Unified Diff: src/IceInstMIPS32.cpp

Issue 2123723002: SubZero: legalize for f32/f64 constants in MIPS32 (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Changed as suggested Created 4 years, 5 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
Index: src/IceInstMIPS32.cpp
diff --git a/src/IceInstMIPS32.cpp b/src/IceInstMIPS32.cpp
index efae86753f22cfaff20b644be1be0640ea180edd..4745ac82ed77fe6799e845ec3e3639b579cd754e 100644
--- a/src/IceInstMIPS32.cpp
+++ b/src/IceInstMIPS32.cpp
@@ -46,7 +46,7 @@ bool OperandMIPS32Mem::canHoldOffset(Type Ty, bool SignExt, int32_t Offset) {
}
OperandMIPS32Mem::OperandMIPS32Mem(Cfg *Func, Type Ty, Variable *Base,
- ConstantInteger32 *ImmOffset, AddrMode Mode)
+ Operand *ImmOffset, AddrMode Mode)
: OperandMIPS32(kMem, Ty), Base(Base), ImmOffset(ImmOffset), Mode(Mode) {
// The Neg modes are only needed for Reg +/- Reg.
(void)Func;
@@ -121,6 +121,25 @@ template <> const char *InstMIPS32Trunc_w_s::Opcode = "trunc.w.s";
template <> const char *InstMIPS32Xor::Opcode = "xor";
template <> const char *InstMIPS32Xori::Opcode = "xori";
+template <> void InstMIPS32Lui::emit(const Cfg *Func) const {
+ if (!BuildDefs::dump())
+ return;
+ Ostream &Str = Func->getContext()->getStrEmit();
+ assert(getSrcSize() == 1);
+ Str << "\t" << Opcode << "\t";
+ getDest()->emit(Func);
+ Str << ", ";
+ auto *Src0 = llvm::cast<Constant>(getSrc(0));
+ if (auto *CR = llvm::dyn_cast<ConstantRelocatable>(Src0)) {
+ emitRelocOp(Str, Reloc);
+ Str << "(";
+ CR->emitWithoutPrefix(Func->getTarget());
+ Str << ")";
+ } else {
+ Src0->emit(Func);
+ }
+}
+
template <> void InstMIPS32Mflo::emit(const Cfg *Func) const {
if (!BuildDefs::dump())
return;
@@ -260,8 +279,11 @@ void OperandMIPS32Mem::emit(const Cfg *Func) const {
if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
- ConstantInteger32 *Offset = getOffset();
- Offset->emit(Func);
+ Operand *Offset = getOffset();
+ if (auto *CR = llvm::dyn_cast<ConstantRelocatable>(Offset)) {
+ CR->emitWithoutPrefix(Func->getTarget());
+ } else
+ Offset->emit(Func);
Str << "(";
getBase()->emit(Func);
Str << ")";

Powered by Google App Engine
This is Rietveld 408576698