[PATCH] D37798: Teach TargetInstrInfo::getInlineAsmLength to parse .space directives with integer arguments
Simon Dardis via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 13 05:11:06 PDT 2017
sdardis requested changes to this revision.
sdardis added inline comments.
This revision now requires changes to proceed.
================
Comment at: lib/CodeGen/TargetInstrInfo.cpp:104-107
+ while (isspace(static_cast<unsigned char>(*EStr)))
+ ++EStr;
+ if (*EStr == '\0') // Successfully parsed .space argument
+ AddLength = SpaceSize;
----------------
This code has unexpected behaviour in that it accepts a mixture of zero or more things that look like instructions or comments __ending__ with an optional .space <int> directive. If the .space directive is parsed and there is not zero or more spaces followed by the null byte, the value of space is discarded even if it was a positive number.
This bug was present in the original version, but it didn't occur to my knowledge as ".space <num>" was the only form used as far as I can see.
I think it is better to parse this properly so that people don't get tripped up over when trying to use this.
Aside: we may also want to handle .align, .fill at some point.
https://reviews.llvm.org/D37798
More information about the llvm-commits
mailing list