URL
https://opencores.org/ocsvn/scarts/scarts/trunk
Subversion Repositories scarts
[/] [scarts/] [trunk/] [toolchain/] [scarts-binutils/] [binutils-2.19.1/] [cgen/] [mode.scm] - Rev 7
Go to most recent revision | Compare with Previous | Blame | View Log
; Mode objects. ; Copyright (C) 2000, 2009 Red Hat, Inc. ; This file is part of CGEN. ; See file COPYING.CGEN for details. ; FIXME: Later allow target to add new modes. ; One of RANDOM, INT, UINT, FLOAT. ; size in bits ; size in bytes ; NON-MODE-C-TYPE is the C type to use in situations where ; modes aren't available. A somewhat dubious feature, but at ; the moment the opcodes tables use it. It is either the C ; type as a string (e.g. "int") or #f for non-portable modes ; (??? could use other typedefs for #f, e.g. int64 for DI). ; Use of GCC can't be assumed though. ; PRINTF-TYPE is the %<letter> arg to printf-like functions, ; however we define our own extensions for non-portable modes. ; Values not understood by printf aren't intended to be used ; with printf. ; ; Possible values: ; %x - as always ; %D - DI mode (8 bytes) ; %T - TI mode (16 bytes) ; %O - OI mode (32 bytes) ; %f - SF,DF modes ; %F - XF,TF modes ; SEM-MODE is the mode to use for semantic operations. ; Unsigned modes are not part of the semantic language proper, ; but they can be used in hardware descriptions. This maps ; unusable -> usable modes. It is #f if the mode is usable by ; itself. This prevents circular data structures and makes it ; easy to define since the object doesn't exist before it's ; defined. ; ??? May wish to later remove SEM-MODE (e.g. mips signed add ; is different than mips unsigned add). However for now it keeps ; things simpler, and prevents being wildly dissimilar from ; GCC-RTL. And the mips case needn't be handled with different ; adds anyway. ; PTR-TO, if non-#f, is the mode being pointed to. ; HOST? is non-#f if the mode is a portable int for hosts, ; or other host-related value. ; This is used for things like register numbers and small ; odd-sized immediates and registers. ; ??? Not my favorite word choice here, but it's close. ; Accessor fns ; ptr-to is currently private so there is no accessor. ; Return string C type to use for values of mode M. " *"; CM is short for "concat mode". It is a list of modes of the elements ; of a `concat'. ; ??? Experiment. Not currently used. ; List of element modes ; Accessors. ; List of all modes. ; Return list of mode objects. ; Hides the fact that its stored as an alist from caller. ; Return list of real mode objects (no aliases). ; Return a boolean indicating if X is a <mode> object. ; Return enum cgen_mode_types value for M. "MODE_"; Return a boolean indicating if MODE1 is equal to MODE2 ; Either may be the name of a mode or a <mode> object. ; Aliases are handled by refering to their real name. ; Return a boolean indicating if CLASS is one of INT/UINT. ; Return a boolean indicating if CLASS is floating point. ; Return a boolean indicating if CLASS is numeric. ; Return a boolean indicating if MODE has an integral mode class. ; Similarily for signed/unsigned. ; Return a boolean indicating if MODE has a floating point mode class. ; Return a boolean indicating if MODE has a numeric mode class. ; Return a boolean indicating if MODE1 is compatible with MODE2. ; MODE[12] are either names or <mode> objects. ; HOW is a symbol indicating how the test is performed: ; strict: modes must have same name ; samesize: modes must be both float or both integer (int or uint) and have ; same size ; sameclass: modes must be both float or both integer (int or uint) ; numeric: modes must be both numeric "bad `how' arg to mode-compatible?"; Add MODE named NAME to the list of recognized modes. ; If NAME is already present, replace it with MODE. ; MODE is a mode object. ; NAME exists to allow aliases of modes [e.g. WI, UWI, AI, IAI]. ; ; No attempt to preserve any particular order of entries is done here. ; That is up to the caller. ; Parse a mode. ; This is the main routine for building a mode object. ; All arguments are in raw (non-evaluated) form. "Processing mode "" ...\n";; Pick out name first to augment the error context. "mode"; ??? At present there is no define-mode that takes an associative list ; of arguments. ; Define a mode object, all arguments specified. "define-full-mode"; Add it to the list of insn modes. ; Lookup the mode named X. ; Return the found object or #f. ; If X is already a mode object, return that. ; Return a boolean indicating if X is a valid mode name. ; FIXME: Time to make `mode-list' a hash table. ; Return the name of the real mode of M. ; This is a no-op unless M is an alias in which case we return the ; real mode of the alias. ; Return the real mode of M. ; This is a no-op unless M is an alias in which case we return the ; real mode of the alias. ; Return the version of MODE to use in semantic expressions. ; This (essentially) converts aliases to their real value and then uses ; mode:sem-mode. The implementation is the opposite but the effect is the ; same. ; ??? Less efficient than it should be. One improvement would be to ; disallow unsigned modes from being aliased and set sem-mode for aliased ; modes. ; Return #t if mode M1-NAME is bigger than mode M2-NAME. ; Return a mode in mode class CLASS wide enough to hold BITS. ; This ignores "host" modes (e.g. INT,UINT). "invalid mode class""no modes for bits"; Parse MODE-NAME and return the mode object. ; CONTEXT is a <context> object for error messages. ; An error is signalled if MODE isn't valid. "not a valid mode"; Make a new INT/UINT mode. ; These have a variable number of bits (1-64). "unsupported number of bits""unsupported number of bits"; WI/UWI/AI/IAI modes ; These are aliases for other modes, e.g. SI,DI. ; Final values are defered until all cpu family definitions have been ; read in so that we know the word size, etc. ; ; NOTE: We currently assume WI/AI/IAI all have the same size: cpu:word-bitsize. ; If we ever add an architecture that needs different modes for WI/AI/IAI, ; we can add the support then. ; This is defined by the target in define-cpu:word-bitsize. ; An "address int". This is recorded in addition to a "word int" because it ; is believed that some target will need it. It also stays consistent with ; what BFD does. It also allows one to write rtl without having to care ; what the real mode actually is. ; ??? These are currently set from define-cpu:word-bitsize but that's just ; laziness. If an architecture comes along that has different values, ; add the support then. ; Kind of word size handling wanted. ; BIGGEST: pick the largest word size ; IDENTICAL: all word sizes must be identical ; Called when a cpu-family is read in to set the word sizes. ; Ensure we found a precise match. "unable to find precise mode to match cpu word-bitsize"; Enforce word size kind. ; word size already set "app requires all selected cpu families to have same word size"; Called by apps to indicate cpu:word-bitsize always has one value. ; It is an error to call this if the selected cpu families have ; different word sizes. ; Must be called before loading .cpu files. ; Called by apps to indicate using the biggest cpu:word-bitsize of all ; selected cpu families. ; Must be called before loading .cpu files. ; Ensure word sizes have been defined. ; This must be called after all cpu families have been defined ; and before any ifields, hardware, operand or insns have been read. "word sizes must be defined"; Initialization. ; Some modes are refered to by the Scheme code. ; These have global bindings, but we try not to make this the general rule. ; [Actually I don't think this is all that bad, but it seems reasonable to ; not create global bindings that we don't have to.] ; Variable sized portable ints. "\ Define a mode, all arguments specified. "; Called before a . cpu file is read in to install any builtins. ; FN-SUPPORT: In sem-ops.h file, include prototypes as well as macros. ; Elsewhere, functions are defined to perform the operation. ; This list must be defined in order of increasing size among each type. "void""void"""; VOIDmode ; Special marker to indicate "use the default mode". ; ??? Not yet used everywhere it should be. "default mode"""""; Not UINT on purpose. "one bit (0,1 not 0,-1)""int""'x'""8 bit byte""int""'x'""16 bit int""int""'x'""32 bit int""int""'x'""64 bit int""""'D'"; No unsigned versions on purpose for now. "128 bit int""""'T'""256 bit int""""'O'""8 bit unsigned byte""unsigned int""'x'""16 bit unsigned int""unsigned int""'x'""32 bit unsigned int""unsigned int""'x'""64 bit unsigned int""""'D'"; Floating point values. "32 bit float""""'f'""64 bit float""""'f'""80/96 bit float""""'F'""128 bit float""""'F'"; These are useful modes that represent host values. ; For INT/UINT the sizes indicate maximum portable values. ; These are also used for random width hardware elements (e.g. immediates ; and registers). ; FIXME: Can't be used to represent both host and target values. ; Either remove the distinction or add new modes with the distinction. "portable int""int""'x'""portable unsigned int""unsigned int""'x'"; ??? Experimental. "host pointer""PTR""'x'"; While setting the real values of WI/UWI/AI/IAI is defered to ; mode-set-word-modes!, create entries in the list. ; Keep the fields sorted for mode-find.
Go to most recent revision | Compare with Previous | Blame | View Log