Files
scriptc/native/llvm-codegen/src/target.h
T
Malte Ubl 60c30d6ebd Import runtime bitcode into speed programs (H02)
Re-lands perf/h02-runtime-lto (6d373317, b62448f3) behind the speed
posture.

- Runtime packs gain an executable `speed` flavor whenever the host LLVM
  helper can run. Its static units are emitted through the helper's
  `runtime-unit` command (promoted unit-local symbols, object and import
  bitcode from one module); its SCR_DYNAMIC variants reference the release
  objects. Release, dev, and library flavors and the vendor archives are
  built exactly as before (the rebuilt macOS pack's flavors and archives
  are identical to the baseline's).
- Speed program builds load the speed flavor's bitcode and pass it to the
  helper (`--import-bitcode`); release builds never do.
  loadRuntimeBitcode only reads a real speed flavor, never release.
- The helper drops the emitter's inert sanitize_address attributes only
  when it imports, so release modules reach the pipeline unchanged.
- Tests: runtime-pack.test.ts covers speed-variant bitcode selection,
  verification, and that release-flavor bitcode is never imported;
  native-codegen.test.ts covers helper arguments and cache keys.

Release executables stay byte-identical to the stack tip with the rebuilt
helper (14/14 workloads, macOS).
2026-10-08 15:46:34 -05:00

42 lines
1.3 KiB
C++

#pragma once
#include "llvm/ADT/StringRef.h"
#include <memory>
#include <string>
namespace llvm {
class TargetMachine;
}
namespace scriptc {
inline constexpr llvm::StringLiteral ProtocolVersion = "1";
inline constexpr llvm::StringLiteral LlvmVersion = "22.1.8";
#ifndef SCRIPTC_DEFAULT_TARGET
#define SCRIPTC_DEFAULT_TARGET "arm64-apple-macosx14.0.0"
#endif
#ifndef SCRIPTC_DEFAULT_DATA_LAYOUT
#define SCRIPTC_DEFAULT_DATA_LAYOUT "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32"
#endif
#ifndef SCRIPTC_TARGET_BACKENDS
#define SCRIPTC_TARGET_BACKENDS "AArch64"
#endif
#ifndef SCRIPTC_ALLOWED_TARGETS
#define SCRIPTC_ALLOWED_TARGETS "arm64-apple-macosx14.0.0"
#endif
inline constexpr llvm::StringLiteral DefaultTarget =
SCRIPTC_DEFAULT_TARGET;
inline constexpr llvm::StringLiteral DefaultDataLayout =
SCRIPTC_DEFAULT_DATA_LAYOUT;
inline constexpr llvm::StringLiteral TargetBackends = SCRIPTC_TARGET_BACKENDS;
inline constexpr llvm::StringLiteral AllowedTargets = SCRIPTC_ALLOWED_TARGETS;
void initializeTargets();
bool supportsTarget(llvm::StringRef Triple);
std::unique_ptr<llvm::TargetMachine>
createTargetMachine(llvm::StringRef Triple, llvm::StringRef OptLevel,
std::string &Error, bool RequireAllowed = true);
} // namespace scriptc