[LLVMdev] [RFC] CGContext skeleton implementation

Bill Wendling isanbard at gmail.com
Tue Nov 26 06:31:48 PST 2013


On Nov 25, 2013, at 4:40 PM, Dan Gohman <dan433584 at gmail.com> wrote:

> Hello llvm-dev,
> 
> Following up on the "CodeGen Context" discussion that was started, attached is patch which implements a pretty minimal skeleton of a CGContext implementation. The goal is to allow the newly added subtarget attributes on functions to be made available to codegen so that codegen can actually switch subtargets within a Module.
> 
> Comments and questions are invited herewith.
> 
> There has been some disagreement as to what to name this class. I have stuck with "CGContext" for now, though I'm absolutely not attached to that name.
> 
> It demonstrates where the CGContext state lives, how code can access it (in X86ISelLowering.cpp), how it reads the attributes from the IR, and how it gets cached.
> 
> One thing that it doesn't yet do is hook up to the target-specific subtarget feature interpretation. For example, it would need to hook up to the x86 subtarget code which knows that, for example, sse4.2 implies sse4.1, and so on. However, I'm sending this out now so that the other parts of the patch can get some feedback.
> 
Hi Dan,

Thanks for working on this! I like the direction this is going. One thing though, the function attributes no longer have “target-cpu” and “target-features” in them. I opted to separate out all of the different flags into separate attributes, instead of relying upon a single feature string. So the caching key would need to be modified here. Or do you think we should go back to adding back those attributes?

One thing to be addressed is when one function has attributes but the next function lacks them. Some type of default value needs to be assumed for the function lacking an attribute, and the context cached accordingly.

-bw





More information about the llvm-dev mailing list