Fix typos caused by find-and-replace

This commit is contained in:
Lachlan Sneff
2018-06-14 01:14:59 -04:00
committed by Dan Gohman
parent 5c320a0d30
commit 3686fc2fc7
26 changed files with 71 additions and 80 deletions

View File

@@ -110,7 +110,7 @@ Program structure
In LLVM IR, the largest representable unit is the *module* which corresponds In LLVM IR, the largest representable unit is the *module* which corresponds
more or less to a C translation unit. It is a collection of functions and more or less to a C translation unit. It is a collection of functions and
global valueiables that may contain references to external symbols too. global values that may contain references to external symbols too.
In Cretonne IR, the largest representable unit is the *function*. This is so In Cretonne IR, the largest representable unit is the *function*. This is so
that functions can easily be compiled in parallel without worrying about that functions can easily be compiled in parallel without worrying about

View File

@@ -554,7 +554,7 @@ stack overflow checks in the prologue.
the stack pointer has reached or exceeded the limit, generate a trap with a the stack pointer has reached or exceeded the limit, generate a trap with a
``stk_ovf`` code. ``stk_ovf`` code.
The global valueiable must be accessible and naturally aligned for a The global value must be accessible and naturally aligned for a
pointer-sized value. pointer-sized value.
Setting `stack_limit` is an alternative way to detect stack overflow, when using Setting `stack_limit` is an alternative way to detect stack overflow, when using
@@ -563,12 +563,12 @@ stack overflow checks in the prologue.
Global variables Global variables
---------------- ----------------
A *global valueiable* is an :term:`accessible` object in memory whose address is A *global value* is an :term:`accessible` object in memory whose address is
not known at compile time. The address is computed at runtime by not known at compile time. The address is computed at runtime by
:inst:`global_value`, possibly using information provided by the linker via :inst:`global_value`, possibly using information provided by the linker via
relocations. There are multiple kinds of global valueiables using different relocations. There are multiple kinds of global values using different
methods for determining their address. Cretonne does not track the type or even methods for determining their address. Cretonne does not track the type or even
the size of global valueiables, they are just pointers to non-stack memory. the size of global values, they are just pointers to non-stack memory.
When Cretonne is generating code for a virtual machine environment, globals can When Cretonne is generating code for a virtual machine environment, globals can
be used to access data structures in the VM's runtime. This requires functions be used to access data structures in the VM's runtime. This requires functions
@@ -578,26 +578,26 @@ Cretonne functions.
.. inst:: GV = vmctx+Offset .. inst:: GV = vmctx+Offset
Declare a global valueiable in the VM context struct. Declare a global value in the VM context struct.
This declares a global valueiable whose address is a constant offset from the This declares a global value whose address is a constant offset from the
VM context pointer which is passed as a hidden argument to all functions VM context pointer which is passed as a hidden argument to all functions
JIT-compiled for the VM. JIT-compiled for the VM.
Typically, the VM context is a C struct, and the declared global valueiable Typically, the VM context is a C struct, and the declared global value
is a member of the struct. is a member of the struct.
:arg Offset: Byte offset from the VM context pointer to the global :arg Offset: Byte offset from the VM context pointer to the global
variable. variable.
:result GV: Global variable. :result GV: Global variable.
The address of a global valueiable can also be derived by treating another global The address of a global value can also be derived by treating another global
variable as a struct pointer. This makes it possible to chase pointers into VM variable as a struct pointer. This makes it possible to chase pointers into VM
runtime data structures. runtime data structures.
.. inst:: GV = deref(BaseGV)+Offset .. inst:: GV = deref(BaseGV)+Offset
Declare a global valueiable in a struct pointed to by BaseGV. Declare a global value in a struct pointed to by BaseGV.
The address of GV can be computed by first loading a pointer from BaseGV The address of GV can be computed by first loading a pointer from BaseGV
and adding Offset to it. and adding Offset to it.
@@ -605,7 +605,7 @@ runtime data structures.
It is assumed the BaseGV resides in readable memory with the appropriate It is assumed the BaseGV resides in readable memory with the appropriate
alignment for storing a pointer. alignment for storing a pointer.
Chains of ``deref`` global valueiables are possible, but cycles are not Chains of ``deref`` global values are possible, but cycles are not
allowed. They will be caught by the IR verifier. allowed. They will be caught by the IR verifier.
:arg BaseGV: Global variable containing the base pointer. :arg BaseGV: Global variable containing the base pointer.
@@ -615,7 +615,7 @@ runtime data structures.
.. inst:: GV = [colocated] globalsym name .. inst:: GV = [colocated] globalsym name
Declare a global valueiable at a symbolic address. Declare a global value at a symbolic address.
The address of GV is symbolic and will be assigned a relocation, so that The address of GV is symbolic and will be assigned a relocation, so that
it can be resolved by a later linking phase. it can be resolved by a later linking phase.
@@ -701,7 +701,7 @@ trap when accessed.
address space reserved for the heap, not including the guard pages. address space reserved for the heap, not including the guard pages.
:arg GuardBytes: Size of the guard pages in bytes. :arg GuardBytes: Size of the guard pages in bytes.
When the base is a global valueiable, it must be :term:`accessible` and naturally When the base is a global value, it must be :term:`accessible` and naturally
aligned for a pointer value. aligned for a pointer value.
The ``reserved_reg`` option is not yet implemented. The ``reserved_reg`` option is not yet implemented.
@@ -711,7 +711,7 @@ Dynamic heaps
A *dynamic heap* can be relocated to a different base address when it is A *dynamic heap* can be relocated to a different base address when it is
resized, and its bound can move dynamically. The guard pages move when the heap resized, and its bound can move dynamically. The guard pages move when the heap
is resized. The bound of a dynamic heap is stored in a global valueiable. is resized. The bound of a dynamic heap is stored in a global value.
.. inst:: H = dynamic Base, min MinBytes, bound BoundGV, guard GuardBytes .. inst:: H = dynamic Base, min MinBytes, bound BoundGV, guard GuardBytes
@@ -724,7 +724,7 @@ is resized. The bound of a dynamic heap is stored in a global valueiable.
:arg BoundGV: Global variable containing the current heap bound in bytes. :arg BoundGV: Global variable containing the current heap bound in bytes.
:arg GuardBytes: Size of the guard pages in bytes. :arg GuardBytes: Size of the guard pages in bytes.
When the base is a global valueiable, it must be :term:`accessible` and naturally When the base is a global value, it must be :term:`accessible` and naturally
aligned for a pointer value. aligned for a pointer value.
The ``reserved_reg`` option is not yet implemented. The ``reserved_reg`` option is not yet implemented.

View File

@@ -15,7 +15,7 @@ The meta language descriptions are Python modules under the
steps: steps:
1. The Python modules are imported. This has the effect of building static data 1. The Python modules are imported. This has the effect of building static data
structures in global valueiables in the modules. These static data structures structures in global values in the modules. These static data structures
in the :mod:`base` and :mod:`isa` packages use the classes in the in the :mod:`base` and :mod:`isa` packages use the classes in the
:mod:`cdsl` package to describe instruction sets and other properties. :mod:`cdsl` package to describe instruction sets and other properties.
@@ -81,7 +81,7 @@ open :class:`InstructionGroup`.
:members: :members:
The basic Cretonne instruction set described in :doc:`langref` is defined by the The basic Cretonne instruction set described in :doc:`langref` is defined by the
Python module :mod:`base.instructions`. This module has a global valueiable Python module :mod:`base.instructions`. This module has a global value
:data:`base.instructions.GROUP` which is an :class:`InstructionGroup` instance :data:`base.instructions.GROUP` which is an :class:`InstructionGroup` instance
containing all the base instructions. containing all the base instructions.

View File

@@ -25,7 +25,7 @@ ebb0:
return v1 return v1
} }
; Refer to a global valueiable before it's been declared. ; Refer to a global value before it's been declared.
function %backref() -> i32 { function %backref() -> i32 {
gv1 = deref(gv2)-32 gv1 = deref(gv2)-32
; check: gv1 = deref(gv2)-32 ; check: gv1 = deref(gv2)-32

View File

@@ -16,7 +16,7 @@ ebb = EntityRefKind(
#: A reference to a stack slot declared in the function preamble. #: A reference to a stack slot declared in the function preamble.
stack_slot = EntityRefKind('stack_slot', 'A stack slot.') stack_slot = EntityRefKind('stack_slot', 'A stack slot.')
#: A reference to a global valueiable. #: A reference to a global value.
global_value = EntityRefKind('global_value', 'A global value.') global_value = EntityRefKind('global_value', 'A global value.')
#: A reference to a function sugnature declared in the function preamble. #: A reference to a function sugnature declared in the function preamble.

View File

@@ -79,5 +79,5 @@ CondTrap = InstructionFormat(VALUE, trapcode)
IntCondTrap = InstructionFormat(intcc, VALUE, trapcode) IntCondTrap = InstructionFormat(intcc, VALUE, trapcode)
FloatCondTrap = InstructionFormat(floatcc, VALUE, trapcode) FloatCondTrap = InstructionFormat(floatcc, VALUE, trapcode)
# Finally extract the names of global valueiables in this module. # Finally extract the names of global values in this module.
InstructionFormat.extract_names(globals()) InstructionFormat.extract_names(globals())

View File

@@ -53,7 +53,7 @@ call_conv = EnumSetting(
# Note that Cretonne doesn't currently need an is_pie flag, because PIE is just # Note that Cretonne doesn't currently need an is_pie flag, because PIE is just
# PIC where symbols can't be pre-empted, which can be expressed with the # PIC where symbols can't be pre-empted, which can be expressed with the
# `colocated` flag on external functions and global valueiables. # `colocated` flag on external functions and global values.
is_pic = BoolSetting("Enable Position-Independent Code generation") is_pic = BoolSetting("Enable Position-Independent Code generation")
colocated_libcalls = BoolSetting( colocated_libcalls = BoolSetting(

View File

@@ -208,7 +208,7 @@ class InstructionFormat(object):
""" """
Given a dict mapping name -> object as returned by `globals()`, find Given a dict mapping name -> object as returned by `globals()`, find
all the InstructionFormat objects and set their name from the dict key. all the InstructionFormat objects and set their name from the dict key.
This is used to name a bunch of global valueiables in a module. This is used to name a bunch of global values in a module.
""" """
for name, obj in globs.items(): for name, obj in globs.items():
if isinstance(obj, InstructionFormat): if isinstance(obj, InstructionFormat):

View File

@@ -365,7 +365,7 @@ class RegClass(object):
""" """
Given a dict mapping name -> object as returned by `globals()`, find Given a dict mapping name -> object as returned by `globals()`, find
all the RegClass objects and set their name from the dict key. all the RegClass objects and set their name from the dict key.
This is used to name a bunch of global valueiables in a module. This is used to name a bunch of global values in a module.
""" """
for name, obj in globs.items(): for name, obj in globs.items():
if isinstance(obj, RegClass): if isinstance(obj, RegClass):

View File

@@ -82,13 +82,13 @@ impl StackSlot {
} }
} }
/// An opaque reference to a global valueiable. /// An opaque reference to a global value.
#[derive(Copy, Clone, PartialEq, Eq, Hash)] #[derive(Copy, Clone, PartialEq, Eq, Hash)]
pub struct GlobalValue(u32); pub struct GlobalValue(u32);
entity_impl!(GlobalValue, "gv"); entity_impl!(GlobalValue, "gv");
impl GlobalValue { impl GlobalValue {
/// Create a new global valueiable reference from its number. /// Create a new global value reference from its number.
/// ///
/// This method is for use by the parser. /// This method is for use by the parser.
pub fn with_number(n: u32) -> Option<Self> { pub fn with_number(n: u32) -> Option<Self> {

View File

@@ -284,7 +284,7 @@ pub enum ArgumentPurpose {
/// A VM context pointer. /// A VM context pointer.
/// ///
/// This is a pointer to a context struct containing details about the current sandbox. It is /// This is a pointer to a context struct containing details about the current sandbox. It is
/// used as a base pointer for `vmctx` global valueiables. /// used as a base pointer for `vmctx` global values.
VMContext, VMContext,
/// A signature identifier. /// A signature identifier.

View File

@@ -145,7 +145,7 @@ impl Function {
self.dfg.ext_funcs.push(data) self.dfg.ext_funcs.push(data)
} }
/// Declares a global valueiable accessible to the function. /// Declares a global value accessible to the function.
pub fn create_global_value(&mut self, data: GlobalValueData) -> GlobalValue { pub fn create_global_value(&mut self, data: GlobalValueData) -> GlobalValue {
self.global_values.push(data) self.global_values.push(data)
} }

View File

@@ -4,7 +4,7 @@ use ir::immediates::Offset32;
use ir::{ExternalName, GlobalValue}; use ir::{ExternalName, GlobalValue};
use std::fmt; use std::fmt;
/// Information about a global valueiable declaration. /// Information about a global value declaration.
#[derive(Clone)] #[derive(Clone)]
pub enum GlobalValueData { pub enum GlobalValueData {
/// Variable is part of the VM context struct, it's address is a constant offset from the VM /// Variable is part of the VM context struct, it's address is a constant offset from the VM
@@ -14,13 +14,13 @@ pub enum GlobalValueData {
offset: Offset32, offset: Offset32,
}, },
/// Variable is part of a struct pointed to by another global valueiable. /// Variable is part of a struct pointed to by another global value.
/// ///
/// The `base` global valueiable is assumed to contain a pointer to a struct. This global /// The `base` global value is assumed to contain a pointer to a struct. This global
/// variable lives at an offset into the struct. The memory must be accessible, and /// variable lives at an offset into the struct. The memory must be accessible, and
/// naturally aligned to hold a pointer value. /// naturally aligned to hold a pointer value.
Deref { Deref {
/// The base pointer global valueiable. /// The base pointer global value.
base: GlobalValue, base: GlobalValue,
/// Byte offset to be added to the pointer loaded from `base`. /// Byte offset to be added to the pointer loaded from `base`.

View File

@@ -4,7 +4,7 @@ use ir::immediates::Offset32;
use ir::{ExternalName, GlobalValue}; use ir::{ExternalName, GlobalValue};
use std::fmt; use std::fmt;
/// Information about a global valueiable declaration. /// Information about a global value declaration.
#[derive(Clone)] #[derive(Clone)]
pub enum GlobalValueData { pub enum GlobalValueData {
/// Variable is part of the VM context struct, it's address is a constant offset from the VM /// Variable is part of the VM context struct, it's address is a constant offset from the VM
@@ -14,13 +14,13 @@ pub enum GlobalValueData {
offset: Offset32, offset: Offset32,
}, },
/// Variable is part of a struct pointed to by another global valueiable. /// Variable is part of a struct pointed to by another global value.
/// ///
/// The `base` global valueiable is assumed to contain a pointer to a struct. This global /// The `base` global value is assumed to contain a pointer to a struct. This global
/// variable lives at an offset into the struct. The memory must be accessible, and /// variable lives at an offset into the struct. The memory must be accessible, and
/// naturally aligned to hold a pointer value. /// naturally aligned to hold a pointer value.
Deref { Deref {
/// The base pointer global valueiable. /// The base pointer global value.
base: GlobalValue, base: GlobalValue,
/// Byte offset to be added to the pointer loaded from `base`. /// Byte offset to be added to the pointer loaded from `base`.

View File

@@ -29,7 +29,7 @@ pub enum HeapBase {
/// This feature is not yet implemented. /// This feature is not yet implemented.
ReservedReg, ReservedReg,
/// The heap base is in a global valueiable. The variable must be accessible and naturally /// The heap base is in a global value. The variable must be accessible and naturally
/// aligned for a pointer. /// aligned for a pointer.
GlobalValue(GlobalValue), GlobalValue(GlobalValue),
} }

View File

@@ -1,14 +1,14 @@
//! Legalization of global valueiables. //! Legalization of global values.
//! //!
//! This module exports the `expand_global_value` function which transforms a `global_value` //! This module exports the `expand_global_value` function which transforms a `global_value`
//! instruction into code that depends on the kind of global valueiable referenced. //! instruction into code that depends on the kind of global value referenced.
use cursor::{Cursor, FuncCursor}; use cursor::{Cursor, FuncCursor};
use flowgraph::ControlFlowGraph; use flowgraph::ControlFlowGraph;
use ir::{self, InstBuilder}; use ir::{self, InstBuilder};
use isa::TargetIsa; use isa::TargetIsa;
/// Expand a `global_value` instruction according to the definition of the global valueiable. /// Expand a `global_value` instruction according to the definition of the global value.
pub fn expand_global_value( pub fn expand_global_value(
inst: ir::Inst, inst: ir::Inst,
func: &mut ir::Function, func: &mut ir::Function,
@@ -46,7 +46,7 @@ fn vmctx_addr(inst: ir::Inst, func: &mut ir::Function, offset: i64) {
/// Expand a `global_value` instruction for a deref global. /// Expand a `global_value` instruction for a deref global.
fn deref_addr(inst: ir::Inst, func: &mut ir::Function, base: ir::GlobalValue, offset: i64) { fn deref_addr(inst: ir::Inst, func: &mut ir::Function, base: ir::GlobalValue, offset: i64) {
// We need to load a pointer from the `base` global valueiable, so insert a new `global_value` // We need to load a pointer from the `base` global value, so insert a new `global_value`
// instruction. This depends on the iterative legalization loop. Note that the IR verifier // instruction. This depends on the iterative legalization loop. Note that the IR verifier
// detects any cycles in the `deref` globals. // detects any cycles in the `deref` globals.
let ptr_ty = func.dfg.value_type(func.dfg.first_result(inst)); let ptr_ty = func.dfg.value_type(func.dfg.first_result(inst));

View File

@@ -920,7 +920,7 @@ impl Solver {
Some(reg) => reg, Some(reg) => reg,
None => { None => {
// If `v` must avoid global interference, there is not point in requesting // If `v` must avoid global interference, there is not point in requesting
// live registers be diverted. We need to make it a non-global valueiable. // live registers be diverted. We need to make it a non-global value.
if v.is_global && gregs.iter(rc).next().is_none() { if v.is_global && gregs.iter(rc).next().is_none() {
return Err(SolverError::Global(v.value)); return Err(SolverError::Global(v.value));
} else { } else {

View File

@@ -168,7 +168,7 @@ impl<'a> Verifier<'a> {
} }
} }
// Check for cycles in the global valueiable declarations. // Check for cycles in the global value declarations.
fn verify_global_values(&self) -> VerifierResult<()> { fn verify_global_values(&self) -> VerifierResult<()> {
let mut seen = SparseSet::new(); let mut seen = SparseSet::new();
@@ -415,7 +415,7 @@ impl<'a> Verifier<'a> {
fn verify_global_value(&self, inst: Inst, gv: GlobalValue) -> VerifierResult<()> { fn verify_global_value(&self, inst: Inst, gv: GlobalValue) -> VerifierResult<()> {
if !self.func.global_values.is_valid(gv) { if !self.func.global_values.is_valid(gv) {
err!(inst, "invalid global valueiable {}", gv) err!(inst, "invalid global value {}", gv)
} else { } else {
Ok(()) Ok(())
} }

View File

@@ -377,7 +377,7 @@ where
self.func.import_function(data) self.func.import_function(data)
} }
/// Declares a global valueiable accessible to the function. /// Declares a global value accessible to the function.
pub fn create_global_value(&mut self, data: GlobalValueData) -> GlobalValue { pub fn create_global_value(&mut self, data: GlobalValueData) -> GlobalValue {
self.func.create_global_value(data) self.func.create_global_value(data)
} }

View File

@@ -114,7 +114,7 @@ impl DataContext {
self.description.function_decls.push(name) self.description.function_decls.push(name)
} }
/// Declares a global valueiable import. /// Declares a global value import.
/// ///
/// TODO: Rename to import_data? /// TODO: Rename to import_data?
/// ///

View File

@@ -139,7 +139,7 @@ impl<'a> Context<'a> {
} }
} }
// Allocate a global valueiable slot. // Allocate a global value slot.
fn add_gv( fn add_gv(
&mut self, &mut self,
gv: GlobalValue, gv: GlobalValue,
@@ -156,10 +156,10 @@ impl<'a> Context<'a> {
self.map.def_gv(gv, loc) self.map.def_gv(gv, loc)
} }
// Resolve a reference to a global valueiable. // Resolve a reference to a global value.
fn check_gv(&self, gv: GlobalValue, loc: &Location) -> ParseResult<()> { fn check_gv(&self, gv: GlobalValue, loc: &Location) -> ParseResult<()> {
if !self.map.contains_gv(gv) { if !self.map.contains_gv(gv) {
err!(loc, "undefined global valueiable {}", gv) err!(loc, "undefined global value {}", gv)
} else { } else {
Ok(()) Ok(())
} }
@@ -401,7 +401,7 @@ impl<'a> Parser<'a> {
err!(self.loc, err_msg) err!(self.loc, err_msg)
} }
// Match and consume a global valueiable reference. // Match and consume a global value reference.
fn match_gv(&mut self, err_msg: &str) -> ParseResult<GlobalValue> { fn match_gv(&mut self, err_msg: &str) -> ParseResult<GlobalValue> {
if let Some(Token::GlobalValue(gv)) = self.token() { if let Some(Token::GlobalValue(gv)) = self.token() {
self.consume(); self.consume();
@@ -1077,7 +1077,7 @@ impl<'a> Parser<'a> {
Ok((ss, data)) Ok((ss, data))
} }
// Parse a global valueiable decl. // Parse a global value decl.
// //
// global-var-decl ::= * GlobalValue(gv) "=" global-var-desc // global-var-decl ::= * GlobalValue(gv) "=" global-var-desc
// global-var-desc ::= "vmctx" offset32 // global-var-desc ::= "vmctx" offset32
@@ -1085,28 +1085,19 @@ impl<'a> Parser<'a> {
// | globalsym ["colocated"] name // | globalsym ["colocated"] name
// //
fn parse_global_value_decl(&mut self) -> ParseResult<(GlobalValue, GlobalValueData)> { fn parse_global_value_decl(&mut self) -> ParseResult<(GlobalValue, GlobalValueData)> {
let gv = self.match_gv("expected global valueiable number: gv«n»")?; let gv = self.match_gv("expected global value number: gv«n»")?;
self.match_token( self.match_token(Token::Equal, "expected '=' in global value declaration")?;
Token::Equal,
"expected '=' in global valueiable declaration",
)?;
let data = match self.match_any_identifier("expected global valueiable kind")? { let data = match self.match_any_identifier("expected global value kind")? {
"vmctx" => { "vmctx" => {
let offset = self.optional_offset32()?; let offset = self.optional_offset32()?;
GlobalValueData::VMContext { offset } GlobalValueData::VMContext { offset }
} }
"deref" => { "deref" => {
self.match_token( self.match_token(Token::LPar, "expected '(' in 'deref' global value decl")?;
Token::LPar, let base = self.match_gv("expected global value: gv«n»")?;
"expected '(' in 'deref' global valueiable decl", self.match_token(Token::RPar, "expected ')' in 'deref' global value decl")?;
)?;
let base = self.match_gv("expected global valueiable: gv«n»")?;
self.match_token(
Token::RPar,
"expected ')' in 'deref' global valueiable decl",
)?;
let offset = self.optional_offset32()?; let offset = self.optional_offset32()?;
GlobalValueData::Deref { base, offset } GlobalValueData::Deref { base, offset }
} }
@@ -1115,7 +1106,7 @@ impl<'a> Parser<'a> {
let name = self.parse_external_name()?; let name = self.parse_external_name()?;
GlobalValueData::Sym { name, colocated } GlobalValueData::Sym { name, colocated }
} }
other => return err!(self.loc, "Unknown global valueiable kind '{}'", other), other => return err!(self.loc, "Unknown global value kind '{}'", other),
}; };
// Collect any trailing comments. // Collect any trailing comments.
@@ -1150,7 +1141,7 @@ impl<'a> Parser<'a> {
Some(Token::GlobalValue(base_num)) => { Some(Token::GlobalValue(base_num)) => {
let base_gv = match GlobalValue::with_number(base_num) { let base_gv = match GlobalValue::with_number(base_num) {
Some(gv) => gv, Some(gv) => gv,
None => return err!(self.loc, "invalid global valueiable number for heap base"), None => return err!(self.loc, "invalid global value number for heap base"),
}; };
HeapBase::GlobalValue(base_gv) HeapBase::GlobalValue(base_gv)
} }
@@ -1327,7 +1318,7 @@ impl<'a> Parser<'a> {
fn parse_stack_limit_decl(&mut self) -> ParseResult<GlobalValue> { fn parse_stack_limit_decl(&mut self) -> ParseResult<GlobalValue> {
self.consume(); self.consume();
self.match_token(Token::Equal, "expected '=' in stack limit declaration")?; self.match_token(Token::Equal, "expected '=' in stack limit declaration")?;
let gv = self.match_gv("expected global valueiable")?; let gv = self.match_gv("expected global value")?;
Ok(gv) Ok(gv)
} }
@@ -1904,7 +1895,7 @@ impl<'a> Parser<'a> {
imm: self.match_bool("expected immediate boolean operand")?, imm: self.match_bool("expected immediate boolean operand")?,
}, },
InstructionFormat::UnaryGlobalValue => { InstructionFormat::UnaryGlobalValue => {
let gv = self.match_gv("expected global valueiable")?; let gv = self.match_gv("expected global value")?;
ctx.check_gv(gv, &self.loc)?; ctx.check_gv(gv, &self.loc)?;
InstructionData::UnaryGlobalValue { InstructionData::UnaryGlobalValue {
opcode, opcode,

View File

@@ -36,7 +36,7 @@ impl SourceMap {
self.locations.contains_key(&ss.into()) self.locations.contains_key(&ss.into())
} }
/// Look up a global valueiable entity. /// Look up a global value entity.
pub fn contains_gv(&self, gv: GlobalValue) -> bool { pub fn contains_gv(&self, gv: GlobalValue) -> bool {
self.locations.contains_key(&gv.into()) self.locations.contains_key(&gv.into())
} }
@@ -154,7 +154,7 @@ impl SourceMap {
self.def_entity(entity.into(), loc) self.def_entity(entity.into(), loc)
} }
/// Define the global valueiable `entity`. /// Define the global value `entity`.
pub fn def_gv(&mut self, entity: GlobalValue, loc: &Location) -> ParseResult<()> { pub fn def_gv(&mut self, entity: GlobalValue, loc: &Location) -> ParseResult<()> {
self.def_entity(entity.into(), loc) self.def_entity(entity.into(), loc)
} }

View File

@@ -9,7 +9,7 @@ use translation_utils::{FunctionIndex, Global, GlobalIndex, Memory, MemoryIndex,
Table, TableIndex}; Table, TableIndex};
use wasmparser::BinaryReaderError; use wasmparser::BinaryReaderError;
/// The value of a WebAssembly global valueiable. /// The value of a WebAssembly global value.
#[derive(Clone, Copy)] #[derive(Clone, Copy)]
pub enum GlobalValue { pub enum GlobalValue {
/// This is a constant global with a value known at compile time. /// This is a constant global with a value known at compile time.
@@ -17,9 +17,9 @@ pub enum GlobalValue {
/// This is a variable in memory that should be referenced as a `GlobalValue`. /// This is a variable in memory that should be referenced as a `GlobalValue`.
Memory { Memory {
/// Which global valueiable should be referenced. /// Which global value should be referenced.
gv: ir::GlobalValue, gv: ir::GlobalValue,
/// The global valueiable's type. /// The global value's type.
ty: ir::Type, ty: ir::Type,
}, },
} }
@@ -88,12 +88,12 @@ pub trait FuncEnvironment {
ir::Type::int(u16::from(self.triple().pointer_width().unwrap().bits())).unwrap() ir::Type::int(u16::from(self.triple().pointer_width().unwrap().bits())).unwrap()
} }
/// Set up the necessary preamble definitions in `func` to access the global valueiable /// Set up the necessary preamble definitions in `func` to access the global value
/// identified by `index`. /// identified by `index`.
/// ///
/// The index space covers both imported globals and globals defined by the module. /// The index space covers both imported globals and globals defined by the module.
/// ///
/// Return the global valueiable reference that should be used to access the global and the /// Return the global value reference that should be used to access the global and the
/// WebAssembly type of the global. /// WebAssembly type of the global.
fn make_global(&mut self, func: &mut ir::Function, index: GlobalIndex) -> GlobalValue; fn make_global(&mut self, func: &mut ir::Function, index: GlobalIndex) -> GlobalValue;

View File

@@ -4,7 +4,7 @@
//! The code of theses helper function is straightforward since it is only about reading metadata //! The code of theses helper function is straightforward since it is only about reading metadata
//! about linear memories, tables, globals, etc. and storing them for later use. //! about linear memories, tables, globals, etc. and storing them for later use.
//! //!
//! The special case of the initialize expressions for table elements offsets or global valueiables //! The special case of the initialize expressions for table elements offsets or global values
//! is handled, according to the semantics of WebAssembly, to only specific expressions that are //! is handled, according to the semantics of WebAssembly, to only specific expressions that are
//! interpreted on the fly. //! interpreted on the fly.
use cretonne_codegen::ir::{self, AbiParam, Signature}; use cretonne_codegen::ir::{self, AbiParam, Signature};

View File

@@ -134,7 +134,7 @@ pub struct TranslationState {
pub control_stack: Vec<ControlStackFrame>, pub control_stack: Vec<ControlStackFrame>,
pub reachable: bool, pub reachable: bool,
// Map of global valueiables that have already been created by `FuncEnvironment::make_global`. // Map of global values that have already been created by `FuncEnvironment::make_global`.
globals: HashMap<GlobalIndex, GlobalValue>, globals: HashMap<GlobalIndex, GlobalValue>,
// Map of heaps that have been created by `FuncEnvironment::make_heap`. // Map of heaps that have been created by `FuncEnvironment::make_heap`.
@@ -272,7 +272,7 @@ impl TranslationState {
/// Methods for handling entity references. /// Methods for handling entity references.
impl TranslationState { impl TranslationState {
/// Get the `GlobalValue` reference that should be used to access the global valueiable `index`. /// Get the `GlobalValue` reference that should be used to access the global value `index`.
/// Create the reference if necessary. /// Create the reference if necessary.
/// Also return the WebAssembly type of the global. /// Also return the WebAssembly type of the global.
pub fn get_global<FE: FuncEnvironment + ?Sized>( pub fn get_global<FE: FuncEnvironment + ?Sized>(

View File

@@ -7,7 +7,7 @@ use wasmparser;
pub type FunctionIndex = usize; pub type FunctionIndex = usize;
/// Index of a table (imported or defined) inside the WebAssembly module. /// Index of a table (imported or defined) inside the WebAssembly module.
pub type TableIndex = usize; pub type TableIndex = usize;
/// Index of a global valueiable (imported or defined) inside the WebAssembly module. /// Index of a global value (imported or defined) inside the WebAssembly module.
pub type GlobalIndex = usize; pub type GlobalIndex = usize;
/// Index of a linear memory (imported or defined) inside the WebAssembly module. /// Index of a linear memory (imported or defined) inside the WebAssembly module.
pub type MemoryIndex = usize; pub type MemoryIndex = usize;