{ History ------- 12/09/85 - amend InitDefaults, call InitImp from InitCodeGeneration, - new include file impint.pf. 23/09/85 - set up Ecode arrays. 17/10/85 - History tidied. Documentation updated. Some redundant code removed from InitEcodes. (agh) 25/10/85 - Add range-check operations to InitEcodes. Initialise DftSpace in InitOthers. (agh) 06/11/85 - Initialise WordFns. (agh) 08/11/85 - Change BufferVarOfset to MCBufferOffset. (agh) 23/11/85 - Add initialisation of WordOps, UCheckOps, and CAPIndexOps. (agh) 04/12/85 - Remove references to CHKLWD, CHKUPD from BoundChecks. (agh) 04/12/85 - Remove CAPIndexOps. (agh) 09/12/85 - Initialise SystemRoutine. (agh) --------------------------------------------------------------------- 17/12/85 - Modifications following renaming of E-codes. (agh) } { MODULE 28 Code Generator Initialisation The code-generator is initialised systematically on a module by module basis by a call to procedure InitCodeGeneration made from the compiler program body. However, a number of generator vari- ables not associated with any module in particular are initialised here by procedures InitECodes, InitDefaults, and InitOthers. } program InitGenerator; #include "globals.x" #include "objvalues.pf" #include "datareps.pf" #include "storage.pf" #include "blocks.pf" #include "varref.pf" #include "expeval.pf" #include "stdprocs.pf" #include "withstmts.pf" #include "ctlstructs.pf" #include "impint.pf" procedure InitEcodes; begin IntOps[ Mul] := IMULT ; RealOps[ Mul] := RMULT ; IntOps[ Rdiv] := NOOP ; RealOps[ Rdiv] := RLDIV ; IntOps[AndOp] := NOOP ; RealOps[AndOp] := NOOP ; IntOps[ Idiv] := INDIV ; RealOps[ Idiv] := NOOP ; IntOps[ Imod] := IREM ; RealOps[ Imod] := NOOP ; IntOps[ Plus] := IADD ; RealOps[ Plus] := RADD ; IntOps[Minus] := ISUB ; RealOps[Minus] := RSUB ; IntOps[ OrOp] := NOOP ; RealOps[ OrOp] := NOOP ; IntOps[ LtOp] := ILT ; RealOps[ LtOp] := RLT ; IntOps[ LeOp] := ILE ; RealOps[ LeOp] := RLE ; IntOps[ GeOp] := NOOP ; RealOps[ GeOp] := NOOP ; IntOps[ GtOp] := NOOP ; RealOps[ GtOp] := NOOP; IntOps[ NeOp] := INE ; RealOps[ NeOp] := RNE ; IntOps[ EqOp] := IEQ ; RealOps[ EqOp] := REQ ; IntOps[ InOp] := NOOP ; RealOps[ InOp] := NOOP ; IntOps[NotOp] := NOOP ; RealOps[NotOp] := NOOP ; IntOps[SingleOp]:= NOOP ; RealOps[SingleOp] := NOOP ; IntOps[RangeOp] := NOOP ; RealOps[RangeOp] := NOOP ; StringOps[ Mul] := NOOP ; SetOps[ Mul] := SETI ; StringOps[ Rdiv] := NOOP ; SetOps[ Rdiv] := NOOP ; StringOps[AndOp] := NOOP ; SetOps[AndOp] := NOOP ; StringOps[ Idiv] := NOOP ; SetOps[ Idiv] := NOOP ; StringOps[ Imod] := NOOP ; SetOps[ Imod] := NOOP ; StringOps[ Plus] := NOOP ; SetOps[ Plus] := SETU ; StringOps[Minus] := NOOP ; SetOps[Minus] := SETD ; StringOps[ OrOp] := NOOP ; SetOps[ OrOp] := NOOP ; StringOps[ LtOp] := STRLT ; SetOps[ LtOp] := NOOP ; StringOps[ LeOp] := STRLE ; SetOps[ LeOp] := SETLE; StringOps[ GeOp] := NOOP ; SetOps[ GeOp] := NOOP ; StringOps[ GtOp] := NOOP ; SetOps[ GtOp] := NOOP ; StringOps[ NeOp] := STRNE ; SetOps[ NeOp] := SETNE; StringOps[ EqOp] := STREQ ; SetOps[ EqOp] := SETEQ; StringOps[ InOp] := NOOP ; SetOps[ InOp] := SETIN; StringOps[NotOp] := NOOP ; SetOps[NotOp] := NOOP ; StringOps[SingleOp]:=NOOP ; SetOps[SingleOp]:= SETSING; StringOps[ RangeOp]:=NOOP ; SetOps[ RangeOp]:= SETRANGE; WordOps[ Mul] := NOOP; BoundCheck[false, NoTest] := NOOP; WordOps[ Rdiv] := NOOP; BoundCheck[false, LtTest] := CHKLT; WordOps[AndOp] := NOOP; BoundCheck[false,LtdTest] := NOOP; WordOps[ Idiv] := NOOP; BoundCheck[false, GtTest] := CHKGT; WordOps[ Imod] := NOOP; BoundCheck[false,GtdTest] := NOOP; WordOps[ Plus] := UADD; BoundCheck[false, NeTest] := CHKNE; WordOps[Minus] := USUB; BoundCheck[false,RngError] := TRAP; WordOps[ OrOp] := NOOP; BoundCheck[true, NoTest] := NOOP; WordOps[ LtOp] := ULT; BoundCheck[true, LtTest] := UCHKLT; WordOps[ LeOp] := ULE; BoundCheck[true, LtdTest] := NOOP; WordOps[ GeOp] := UGE; BoundCheck[true, GtTest] := UCHKGT; WordOps[ NeOp] := UNE; BoundCheck[true, GtdTest] := NOOP; WordOps[ EqOp] := UEQ; BoundCheck[true, NeTest] := UCHKNE; WordOps[ InOp] := NOOP; BoundCheck[true,RngError] := TRAP; WordOps[SingleOp] := NOOP; WordOps[RangeOp] := NOOP; PtrOps[EqOp] := PTREQ ; PtrOps[NeOp] := PTRNE; CheckOps[false,false] := NOOP; UCheckOps[false,false] := NOOP; CheckOps[false,true ] := CHKGT; UCheckOps[false,true ] := UCHKGT; CheckOps[true ,false] := CHKLT; UCheckOps[true ,false] := UCHKLT; CheckOps[true ,true ] := CHKRNG; UCheckOps[true ,true ] := UCHKRNG; WordFns[AndWf] := IAND; SystemRoutine[Getp] := p_get; WordFns[OrWf ] := IOR; SystemRoutine[Putp] := p_put; WordFns[NeqWf] := IXOR; SystemRoutine[Closep] := p_close; WordFns[NotWf] := INOT; SystemRoutine[Resetp] := p_resetf; WordFns[ShWf ] := ICLPSH; SystemRoutine[Rewritep] := p_rewritef; WordFns[RotWf] := ICLPROT; SystemRoutine[Appendp] := p_appendf; SystemRoutine[Readlnp] := p_rdln; SystemRoutine[Sinf] := p_sin; SystemRoutine[Writelnp] := p_wrln; SystemRoutine[Cosf] := p_cos; SystemRoutine[Pagep] := p_page; SystemRoutine[Expf] := p_exp; SystemRoutine[Newp] := p_new1; Systemroutine[Lnf] := p_log; SystemRoutine[Disposep] := p_dispose1; SystemRoutine[Sqrtf]:= p_sqrt; SystemRoutine[Packp] := p_pack; SystemRoutine[Arctanf]:=p_arctan; SystemRoutine[Unpackp] := p_unpack; SystemRoutine[Linesp] := p_lines; SystemRoutine[Datep] := p_icldate; SystemRoutine[Timep] := p_icltime; end { initecodes }; procedure InitDefaults; begin with BufferOffset do begin ByteOffset := MCBufferOffset; FieldKind := Words; WordSize := 1 end; with DftAddress do begin BlockLevel := 0; ByteOffset := MCFirstOffset; Area := Stack; Adid := 0; end; with DftOffset do begin ByteOffset := 0; FieldKind := Words; WordSize := 1 end; with DftLabel do begin BlockLevel := 0; LabelId := -1; Adid := 0 end; with DftSpace do begin Number := 0; Size := 0 end end { initdefaults }; procedure InitOthers; begin StackConstant(ZeroValue); Pop(ZeroEntry); ContextOfCheck := IsUnknown end { initothers }; procedure InitCodeGeneration; visible; begin InitImp; InitEcodes; InitDefaults; InitValues; InitRepresentations; InitFrames; InitAllocator; InitPlabels; InitEmitter; InitRtSystem; InitStack; InitIO; InitWith; InitCase; InitFor; InitOthers end { initcodegeneration }; procedure EndCodeGeneration; visible; begin EndEmitter end { endcodegeneration }; begin { end of module } end.