next up previous contents
Next: Qualified Types Up: Type Previous: Label Types   Contents


Procedure Types

Unlike pointer, group, and array types, which are fairly straightforward and similar across a variety of languages, the information for a procedure type is fairly language-dependent. The CProcedureType provides for the kinds of argument type information that C provides for (``varargs'', old-style/new-style procedure types) with the addition of multiple results. Other languages could have their own variations on this and it is not clear how to make the procedure type representation more general and still useful for C-style type information. So we have split the abstract idea of a ProcedureType (the type required to be associated with procedure symbols and definitions) from the particular representation of procedure type information in the CProcedureType. This allows new kinds of ProcedureTypes to be added into the system without inheriting the baggage of the CProcedureType which might not be appropriate.

    abstract ProcedureType : Type
       {
          searchable_list<LString> qualifications;

       };

    concrete CProcedureType : ProcedureType
       {
          vector <QualifiedType * reference> arguments;
          DataType * reference result_type;
          bool has_varargs;
          bool arguments_known;
          int  bit_alignment;
       };
results The result type of the procedure. When the procedure has no return type, this will be a VoidType.
arguments A vector that contains the types of the arguments. The argument information may only be partly specified. (See below)
arguments_known If this is set to false, then there is no argument information at all. The arguments list will be empty, but that doesn't mean that there are no arguments - there may be some or there may be none. If arguments_known is true, then there is at least some information about arguments.
has_varargs If arguments_known is true and has_varargs is false, then the argument types are required to match those given in the arguments list. If has_varargs is true, however, then the arguments list only specifies a prefix of the arguments. Calls with this procedure must have at least as many arguments as there are on the arguments list with the proper types, and can optionally have any number of additional parameters.
bit_alignment The alignment of the procedure body.


next up previous contents
Next: Qualified Types Up: Type Previous: Label Types   Contents
SUIF Nightly Build
2000-08-14