about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm/asm.rs
AgeCommit message (Collapse)AuthorLines
2020-06-16Add initial asm!() support for hexagonBrian Cain-0/+4
GPRs only
2020-05-30Rollup merge of #72625 - Amanieu:asm-srcloc, r=petrochenkovRalf Jung-8/+24
Improve inline asm error diagnostics Previously we were just using the raw LLVM error output (with line, caret, etc) as the diagnostic message, which ends up looking rather out of place with our existing diagnostics. The new diagnostics properly format the diagnostics and also take advantage of LLVM's per-line `srcloc` attribute to map an error in inline assembly directly to the relevant line of source code. Incidentally also fixes #71639 by disabling `srcloc` metadata during LTO builds since we don't know what crate it might have come from. We can only resolve `srcloc`s from the currently crate since it indexes into the source map for the current crate. Fixes #72664 Fixes #71639 r? @petrochenkov ### Old style ```rust #![feature(llvm_asm)] fn main() { unsafe { let _x: i32; llvm_asm!( "mov $0, $1 invalid_instruction $0, $1 mov $0, $1" : "=&r" (_x) : "r" (0) :: "intel" ); } } ``` ``` error: <inline asm>:3:14: error: invalid instruction mnemonic 'invalid_instruction' invalid_instruction ecx, eax ^~~~~~~~~~~~~~~~~~~ --> src/main.rs:6:9 | 6 | / llvm_asm!( 7 | | "mov $0, $1 8 | | invalid_instruction $0, $1 9 | | mov $0, $1" ... | 12 | | :: "intel" 13 | | ); | |__________^ ``` ### New style ```rust #![feature(asm)] fn main() { unsafe { asm!( "mov {0}, {1} invalid_instruction {0}, {1} mov {0}, {1}", out(reg) _, in(reg) 0i64, ); } } ``` ``` error: invalid instruction mnemonic 'invalid_instruction' --> test.rs:7:14 | 7 | invalid_instruction {0}, {1} | ^ | note: instantiated into assembly here --> <inline asm>:3:14 | 3 | invalid_instruction rax, rcx | ^^^^^^^^^^^^^^^^^^^ ```
2020-05-29Improve inline asm error diagnosticsAmanieu d'Antras-8/+24
2020-05-24Minor fixes, as requested in PR reviewMichal Sudwoj-4/+0
2020-05-24NVPTX support for new asm!Michal Sudwoj-0/+12
2020-05-18Move InlineAsmTemplatePiece and InlineAsmOptions to librustc_astAmanieu d'Antras-0/+1
2020-05-18Implement att_syntax optionAmanieu d'Antras-1/+5
2020-05-18Work around more LLVM limitationsAmanieu d'Antras-1/+76
2020-05-18Add support for high byte registers on x86Amanieu d'Antras-0/+3
2020-05-18Implement asm! codegenAmanieu d'Antras-15/+463
2020-03-26Rename asm! to llvm_asm!Amanieu d'Antras-3/+3
asm! is left as a wrapper around llvm_asm! to maintain compatibility.
2020-03-11Rollup merge of #69893 - tmiasko:cstr, r=petrochenkovMazdak Farrokhzad-11/+11
librustc_codegen_llvm: Use slices instead of 0-terminated strings Changed functions: * LLVMRustGetOrInsertFunction * LLVMRustGetNamedValue * LLVMRustBuildCall (removed unused name argument) * LLVMRustInlineAsm * LLVMRustInlineAsmVerify * LLVMRustAppendModuleInlineAsm
2020-03-11librustc_codegen_llvm: Use slices instead of 0-terminated stringsTomasz Miąsko-11/+11
Changed functions: * LLVMRustGetOrInsertFunction * LLVMRustGetNamedValue * LLVMRustBuildCall (removed unused name argument) * LLVMRustInlineAsm * LLVMRustInlineAsmVerify * LLVMRustAppendModuleInlineAsm
2020-03-09Check if output is immediate valueYuki Okushi-2/+8
2020-03-05Use more efficient &&str to String conversion (clippy::inefficient_to_string)Matthias Krüger-1/+1
2020-02-29Rename `syntax` to `rustc_ast` in source codeVadim Petrochenkov-1/+1
2020-01-05Remove rustc_hir reexports in rustc::hir.Mazdak Farrokhzad-1/+1
2020-01-01Rename `syntax_pos` to `rustc_span` in source codeVadim Petrochenkov-1/+1
2019-12-22Format the worldMark Rousskov-32/+37
2019-12-11rustc: Link LLVM directly into rustc againAlex Crichton-1/+1
This commit builds on #65501 continue to simplify the build system and compiler now that we no longer have multiple LLVM backends to ship by default. Here this switches the compiler back to what it once was long long ago, which is linking LLVM directly to the compiler rather than dynamically loading it at runtime. The `codegen-backends` directory of the sysroot no longer exists and all relevant support in the build system is removed. Note that `rustc` still supports a dynamically loaded codegen backend as it did previously, it just no longer supports dynamically loaded codegen backends in its own sysroot. Additionally as part of this the `librustc_codegen_llvm` crate now once again explicitly depends on all of its crates instead of implicitly loading them through the sysroot. This involved filling out its `Cargo.toml` and deleting all the now-unnecessary `extern crate` annotations in the header of the crate. (this in turn required adding a number of imports for names of macros too). The end results of this change are: * Rustbuild's build process for the compiler as all the "oh don't forget the codegen backend" checks can be easily removed. * Building `rustc_codegen_llvm` is much simpler since it's simply another compiler crate. * Managing the dependencies of `rustc_codegen_llvm` is much simpler since it's "just another `Cargo.toml` to edit" * The build process should be a smidge faster because there's more parallelism in the main rustc build step rather than splitting `librustc_codegen_llvm` out to its own step. * The compiler is expected to be slightly faster by default because the codegen backend does not need to be dynamically loaded. * Disabling LLVM as part of rustbuild is still supported, supporting multiple codegen backends is still supported, and dynamic loading of a codegen backend is still supported.
2019-11-21reduce size of hir::ExprKindMazdak Farrokhzad-1/+1
2019-08-17Remove SyntaxContext from {ast, hir}::{GlobalAsm, InlineAsm}Matthew Jasper-3/+4
We now store it in the `Span` of the expression or item.
2019-07-19hygiene: Tweak naming some moreVadim Petrochenkov-1/+1
2019-07-08normalize use of backticks for compiler messages in librustc_codegenSamy Kacimi-1/+1
https://github.com/rust-lang/rust/issues/60532
2019-06-11rustc_codegen_*: deny(unused_lifetimes).Eduard-Mihai Burtescu-1/+1
2019-03-29Remove inline_asm_call from cg_ssabjorn3-2/+46
`count_insn` is no longer called for inline asm, because it is private to builder.rs
2019-02-18librustc_codegen_llvm => 2018Taiki Endo-5/+5
2018-12-25Remove licensesMark Rousskov-10/+0
2018-11-29Use implicit deref instead of BuilderMethods::cx()bjorn3-6/+6
2018-11-16[eddyb] rustc_codegen_ssa: rename `interfaces` to `traits`.Eduard-Mihai Burtescu-1/+1
2018-11-16[eddyb] rustc_codegen_ssa: handle LLVM unsafety correctly.Eduard-Mihai Burtescu-2/+2
2018-11-16All Builder methods now take &mut self instead of &selfDenis Merigoux-1/+1
2018-11-16Finished moving backend-agnostic code to rustc_codegen_ssaDenis Merigoux-3/+3
2018-11-16Move doc to trait declarationsDenis Merigoux-1/+0
2018-11-16Generalized mir::codegen_mir (and all subsequent functions)Denis Merigoux-92/+96
2018-11-16Generalized base::coerce_unsized_intoDenis Merigoux-3/+3
2018-11-16Generalized memset and memcpyDenis Merigoux-1/+1
2018-11-16Removing LLVM content from CommonMethods -> ConstMethodsDenis Merigoux-1/+1
2018-11-16Prefixed type methods & removed trait impl for write::CodegenContextDenis Merigoux-2/+2
2018-11-16Prefixed const methods with "const" instead of "c"Denis Merigoux-1/+1
2018-11-16Traitification of type_ methodsDenis Merigoux-4/+3
The methods are now attached to CodegenCx instead of Type
2018-11-16Use the method form for CodegenCx everywhereDenis Merigoux-1/+1
2018-11-16Replaced Codegen field access by trait methodDenis Merigoux-6/+6
2018-11-16Traitification of common.rs methodsDenis Merigoux-3/+3
2018-11-16New files and folders for traitsDenis Merigoux-1/+1
Moved common enums to common
2018-11-16Generalized AsmDialect for BuilderMethodsDenis Merigoux-7/+1
2018-11-16Generalized base.rs#call_memcpy and everything that it usesDenis Merigoux-0/+1
Generalized operand.rs#nontemporal_store and fixed tidy issues Generalized operand.rs#nontemporal_store's implem even more With a BuilderMethod trait implemented by Builder for LLVM Cleaned builder.rs : no more code duplication, no more ValueTrait Full traitification of builder.rs
2018-11-16rustc_codegen_llvm: begin generalizing over backend values.Irina Popa-1/+1
2018-09-25codegen_llvm: check inline assembly constraints with LLVMLevente Kurusa-1/+7
LLVM provides a way of checking whether the constraints and the actual inline assembly make sense. This commit introduces a check before emitting code for the inline assembly. If LLVM rejects the inline assembly (or its constraints), then the compiler emits an error E0668 ("malformed inline assembly"). Signed-off-by: Levente Kurusa <lkurusa@acm.org>
2018-07-30rustc_codegen_llvm: use safe references for Value.Irina Popa-4/+5