Use roc_target over target_lexicon

Tailors a target class for our needs.
Replaces tons of uses across the entire compiler.
This is a base for later adding new targets like thumb.
This commit is contained in:
Brendan Hansknecht 2024-03-21 21:54:58 -07:00
parent 185262510c
commit 6dc5bfb1b7
No known key found for this signature in database
GPG key ID: 0EA784685083E75B
72 changed files with 1008 additions and 1371 deletions

View file

@ -67,7 +67,8 @@ fn write_types_for_module_real(module_id: ModuleId, filename: &str, output_path:
let arena = Bump::new();
let cwd = std::env::current_dir().unwrap();
let source = roc_builtins::roc::module_source(module_id);
let target_info = roc_target::TargetInfo::default_x86_64();
// This is just for typechecking. Target shouldn't matter.
let target = roc_target::Target::LinuxX64;
let function_kind = roc_solve::FunctionKind::LambdaSet;
let res_module = roc_load_internal::file::load_and_typecheck_str(
@ -76,7 +77,7 @@ fn write_types_for_module_real(module_id: ModuleId, filename: &str, output_path:
source,
cwd,
Default::default(),
target_info,
target,
function_kind,
roc_reporting::report::RenderTarget::ColorTerminal,
roc_reporting::report::DEFAULT_PALETTE,

View file

@ -6,7 +6,7 @@ use roc_collections::all::MutMap;
use roc_module::symbol::ModuleId;
use roc_packaging::cache::RocCacheDir;
use roc_reporting::report::{Palette, RenderTarget};
use roc_target::TargetInfo;
use roc_target::Target;
use std::path::PathBuf;
const SKIP_SUBS_CACHE: bool = {
@ -51,7 +51,7 @@ fn load<'a>(
pub fn load_single_threaded<'a>(
arena: &'a Bump,
load_start: LoadStart<'a>,
target_info: TargetInfo,
target: Target,
function_kind: FunctionKind,
render: RenderTarget,
palette: Palette,
@ -65,7 +65,7 @@ pub fn load_single_threaded<'a>(
arena,
load_start,
exposed_types,
target_info,
target,
function_kind,
cached_subs,
render,
@ -172,7 +172,7 @@ pub fn load_and_typecheck_str<'a>(
filename: PathBuf,
source: &'a str,
src_dir: PathBuf,
target_info: TargetInfo,
target: Target,
function_kind: FunctionKind,
render: RenderTarget,
roc_cache_dir: RocCacheDir<'_>,
@ -188,7 +188,7 @@ pub fn load_and_typecheck_str<'a>(
match load_single_threaded(
arena,
load_start,
target_info,
target,
function_kind,
render,
palette,

View file

@ -123,7 +123,7 @@ mod test_reporting {
let mut file = File::create(file_path).unwrap();
writeln!(file, "{module_src}").unwrap();
let load_config = LoadConfig {
target_info: roc_target::TargetInfo::default_x86_64(),
target: roc_target::Target::LinuxX64,
render: RenderTarget::Generic,
palette: DEFAULT_PALETTE,
threading: Threading::Single,