[PATCH] D17573: [X86] PR26554: Enable using of true long nops for x86-64 for every CPU

Andrey Turetskiy via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 3 10:22:57 PDT 2016


aturetsk added a comment.

I made AsmBackend to use subtarget features to determine whether true long nops are supported or not, as suggested.
Yet to fix the PR we still need additional code, see lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp : 61.
The most part of the patch is adding MCSubtargetInfo as argument for AsmBackend creator functions for all targets, that's why the patch is so big. But I didn't find any way to do it better.


================
Comment at: lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp:61
@@ +60,3 @@
+  if (!HasNopl) {
+    // If true long nops are not supported we're going to use alternative nops,
+    // however not all of them are correct in 64 bit mode. Ideally we should
----------------
This is to fix https://llvm.org/bugs/show_bug.cgi?id=26554.

================
Comment at: lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp:88
@@ +87,3 @@
+      : MCAsmBackend(), CPU(CPU),
+        HasNopl(CPU == "" || STI.getFeatureBits()[X86::FeatureLongNop]),
+        MaxNopLength(getMaxNopLength(STI, HasNopl)) {}
----------------
Before this patch llvm would use true long nops when CPU is not specified, so I kept the behavior unchanged.


http://reviews.llvm.org/D17573





More information about the llvm-commits mailing list