Closed Emoun closed 3 years ago
Found the following code snippet in PatmosFunctionSplitter.cpp
:
// should we check for i_size > MaxSize as well and issue a warning?
// => No, user should not get warnings if he cannot do anything about it
if (i_size > cache_size) {
report_fatal_error("Inline assembly in function " +
MBB->getParent()->getFunction()->getName() +
" is larger than the method cache size!");
}
MaxSize
here refers to the value of -mpatmos-max-subfunction-size
while i_size
I think refers to the current size of a block.
We can see that we issue an error if the method cache size is lower than the assembly block size, but the comment seems to suggest not issuing an error for subfunction size was a conscious decision.
However, I don't agree with the sentiment that the user cannot do anything about the subfunction size. He can redesign the inline assembly to be smaller or split it into multiple blocks, or he can change the value of the flag.
Take this program:
If we try to compile it with a 32 bytes method cache (
llc main.ll -mpatmos-max-subfunction-size=32
), it should fail, as we should not split inside an inline assembly block, and the block is twice the allowed size. However, this compiles successfully, without splitting the inline assembly block:This should be fixed, so that a compile error is thrown in such situations.