Skip to content

Conversation

@kinke
Copy link
Member

@kinke kinke commented Jun 3, 2017

I.e., llvm/CodeGen/CommandFlags.h which in turn includes llvm/MC/MCTargetOptionsCommandFlags.h.

This gets rid of a few duplicates on our side and includes about 35 (depending on LLVM version) new command-line options. LLVM provides a helper function to set up the TargetOptions according to (most of) these options.
Newer LLVM versions may add new options and we'll automatically inherit them, including setting up the TargetOptions accordingly.

I did my best (TM) to remove a few unused/undesirable options and hide all remaining new ones except for -fp-contract. The lists will need to be tweaked from time to time.

@kinke kinke changed the title Use LLVM headers for shared codegen command-line options [WIP] Use LLVM headers for shared codegen command-line options Jun 3, 2017
@kinke kinke force-pushed the cgoptions branch 2 times, most recently from b2eb329 to bc058b5 Compare June 3, 2017 19:36
@kinke
Copy link
Member Author

kinke commented Jun 3, 2017

The plan is to later copy the LLD wrappers into this .cpp module and hoping that the linker will use these ones for LLD instead of dragging in the LLD object (with conflicting command-line options). This approach should be scalable for other LLVM components including these shared headers.

Edit: If this works, it'll require LLD 5.0 due to the details here. :/

"use-ctors", "use-init-array", "emulated-tls", "unique-section-names",
"jump-table-type", "meabi", "debugger-tune", "asm-instrumentation",
"mc-relax-all", "incremental-linker-compatible", "asm-show-inst", "fcfi",
"cfi-type", "cfi-enforcing", "cfi-func-name", "pie-copy-relocations",
Copy link
Member Author

@kinke kinke Jun 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the most interesting part, the new hidden options, incl. some fine-grained FP math options.
Edit: They are also version specific, e.g., the 4 -*cfi* options are exclusively exposed by LLVM 3.6.

@kinke kinke force-pushed the cgoptions branch 3 times, most recently from 6b3afd1 to 7a538aa Compare June 3, 2017 22:04
@kinke kinke changed the title [WIP] Use LLVM headers for shared codegen command-line options [post-1.3] Use LLVM headers for shared codegen command-line options Jun 4, 2017
@kinke kinke changed the title [post-1.3] Use LLVM headers for shared codegen command-line options Use LLVM headers for shared codegen command-line options Jul 13, 2017
@kinke kinke mentioned this pull request Sep 8, 2017
kinke added a commit to kinke/ldc that referenced this pull request Sep 9, 2017
And allow CMake variable LDC_WITH_LLD to be specified on the command line.
LLD 5.0+ needs ldc-developers#2148 to avoid conflicting command-line options.
kinke added a commit to kinke/ldc that referenced this pull request Sep 9, 2017
And allow CMake variable LDC_WITH_LLD to be specified on the command line.
LLD 5.0+ needs ldc-developers#2148 to avoid conflicting command-line options.
@kinke
Copy link
Member Author

kinke commented Sep 12, 2017

Good to go now?

@kinke
Copy link
Member Author

kinke commented Sep 12, 2017

Dammit, linker flags order issue on Linux.
Edit: fixed.

I.e., llvm/CodeGen/CommandFlags.h which in turn includes
llvm/MC/MCTargetOptionsCommandFlags.h.

This gets rid of a few duplicates on our side and includes about 35
(depending on LLVM version) new command-line options. LLVM provides a
helper function to set up the TargetOptions according to (most of) these
options.
Newer LLVM versions may add new options and we'll automatically inherit
them, including setting up the TargetOptions accordingly.

I did my best (TM) to remove a few unused/undesirable options and hide all
remaining new ones except for `-fp-contract`. The lists will need to be
tweaked from time to time.
@JohanEngelen
Copy link
Member

It's a big change, and I did not do a very detailed review. It looks good to me.
I hope the semantics of all options stayed the same and that our tests have enough coverage for this.

@kinke kinke merged commit ae9d43c into ldc-developers:master Sep 19, 2017
@kinke kinke deleted the cgoptions branch September 19, 2017 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants