Commit 6106df80 by Jim Stichnoth

Subzero: Separate "\t" from "opcode" in asm emission.

Instead of output like this: Str << "\tmov\t" << ... we prefer to use string concatenation: Str << "\t" "mov\t" << ... That way, "git grep -w mov" can be used for more precise pattern matching. BUG= none R=kschimpf@google.com Review URL: https://codereview.chromium.org/1523873003 .
parent e398428c
...@@ -453,7 +453,8 @@ size_t MoveRelocatableFixup::emit(GlobalContext *Ctx, ...@@ -453,7 +453,8 @@ size_t MoveRelocatableFixup::emit(GlobalContext *Ctx,
return InstARM32::InstSize; return InstARM32::InstSize;
Ostream &Str = Ctx->getStrEmit(); Ostream &Str = Ctx->getStrEmit();
IValueT Inst = Asm.load<IValueT>(position()); IValueT Inst = Asm.load<IValueT>(position());
Str << "\tmov" << (kind() == llvm::ELF::R_ARM_MOVW_ABS_NC ? "w" : "t") << "\t" Str << "\t"
"mov" << (kind() == llvm::ELF::R_ARM_MOVW_ABS_NC ? "w" : "t") << "\t"
<< RegARM32::RegNames[(Inst >> kRdShift) & 0xF] << RegARM32::RegNames[(Inst >> kRdShift) & 0xF]
<< ", #:" << (kind() == llvm::ELF::R_ARM_MOVW_ABS_NC ? "lower" : "upper") << ", #:" << (kind() == llvm::ELF::R_ARM_MOVW_ABS_NC ? "lower" : "upper")
<< "16:" << symbol(Ctx) << "\t@ .word " << "16:" << symbol(Ctx) << "\t@ .word "
...@@ -479,7 +480,7 @@ size_t BlRelocatableFixup::emit(GlobalContext *Ctx, ...@@ -479,7 +480,7 @@ size_t BlRelocatableFixup::emit(GlobalContext *Ctx,
Ostream &Str = Ctx->getStrEmit(); Ostream &Str = Ctx->getStrEmit();
IValueT Inst = Asm.load<IValueT>(position()); IValueT Inst = Asm.load<IValueT>(position());
Str << "\t" Str << "\t"
<< "bl\t" << symbol(Ctx) << "\t@ .word " "bl\t" << symbol(Ctx) << "\t@ .word "
<< llvm::format_hex_no_prefix(Inst, 8) << "\n"; << llvm::format_hex_no_prefix(Inst, 8) << "\n";
return InstARM32::InstSize; return InstARM32::InstSize;
} }
......
...@@ -854,7 +854,8 @@ void InstBundleLock::emit(const Cfg *Func) const { ...@@ -854,7 +854,8 @@ void InstBundleLock::emit(const Cfg *Func) const {
case Opt_None: case Opt_None:
break; break;
case Opt_AlignToEnd: case Opt_AlignToEnd:
Str << "\talign_to_end"; Str << "\t"
"align_to_end";
break; break;
} }
Str << "\n"; Str << "\n";
......
...@@ -818,7 +818,7 @@ void InstARM32Mov::emitMultiDestSingleSource(const Cfg *Func) const { ...@@ -818,7 +818,7 @@ void InstARM32Mov::emitMultiDestSingleSource(const Cfg *Func) const {
assert(llvm::isa<Variable>(Src) && Src->hasReg()); assert(llvm::isa<Variable>(Src) && Src->hasReg());
Str << "\t" Str << "\t"
<< "vmov" << getPredicate() << "\t"; "vmov" << getPredicate() << "\t";
DestLo->emit(Func); DestLo->emit(Func);
Str << ", "; Str << ", ";
DestHi->emit(Func); DestHi->emit(Func);
...@@ -840,7 +840,7 @@ void InstARM32Mov::emitSingleDestMultiSource(const Cfg *Func) const { ...@@ -840,7 +840,7 @@ void InstARM32Mov::emitSingleDestMultiSource(const Cfg *Func) const {
assert(getSrcSize() == 2); assert(getSrcSize() == 2);
Str << "\t" Str << "\t"
<< "vmov" << getPredicate() << "\t"; "vmov" << getPredicate() << "\t";
Dest->emit(Func); Dest->emit(Func);
Str << ", "; Str << ", ";
SrcLo->emit(Func); SrcLo->emit(Func);
...@@ -981,7 +981,7 @@ void InstARM32Br::emit(const Cfg *Func) const { ...@@ -981,7 +981,7 @@ void InstARM32Br::emit(const Cfg *Func) const {
return; return;
Ostream &Str = Func->getContext()->getStrEmit(); Ostream &Str = Func->getContext()->getStrEmit();
Str << "\t" Str << "\t"
<< "b" << getPredicate() << "\t"; "b" << getPredicate() << "\t";
if (Label) { if (Label) {
Str << Label->getName(Func); Str << Label->getName(Func);
} else { } else {
...@@ -1052,13 +1052,13 @@ void InstARM32Call::emit(const Cfg *Func) const { ...@@ -1052,13 +1052,13 @@ void InstARM32Call::emit(const Cfg *Func) const {
// Calls only have 24-bits, but the linker should insert veneers to extend // Calls only have 24-bits, but the linker should insert veneers to extend
// the range if needed. // the range if needed.
Str << "\t" Str << "\t"
<< "bl" "bl"
<< "\t"; "\t";
CallTarget->emitWithoutPrefix(Func->getTarget()); CallTarget->emitWithoutPrefix(Func->getTarget());
} else { } else {
Str << "\t" Str << "\t"
<< "blx" "blx"
<< "\t"; "\t";
getCallTarget()->emit(Func); getCallTarget()->emit(Func);
} }
} }
...@@ -1496,8 +1496,8 @@ void InstARM32Ret::emit(const Cfg *Func) const { ...@@ -1496,8 +1496,8 @@ void InstARM32Ret::emit(const Cfg *Func) const {
assert(LR->getRegNum() == RegARM32::Reg_lr); assert(LR->getRegNum() == RegARM32::Reg_lr);
Ostream &Str = Func->getContext()->getStrEmit(); Ostream &Str = Func->getContext()->getStrEmit();
Str << "\t" Str << "\t"
<< "bx" "bx"
<< "\t"; "\t";
LR->emit(Func); LR->emit(Func);
} }
...@@ -1625,7 +1625,7 @@ void InstARM32Umull::emit(const Cfg *Func) const { ...@@ -1625,7 +1625,7 @@ void InstARM32Umull::emit(const Cfg *Func) const {
assert(getSrcSize() == 2); assert(getSrcSize() == 2);
assert(getDest()->hasReg()); assert(getDest()->hasReg());
Str << "\t" Str << "\t"
<< "umull" << getPredicate() << "\t"; "umull" << getPredicate() << "\t";
getDest()->emit(Func); getDest()->emit(Func);
Str << ", "; Str << ", ";
DestHi->emit(Func); DestHi->emit(Func);
...@@ -1689,7 +1689,7 @@ void InstARM32Vcvt::emit(const Cfg *Func) const { ...@@ -1689,7 +1689,7 @@ void InstARM32Vcvt::emit(const Cfg *Func) const {
assert(getSrcSize() == 1); assert(getSrcSize() == 1);
assert(getDest()->hasReg()); assert(getDest()->hasReg());
Str << "\t" Str << "\t"
<< "vcvt" << getPredicate() << vcvtVariantSuffix(Variant) << "\t"; "vcvt" << getPredicate() << vcvtVariantSuffix(Variant) << "\t";
getDest()->emit(Func); getDest()->emit(Func);
Str << ", "; Str << ", ";
getSrc(0)->emit(Func); getSrc(0)->emit(Func);
...@@ -1790,7 +1790,8 @@ void InstARM32Dmb::emitIAS(const Cfg *Func) const { ...@@ -1790,7 +1790,8 @@ void InstARM32Dmb::emitIAS(const Cfg *Func) const {
void InstARM32Dmb::dump(const Cfg *Func) const { void InstARM32Dmb::dump(const Cfg *Func) const {
if (!BuildDefs::dump()) if (!BuildDefs::dump())
return; return;
Func->getContext()->getStrDump() << "dmb\tsy"; Func->getContext()->getStrDump() << "dmb\t"
"sy";
} }
void OperandARM32Mem::emit(const Cfg *Func) const { void OperandARM32Mem::emit(const Cfg *Func) const {
......
...@@ -139,8 +139,8 @@ void InstMIPS32Ret::emit(const Cfg *Func) const { ...@@ -139,8 +139,8 @@ void InstMIPS32Ret::emit(const Cfg *Func) const {
assert(RA->getRegNum() == RegMIPS32::Reg_RA); assert(RA->getRegNum() == RegMIPS32::Reg_RA);
Ostream &Str = Func->getContext()->getStrEmit(); Ostream &Str = Func->getContext()->getStrEmit();
Str << "\t" Str << "\t"
<< "jr" "jr"
<< "\t"; "\t";
RA->emit(Func); RA->emit(Func);
} }
...@@ -258,8 +258,8 @@ void InstMIPS32Mov::emitSingleDestSingleSource(const Cfg *Func) const { ...@@ -258,8 +258,8 @@ void InstMIPS32Mov::emitSingleDestSingleSource(const Cfg *Func) const {
Str << "lw"; Str << "lw";
} else { } else {
if (S && S->hasReg()) { if (S && S->hasReg()) {
Str << "sw"; Str << "sw"
Str << "\t"; "\t";
getSrc(0)->emit(Func); getSrc(0)->emit(Func);
Str << ", "; Str << ", ";
getDest()->emit(Func); getDest()->emit(Func);
......
...@@ -1072,8 +1072,10 @@ TargetHeaderMIPS32::TargetHeaderMIPS32(GlobalContext *Ctx) ...@@ -1072,8 +1072,10 @@ TargetHeaderMIPS32::TargetHeaderMIPS32(GlobalContext *Ctx)
void TargetHeaderMIPS32::lower() { void TargetHeaderMIPS32::lower() {
OstreamLocker L(Ctx); OstreamLocker L(Ctx);
Ostream &Str = Ctx->getStrEmit(); Ostream &Str = Ctx->getStrEmit();
Str << "\t.set\tnomicromips\n"; Str << "\t.set\t"
Str << "\t.set\tnomips16\n"; << "nomicromips\n";
Str << "\t.set\t"
<< "nomips16\n";
} }
llvm::SmallBitVector TargetMIPS32::TypeToRegisterSet[IceType_NUM]; llvm::SmallBitVector TargetMIPS32::TypeToRegisterSet[IceType_NUM];
......
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