David Zarzycki via llvm-dev
2021-Mar-05 14:05 UTC
[llvm-dev] [RFC] Create llvm/Support/InternalLimits.h
Hello, There are internal limits within LLVM that are fundamental to how LLVM operates but are defined in awkward places when it comes to library layering. I'd like to propose that we fix that with a simple "InternalLimits.h" file that contains a few essential constants. For example, the maximum alignment supported by LLVM is defined by CodeGen but clang's Sema needs to know that value to enforce that users stay within bounds. That being said, clang's Sema doesn't need or want to depend on CodeGen for various good reasons. If we create llvm/Support/InternalLimits.h and define the alignment limit there, then LLVM's CodeGen and clang's Sema can both include that file without Sema creating a dependency on CodeGen. Thoughts? Dave
Aaron Ballman via llvm-dev
2021-Mar-05 14:23 UTC
[llvm-dev] [RFC] Create llvm/Support/InternalLimits.h
On Fri, Mar 5, 2021 at 9:05 AM David Zarzycki via llvm-dev <llvm-dev at lists.llvm.org> wrote:> > Hello, > > There are internal limits within LLVM that are fundamental to how LLVM operates but are defined in awkward places when it comes to library layering. I'd like to propose that we fix that with a simple "InternalLimits.h" file that contains a few essential constants. > > For example, the maximum alignment supported by LLVM is defined by CodeGen but clang's Sema needs to know that value to enforce that users stay within bounds. That being said, clang's Sema doesn't need or want to depend on CodeGen for various good reasons. > > If we create llvm/Support/InternalLimits.h and define the alignment limit there, then LLVM's CodeGen and clang's Sema can both include that file without Sema creating a dependency on CodeGen. > > Thoughts?Thank you for looking into this! I think that sounds like a reasonable approach. ~Aaron> Dave > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Johannes Doerfert via llvm-dev
2021-Mar-05 15:44 UTC
[llvm-dev] [RFC] Create llvm/Support/InternalLimits.h
Sounds good to me. Depending on the "limits" we might want to put it in llvm/IR/ though. Eventually we might want to have multiple (and all included form Frontend/InternalLimits.h) but let's see. ~ Johannes On 3/5/21 8:05 AM, David Zarzycki via llvm-dev wrote:> Hello, > > There are internal limits within LLVM that are fundamental to how LLVM operates but are defined in awkward places when it comes to library layering. I'd like to propose that we fix that with a simple "InternalLimits.h" file that contains a few essential constants. > > For example, the maximum alignment supported by LLVM is defined by CodeGen but clang's Sema needs to know that value to enforce that users stay within bounds. That being said, clang's Sema doesn't need or want to depend on CodeGen for various good reasons. > > If we create llvm/Support/InternalLimits.h and define the alignment limit there, then LLVM's CodeGen and clang's Sema can both include that file without Sema creating a dependency on CodeGen. > > Thoughts? > Dave > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Philip Reames via llvm-dev
2021-Mar-05 17:46 UTC
[llvm-dev] [RFC] Create llvm/Support/InternalLimits.h
Seems like a reasonable idea, but we want to be careful to define which internal limits are in scope, and which are not. For instance, ValueTracking has a bunch of internal scope limits for analysis purpose. Moving those into some generic location would seem like a mistake. Your example of alignment is a good one. As a idea, what if we specifically restricted this to internal limits of the IR representation? Or is that too narrow? What other specific limits are you thinking of? Philip On 3/5/21 6:05 AM, David Zarzycki via llvm-dev wrote:> Hello, > > There are internal limits within LLVM that are fundamental to how LLVM operates but are defined in awkward places when it comes to library layering. I'd like to propose that we fix that with a simple "InternalLimits.h" file that contains a few essential constants. > > For example, the maximum alignment supported by LLVM is defined by CodeGen but clang's Sema needs to know that value to enforce that users stay within bounds. That being said, clang's Sema doesn't need or want to depend on CodeGen for various good reasons. > > If we create llvm/Support/InternalLimits.h and define the alignment limit there, then LLVM's CodeGen and clang's Sema can both include that file without Sema creating a dependency on CodeGen. > > Thoughts? > Dave > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev