Appearance
| 1 | namespace Semantic is | |
| 2 | // What a target's back end can consume. A pass asks before reporting a | |
| 3 | // feature the target cannot carry, so an editor and a batch build give | |
| 4 | // the same answer. | |
| 5 | trait TargetCapabilities is | |
| 6 | // Whether the target accepts a use of `capability`. | |
| 7 | is_supported(capability: Capability) -> bool | |
| 8 | ||
| 9 | // The name a diagnostic names the target by. | |
| 10 | target_name: string | |
| 11 | si | |
| 12 | ||
| 13 | // The .NET target: everything the front end accepts reaches the | |
| 14 | // emitter. | |
| 15 | class DOTNET_TARGET_CAPABILITIES: TargetCapabilities is | |
| 16 | init() is | |
| 17 | si | |
| 18 | ||
| 19 | is_supported(capability: Capability) -> bool => true | |
| 20 | ||
| 21 | target_name: string => "dotnet" | |
| 22 | si | |
| 23 | ||
| 24 | // The WebAssembly target: a `ref` to a local is held in a cell, and | |
| 25 | // nothing else in the enum is supported yet. | |
| 26 | class WASM_TARGET_CAPABILITIES: TargetCapabilities is | |
| 27 | init() is | |
| 28 | si | |
| 29 | ||
| 30 | is_supported(capability: Capability) -> bool => | |
| 31 | capability == Capability.REFERENCE \/ capability == Capability.LLVM_NAMESPACE | |
| 32 | ||
| 33 | target_name: string => "wasm" | |
| 34 | si | |
| 35 | ||
| 36 | // The LLVM target: as on WebAssembly, a `ref` to a local is held in a | |
| 37 | // cell. Pointers are not supported, and neither is a namespace named | |
| 38 | // `llvm`. | |
| 39 | class LLVM_TARGET_CAPABILITIES: TargetCapabilities is | |
| 40 | init() is | |
| 41 | si | |
| 42 | ||
| 43 | is_supported(capability: Capability) -> bool => | |
| 44 | capability == Capability.REFERENCE | |
| 45 | ||
| 46 | target_name: string => "llvm" | |
| 47 | si | |
| 48 | si |