| OLD | NEW |
| 1 //===- subzero/src/IceInstX86BaseImpl.h - Generic X86 instructions -*- C++ -*=// | 1 //===- subzero/src/IceInstX86BaseImpl.h - Generic X86 instructions -*- C++ -*=// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 /// | 9 /// |
| 10 /// \file | 10 /// \file |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 } | 360 } |
| 361 | 361 |
| 362 template <class Machine> | 362 template <class Machine> |
| 363 InstX86Xchg<Machine>::InstX86Xchg(Cfg *Func, Operand *Dest, Variable *Source) | 363 InstX86Xchg<Machine>::InstX86Xchg(Cfg *Func, Operand *Dest, Variable *Source) |
| 364 : InstX86Base<Machine>(Func, InstX86Base<Machine>::Xchg, 2, | 364 : InstX86Base<Machine>(Func, InstX86Base<Machine>::Xchg, 2, |
| 365 llvm::dyn_cast<Variable>(Dest)) { | 365 llvm::dyn_cast<Variable>(Dest)) { |
| 366 this->addSource(Dest); | 366 this->addSource(Dest); |
| 367 this->addSource(Source); | 367 this->addSource(Source); |
| 368 } | 368 } |
| 369 | 369 |
| 370 template <class Machine> |
| 371 InstX86IacaStart<Machine>::InstX86IacaStart(Cfg *Func) |
| 372 : InstX86Base<Machine>(Func, InstX86Base<Machine>::IacaStart, 0, nullptr) { |
| 373 assert(Func->getContext()->getFlags().getAllowIacaMarks()); |
| 374 } |
| 375 |
| 376 template <class Machine> |
| 377 InstX86IacaEnd<Machine>::InstX86IacaEnd(Cfg *Func) |
| 378 : InstX86Base<Machine>(Func, InstX86Base<Machine>::IacaEnd, 0, nullptr) { |
| 379 assert(Func->getContext()->getFlags().getAllowIacaMarks()); |
| 380 } |
| 381 |
| 370 // ======================== Dump routines ======================== // | 382 // ======================== Dump routines ======================== // |
| 371 | 383 |
| 372 template <class Machine> | 384 template <class Machine> |
| 373 void InstX86Base<Machine>::dump(const Cfg *Func) const { | 385 void InstX86Base<Machine>::dump(const Cfg *Func) const { |
| 374 if (!BuildDefs::dump()) | 386 if (!BuildDefs::dump()) |
| 375 return; | 387 return; |
| 376 Ostream &Str = Func->getContext()->getStrDump(); | 388 Ostream &Str = Func->getContext()->getStrDump(); |
| 377 Str << "[" << Traits::TargetName << "] "; | 389 Str << "[" << Traits::TargetName << "] "; |
| 378 Inst::dump(Func); | 390 Inst::dump(Func); |
| 379 } | 391 } |
| (...skipping 2769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3149 template <class Machine> | 3161 template <class Machine> |
| 3150 void InstX86Xchg<Machine>::dump(const Cfg *Func) const { | 3162 void InstX86Xchg<Machine>::dump(const Cfg *Func) const { |
| 3151 if (!BuildDefs::dump()) | 3163 if (!BuildDefs::dump()) |
| 3152 return; | 3164 return; |
| 3153 Ostream &Str = Func->getContext()->getStrDump(); | 3165 Ostream &Str = Func->getContext()->getStrDump(); |
| 3154 Type Ty = this->getSrc(0)->getType(); | 3166 Type Ty = this->getSrc(0)->getType(); |
| 3155 Str << "xchg." << Ty << " "; | 3167 Str << "xchg." << Ty << " "; |
| 3156 this->dumpSources(Func); | 3168 this->dumpSources(Func); |
| 3157 } | 3169 } |
| 3158 | 3170 |
| 3171 template <class Machine> |
| 3172 void InstX86IacaStart<Machine>::emit(const Cfg *Func) const { |
| 3173 if (!BuildDefs::dump()) |
| 3174 return; |
| 3175 Ostream &Str = Func->getContext()->getStrEmit(); |
| 3176 Str << "\t# IACA_START\n" |
| 3177 << "\t.byte 0x0F, 0x0B\n" |
| 3178 << "\tmovl\t$111, %ebx\n" |
| 3179 << "\t.byte 0x64, 0x67, 0x90"; |
| 3180 } |
| 3181 |
| 3182 template <class Machine> |
| 3183 void InstX86IacaStart<Machine>::emitIAS(const Cfg *Func) const { |
| 3184 typename InstX86Base<Machine>::Traits::Assembler *Asm = |
| 3185 Func->getAssembler<typename InstX86Base<Machine>::Traits::Assembler>(); |
| 3186 Asm->iaca_start(); |
| 3187 } |
| 3188 |
| 3189 template <class Machine> |
| 3190 void InstX86IacaStart<Machine>::dump(const Cfg *Func) const { |
| 3191 if (!BuildDefs::dump()) |
| 3192 return; |
| 3193 Ostream &Str = Func->getContext()->getStrDump(); |
| 3194 Str << "IACA_START"; |
| 3195 } |
| 3196 |
| 3197 template <class Machine> |
| 3198 void InstX86IacaEnd<Machine>::emit(const Cfg *Func) const { |
| 3199 if (!BuildDefs::dump()) |
| 3200 return; |
| 3201 Ostream &Str = Func->getContext()->getStrEmit(); |
| 3202 Str << "\t# IACA_END\n" |
| 3203 << "\tmovl\t$222, %ebx\n" |
| 3204 << "\t.byte 0x64, 0x67, 0x90\n" |
| 3205 << "\t.byte 0x0F, 0x0B"; |
| 3206 } |
| 3207 |
| 3208 template <class Machine> |
| 3209 void InstX86IacaEnd<Machine>::emitIAS(const Cfg *Func) const { |
| 3210 typename InstX86Base<Machine>::Traits::Assembler *Asm = |
| 3211 Func->getAssembler<typename InstX86Base<Machine>::Traits::Assembler>(); |
| 3212 Asm->iaca_end(); |
| 3213 } |
| 3214 |
| 3215 template <class Machine> |
| 3216 void InstX86IacaEnd<Machine>::dump(const Cfg *Func) const { |
| 3217 if (!BuildDefs::dump()) |
| 3218 return; |
| 3219 Ostream &Str = Func->getContext()->getStrDump(); |
| 3220 Str << "IACA_END"; |
| 3221 } |
| 3222 |
| 3159 } // end of namespace X86Internal | 3223 } // end of namespace X86Internal |
| 3160 | 3224 |
| 3161 } // end of namespace Ice | 3225 } // end of namespace Ice |
| 3162 | 3226 |
| 3163 #endif // SUBZERO_SRC_ICEINSTX86BASEIMPL_H | 3227 #endif // SUBZERO_SRC_ICEINSTX86BASEIMPL_H |
| OLD | NEW |