Commit 82975ba6 by Karl Schimpf

Fix skip_unimplemented for filetype=obj in ARM.

Fixes generation of emit text fixup code in integrated ARM assembler to properly reset the text fixup flag when skipping unimplemented instructions. Also fixes broken assertion for the "vmul" instruction. BUG=None R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1656023002 .
parent ee1aae82
...@@ -66,7 +66,7 @@ AssemblerTextFixup *AssemblerBuffer::createTextFixup(const std::string &Text, ...@@ -66,7 +66,7 @@ AssemblerTextFixup *AssemblerBuffer::createTextFixup(const std::string &Text,
AssemblerTextFixup *F = new (Assemblr.allocate<AssemblerTextFixup>()) AssemblerTextFixup *F = new (Assemblr.allocate<AssemblerTextFixup>())
AssemblerTextFixup(Text, BytesUsed); AssemblerTextFixup(Text, BytesUsed);
installFixup(F); installFixup(F);
TextFixupNeeded = false; resetNeedsTextFixup();
return F; return F;
} }
......
...@@ -184,6 +184,7 @@ public: ...@@ -184,6 +184,7 @@ public:
/// Mark that an attempt was made to emit, but failed. Hence, in order to /// Mark that an attempt was made to emit, but failed. Hence, in order to
/// continue, one must emit a text fixup. /// continue, one must emit a text fixup.
void setNeedsTextFixup() { TextFixupNeeded = true; } void setNeedsTextFixup() { TextFixupNeeded = true; }
void resetNeedsTextFixup() { TextFixupNeeded = false; }
/// Returns true if last emit failed and needs a text fixup. /// Returns true if last emit failed and needs a text fixup.
bool needsTextFixup() const { return TextFixupNeeded; } bool needsTextFixup() const { return TextFixupNeeded; }
...@@ -310,6 +311,7 @@ public: ...@@ -310,6 +311,7 @@ public:
} }
void setNeedsTextFixup() { Buffer.setNeedsTextFixup(); } void setNeedsTextFixup() { Buffer.setNeedsTextFixup(); }
void resetNeedsTextFixup() { Buffer.resetNeedsTextFixup(); }
bool needsTextFixup() const { return Buffer.needsTextFixup(); } bool needsTextFixup() const { return Buffer.needsTextFixup(); }
......
...@@ -98,6 +98,12 @@ void InstARM32::emitUsingTextFixup(const Cfg *Func) const { ...@@ -98,6 +98,12 @@ void InstARM32::emitUsingTextFixup(const Cfg *Func) const {
return; return;
GlobalContext *Ctx = Func->getContext(); GlobalContext *Ctx = Func->getContext();
auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>();
if (Ctx->getFlags().getDisableHybridAssembly() &&
Ctx->getFlags().getSkipUnimplemented()) {
Asm->trap();
Asm->resetNeedsTextFixup();
return;
}
std::string Buffer; std::string Buffer;
llvm::raw_string_ostream StrBuf(Buffer); llvm::raw_string_ostream StrBuf(Buffer);
OstreamLocker L(Ctx); OstreamLocker L(Ctx);
...@@ -116,6 +122,7 @@ void InstARM32::emitUsingTextFixup(const Cfg *Func) const { ...@@ -116,6 +122,7 @@ void InstARM32::emitUsingTextFixup(const Cfg *Func) const {
llvm::errs() << "Can't assemble: " << StrBuf.str() << "\n"; llvm::errs() << "Can't assemble: " << StrBuf.str() << "\n";
UnimplementedError(Ctx->getFlags()); UnimplementedError(Ctx->getFlags());
} }
Asm->resetNeedsTextFixup();
return; return;
} }
Asm->emitTextInst(StrBuf.str(), Asm->getEmitTextSize()); Asm->emitTextInst(StrBuf.str(), Asm->getEmitTextSize());
...@@ -751,17 +758,16 @@ template <> void InstARM32Vmul::emitIAS(const Cfg *Func) const { ...@@ -751,17 +758,16 @@ template <> void InstARM32Vmul::emitIAS(const Cfg *Func) const {
default: default:
// TODO(kschimpf) Figure if more cases are needed. // TODO(kschimpf) Figure if more cases are needed.
emitUsingTextFixup(Func); emitUsingTextFixup(Func);
break; return;
case IceType_f32: case IceType_f32:
Asm->vmuls(getDest(), getSrc(0), getSrc(1), CondARM32::AL); Asm->vmuls(getDest(), getSrc(0), getSrc(1), CondARM32::AL);
assert(!Asm->needsTextFixup()); assert(!Asm->needsTextFixup());
break; return;
case IceType_f64: case IceType_f64:
Asm->vmuld(getDest(), getSrc(0), getSrc(1), CondARM32::AL); Asm->vmuld(getDest(), getSrc(0), getSrc(1), CondARM32::AL);
assert(!Asm->needsTextFixup()); assert(!Asm->needsTextFixup());
break; return;
} }
assert(!Asm->needsTextFixup());
} }
InstARM32Call::InstARM32Call(Cfg *Func, Variable *Dest, Operand *CallTarget) InstARM32Call::InstARM32Call(Cfg *Func, Variable *Dest, Operand *CallTarget)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment