The AIX assembler .space directive can't take a second non-zero argument to fill
with. But LLVM emitFill currently assumes it can. We add a flag to the AsmInfo
to check if non-zero fill is supported, and if we can't zerofill non-zero values
we just splat the .byte directives.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/include/llvm/MC/MCAsmInfo.h | ||
---|---|---|
551 | Just a minor comment, is it better to name this function ifZeroDirectiveSupportsNonZeroValue() or doesZeroDirectiveSupportsNonZeroValue() since the return value is a boolean? | |
llvm/lib/MC/MCAsmStreamer.cpp | ||
1114 | Is .byte a AIX only directive? If yes, maybe we should assert OS as AIX as well? | |
llvm/test/CodeGen/PowerPC/aix-nonzero-zerofill.ll | ||
7 | Since the intention of this patch includes and if we can't zerofill non-zero values we just splat the .byte directives., we may also want to check correct format for this testcase ? |
llvm/lib/MC/MCAsmStreamer.cpp | ||
---|---|---|
1114 | I would expect the .byte directive should be generally applicable (it's supported by GAS among others). The assertion is not, we could in theory emit a non-constant expression for the ZeroDirective and let the assembler do the calculation, but we cannot do this if we are just going to write out the bytes. |
- Update test to add byte splat
- Rename MAI query to doesZeroDirectiveSupportNonZeroValue()
llvm/include/llvm/MC/MCAsmInfo.h | ||
---|---|---|
182 | Have we consider rename the ZeroDirective to FillDirective and fix the comments there? | |
llvm/lib/MC/MCAsmStreamer.cpp | ||
1117 | Make it a const variable so that we don't need to make a function call every time in the loop? |
llvm/include/llvm/MC/MCAsmInfo.h | ||
---|---|---|
182 | That's not really quite right either. Fill directive seems to imply .fill which has different semantics again (and doesn't exist for the AIX assembler). And if a fill directive only supports zero's isn't it really a zero directive? So maybe there should actually be both? In any case I'm not sure how much we really want to dig into the naming issue for this patch. We'd likely have to make a fairly widespread change. |
llvm/include/llvm/MC/MCAsmInfo.h | ||
---|---|---|
182 | If we don't want to be too pedantic about naming, let's at least fix the comments about ZeroDirective. From the comment, it says it's used to emit zero bytes. That's definitely not the case here. | |
llvm/lib/MC/MCAsmStreamer.cpp | ||
1101–1102 | nit: const? | |
1116 | nit: | |
1117 | instead of ".byte" , use MAI->getData8bitsDirective()? |
Have we consider rename the ZeroDirective to FillDirective and fix the comments there?
Since this ZeroDirective did not convey what it really means.
And this query is more like "FillDirectiveSupportsNonZeroFill".