username_4567
username_4567

Reputation: 4923

Confusion about extension of LLVM IR file

What is the actual extension of a LLVM IR file? Is is .ll or .s? Some sources say it is .ll while some points to .s.

Upvotes: 15

Views: 3280

Answers (1)

Eli Bendersky
Eli Bendersky

Reputation: 273834

The real answer is that it doesn't matter. The tools can accept any file you give them, they don't care about the name. The name is just a convention.

To answer more directly, the traditional extension is .ll (for LLVM, I presume). However, some toolchains want to treat LLVM IR the same as assembly files and hence prefer to use the .s extension. Myself, I prefer .ll because it clarifies the difference more clearly. Using LLVM tools like llc it's possible to transform LLVM IR to machine-specific assembly, and I like seeing the .ll -> .s transition in this case. Having LLVM IR in .s files would be confusing.

Upvotes: 17

Related Questions