[llvm] r195684 - Do the string comparison in the constructor instead of once per nop.
Rafael Espindola
rafael.espindola at gmail.com
Mon Nov 25 12:50:04 PST 2013
Author: rafael
Date: Mon Nov 25 14:50:03 2013
New Revision: 195684
URL: http://llvm.org/viewvc/llvm-project?rev=195684&view=rev
Log:
Do the string comparison in the constructor instead of once per nop.
Thanks to Roman Divacky for the suggestion.
Modified:
llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
Modified: llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp?rev=195684&r1=195683&r2=195684&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp (original)
+++ llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp Mon Nov 25 14:50:03 2013
@@ -68,9 +68,16 @@ public:
class X86AsmBackend : public MCAsmBackend {
StringRef CPU;
+ bool HasNopl;
public:
X86AsmBackend(const Target &T, StringRef _CPU)
- : MCAsmBackend(), CPU(_CPU) {}
+ : MCAsmBackend(), CPU(_CPU) {
+ HasNopl = CPU != "generic" && CPU != "i386" && CPU != "i486" &&
+ CPU != "i586" && CPU != "pentium" && CPU != "pentium-mmx" &&
+ CPU != "i686" && CPU != "k6" && CPU != "k6-2" && CPU != "k6-3" &&
+ CPU != "geode" && CPU != "winchip-c6" && CPU != "winchip2" &&
+ CPU != "c3" && CPU != "c3-2";
+ }
unsigned getNumFixupKinds() const {
return X86::NumTargetFixupKinds;
@@ -310,11 +317,7 @@ bool X86AsmBackend::writeNopData(uint64_
// This CPU doesnt support long nops. If needed add more.
// FIXME: Can we get this from the subtarget somehow?
// FIXME: We could generated something better than plain 0x90.
- if (CPU == "generic" || CPU == "i386" || CPU == "i486" || CPU == "i586" ||
- CPU == "pentium" || CPU == "pentium-mmx" || CPU == "i686" ||
- CPU == "k6" || CPU == "k6-2" || CPU == "k6-3" || CPU == "geode" ||
- CPU == "winchip-c6" || CPU == "winchip2" || CPU == "c3" ||
- CPU == "c3-2") {
+ if (!HasNopl) {
for (uint64_t i = 0; i < Count; ++i)
OW->Write8(0x90);
return true;
More information about the llvm-commits
mailing list