Skip to content

Commit 768fc3b

Browse files
committed
More pecos-qir cleanup
1 parent 927114b commit 768fc3b

File tree

8 files changed

+830
-825
lines changed

8 files changed

+830
-825
lines changed

crates/pecos-qir/src/compiler.rs

Lines changed: 12 additions & 627 deletions
Large diffs are not rendered by default.

crates/pecos-qir/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,8 @@ pub mod prelude;
99
pub mod runtime;
1010
pub mod state;
1111

12+
// Internal modules for compilation
13+
mod qir_compiler;
14+
mod runtime_builder;
15+
1216
pub use engine::QirEngine;

crates/pecos-qir/src/platform.rs

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,48 @@ pub use macos::*;
2929
#[must_use]
3030
pub fn standard_llvm_paths() -> Vec<PathBuf> {
3131
#[cfg(target_os = "windows")]
32-
return windows::WindowsCompiler::standard_llvm_paths();
32+
{
33+
vec![
34+
// CI environment - GitHub Actions might install LLVM here
35+
PathBuf::from("D:\\a\\_temp\\llvm\\bin"),
36+
// Standard installation paths
37+
PathBuf::from("C:\\Program Files\\LLVM\\bin"),
38+
PathBuf::from("C:\\Program Files (x86)\\LLVM\\bin"),
39+
// Common Windows package manager locations
40+
PathBuf::from("C:\\msys64\\mingw64\\bin"),
41+
PathBuf::from("C:\\msys64\\usr\\bin"),
42+
]
43+
}
3344

3445
#[cfg(target_os = "linux")]
35-
return linux::LinuxCompiler::standard_llvm_paths();
46+
{
47+
vec![
48+
PathBuf::from("/usr/bin"),
49+
PathBuf::from("/usr/local/bin"),
50+
PathBuf::from("/usr/lib/llvm/bin"),
51+
]
52+
}
3653

3754
#[cfg(target_os = "macos")]
38-
return macos::MacOSCompiler::standard_llvm_paths();
55+
{
56+
vec![
57+
PathBuf::from("/usr/bin"),
58+
PathBuf::from("/usr/local/bin"),
59+
PathBuf::from("/opt/homebrew/opt/llvm/bin"),
60+
]
61+
}
3962
}
4063

4164
/// Get platform-specific executable name
4265
#[must_use]
4366
pub fn executable_name(tool_name: &str) -> String {
4467
#[cfg(target_os = "windows")]
45-
return windows::WindowsCompiler::executable_name(tool_name);
68+
{
69+
format!("{tool_name}.exe")
70+
}
4671

47-
#[cfg(target_os = "linux")]
48-
return linux::LinuxCompiler::executable_name(tool_name);
49-
50-
#[cfg(target_os = "macos")]
51-
return macos::MacOSCompiler::executable_name(tool_name);
72+
#[cfg(not(target_os = "windows"))]
73+
{
74+
tool_name.to_string()
75+
}
5276
}
Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,10 @@
11
//! Linux-specific implementations for QIR compilation
22
3-
use std::path::PathBuf;
4-
53
/// Handle Linux-specific QIR compilation
64
pub struct LinuxCompiler;
75

86
impl LinuxCompiler {
9-
/// Get standard LLVM installation paths for Linux
10-
#[must_use]
11-
pub fn standard_llvm_paths() -> Vec<PathBuf> {
12-
vec![
13-
PathBuf::from("/usr/bin"),
14-
PathBuf::from("/usr/local/bin"),
15-
PathBuf::from("/usr/lib/llvm/bin"),
16-
]
17-
}
18-
19-
/// Get executable name for Linux
20-
#[must_use]
21-
pub fn executable_name(tool_name: &str) -> String {
22-
tool_name.to_string()
23-
}
7+
// Currently, Linux doesn't require any platform-specific implementations
8+
// beyond the common functionality provided in the parent module.
9+
// This struct exists for consistency and future extensibility.
2410
}

crates/pecos-qir/src/platform/macos.rs

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,14 @@
11
//! macOS-specific implementations for QIR compilation
22
3-
use log::{debug, warn};
3+
use log::debug;
44
use pecos_core::errors::PecosError;
5-
use std::path::{Path, PathBuf};
5+
use std::path::Path;
66
use std::process::Command;
77

88
/// Handle macOS-specific QIR compilation
99
pub struct MacOSCompiler;
1010

1111
impl MacOSCompiler {
12-
/// Log an error with thread ID
13-
pub fn log_error(error: PecosError, thread_id: &str) -> PecosError {
14-
warn!("QIR Compiler: [Thread {}] {}", thread_id, error);
15-
error
16-
}
17-
18-
/// Get standard LLVM installation paths for macOS
19-
pub fn standard_llvm_paths() -> Vec<PathBuf> {
20-
vec![
21-
PathBuf::from("/usr/bin"),
22-
PathBuf::from("/usr/local/bin"),
23-
PathBuf::from("/opt/homebrew/opt/llvm/bin"),
24-
]
25-
}
26-
27-
/// Get executable name for macOS
28-
pub fn executable_name(tool_name: &str) -> String {
29-
tool_name.to_string()
30-
}
31-
3212
/// Link object file and runtime library into a shared library on macOS
3313
///
3414
/// This method uses `-dynamiclib` instead of `-shared` as required by macOS linker

0 commit comments

Comments
 (0)