[PATCH] D70157: Align branches within 32-Byte boundary

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 14 15:32:01 PST 2019


MaskRay added inline comments.


================
Comment at: llvm/lib/MC/MCFragment.cpp:435
+    OS << "\n       ";
+    OS << "Subtype:" << MF->SubKind << "Size: " << MF->getSize();
+    break;
----------------
```
error: use of overloaded operator '<<' is ambiguous (with opera
nd types 'llvm::raw_ostream' and 'llvm::MCMachineDependentFragment::SubType')
```

It seems you haven't defined `raw_ostream &operator<<(raw_ostream &OS, MCMachineDependentFragment::SubType)`. I believe you also missed a space before `Size: `.


================
Comment at: llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp:88
+    SmallVector<StringRef, 6> BranchTypes;
+    StringRef(Val).split(BranchTypes, '-', -1, false);
+    for (auto BranchType : BranchTypes) {
----------------
skan wrote:
> craig.topper wrote:
> > skan wrote:
> > > craig.topper wrote:
> > > > skan wrote:
> > > > > chandlerc wrote:
> > > > > > I feel like a comma-separated list would be a bit more clear...
> > > > > We can't use comma-separated list because we need pass the option with flto.  "-Wl,-plugin-opt=--x86-align-branch-boundary=32,--plugin-opt=-x86-align-branch=fused,jcc,jmp,--plugin-opt=-x86-align-branch-prefix-size=5" would cause a compile fail because "jcc" was recognized as another option rather than a part of option "-x86-align-branch=fused,jcc,jmp" 
> > > > Isn't there some way to nest quotes into the part of after -plugin-opt= ?
> > > I tried to use --plugin-opt=-x86-align-branch="fused,jcc,jmp", it didn't work.
> > What if you put —plugin-opt=“-x86-align-branch=fused,jcc,jmp”
> It doesn't work too.
Both gcc and clang just split the -Wl argument by comma. There is no escape character. For reference, https://sourceware.org/ml/binutils/2019-11/msg00173.html is the GNU as patch on the binutils side.

Have you considered `+` plus? I think it may be more intuitive.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70157/new/

https://reviews.llvm.org/D70157





More information about the cfe-commits mailing list