diff --git a/m3-sys/llvm/llvm13/src/M3CG_LLVM.m3 b/m3-sys/llvm/llvm13/src/M3CG_LLVM.m3 index 3007f5df4a..64f3c677cd 100644 --- a/m3-sys/llvm/llvm13/src/M3CG_LLVM.m3 +++ b/m3-sys/llvm/llvm13/src/M3CG_LLVM.m3 @@ -11,6 +11,7 @@ UNSAFE MODULE M3CG_LLVM; opaque pointers in LLVM.i3 *) +(* m3core imports *) IMPORT Ctypes; IMPORT FileRd; IMPORT IntRefTbl; @@ -21,19 +22,23 @@ IMPORT Pathname; IMPORT Process; IMPORT Rd; IMPORT RefSeq; -IMPORT Text,TextExtras; +IMPORT Text; +IMPORT TextExtras; IMPORT TextRefTbl; IMPORT TextSeq; IMPORT Version; IMPORT Word; IMPORT Wr; -IMPORT DwarfConst AS DC; -IMPORT LLVM; -IMPORT LLVMTypes; -FROM LLVMTypes IMPORT int64_t , uint64_t , uint32_t, unsigned; -FROM LLVMTypes IMPORT ArrayRefOfMetadataRef, MetadataRef, StringRef,ArrayRefOfint64_t; + +(* m3middle imports *) IMPORT M3Buf; +IMPORT M3CG_Ops; +IMPORT M3ID; +IMPORT Target; +IMPORT TargetMap; +IMPORT TFloat; +IMPORT TInt, TWord; IMPORT M3CG; FROM M3CG IMPORT Name, ByteOffset, TypeUID, CallingConvention; FROM M3CG IMPORT BitSize, ByteSize, Alignment, Frequency; @@ -41,16 +46,14 @@ FROM M3CG IMPORT Var, Proc, Label, Sign, BitOffset; FROM M3CG IMPORT Type, ZType, AType, RType, IType, MType; FROM M3CG IMPORT CompareOp, ConvertOp, AtomicOp, RuntimeError; FROM M3CG IMPORT MemoryOrder; -IMPORT M3CG_Ops; -(* -IMPORT M3DIBuilder AS M3DIB; -*) + +(* llvmbinding imports *) +IMPORT DwarfConst AS DC; +IMPORT LLVM; +IMPORT LLVMTypes; +FROM LLVMTypes IMPORT int64_t , uint64_t , uint32_t, unsigned; +FROM LLVMTypes IMPORT ArrayRefOfMetadataRef, MetadataRef, StringRef,ArrayRefOfint64_t; IMPORT M3DebugInfo AS M3DIB; -IMPORT M3ID; -IMPORT Target; -IMPORT TargetMap; -IMPORT TFloat; -IMPORT TInt, TWord; <*FATAL ANY*> @@ -1911,7 +1914,6 @@ PROCEDURE AllocVar(self : U; v : LvVar) = (*^ CHECK is this the best way to calc offset *) (* this is negative for stacks growing down - what about other way *) v.ofs := -self.curProc.localOfs; - IO.PutInt(v.ofs); IO.Put("\n"); END AllocVar; (* PRE: We are inside a procedure body, possibly deeply inside nested blocks. *) @@ -2742,7 +2744,6 @@ PROCEDURE set_label (self: U; lab: Label; barrier: BOOLEAN) = but this is the correct branch - so delete the old one*) terminator := LLVM.LLVMGetBasicBlockTerminator(branch.branchBB); IF terminator # NIL THEN -IO.Put("Erasing terminator\n"); LLVM.LLVMInstructionEraseFromParent(terminator); END; LLVM.LLVMPositionBuilderAtEnd(builderIR,branch.branchBB); @@ -5551,7 +5552,7 @@ PROCEDURE CalcPaths(self : U) : TEXT = ELSIF Text.Equal(Text.Sub(prefix,0,2), "..") THEN arcs := Pathname.Decompose(prefix); <*ASSERT arcs.getlo() = NIL *> - arcs := TextSeq.Sub(arcs,2); (* remove root and .. *) + arcs := TextSeq.Sub(arcs,2); (* remove root and ... *) arcs.addlo(NIL); (* add the root dir back *) prefix := Pathname.Compose(arcs); self.debDir := Pathname.Join(cwd,prefix); @@ -5590,24 +5591,24 @@ PROCEDURE DebugInit(self: U) = DirectoryLen := Text.Length(self.debDir)); self.cuRef := M3DIB.CreateCompileUnit(self.debugRef, - Lang := M3DIB.LLVMDWARFSourceLanguage.DWARFSourceLanguageModula3, - FileRef := self.fileRef, - Producer := "cm3", - ProducerLen := 3, - isOptimized := FALSE, - Flags := NIL, - FlagsLen := 0, - RuntimeVer := 0, - SplitName := NIL, - SplitNameLen := 0, - Kind := M3DIB.LLVMDWARFEmissionKind.DWARFEmissionFull, - DWOId := 0, - SplitDebugInlining := TRUE, - DebugInfoForProfiling := FALSE, - SysRoot := NIL, - SysRootLen := 0, - SDK := NIL, - SDKLen := 0); + Lang := M3DIB.LLVMDWARFSourceLanguage.DWARFSourceLanguageModula3, + FileRef := self.fileRef, + Producer := "cm3", + ProducerLen := 3, + isOptimized := FALSE, + Flags := NIL, + FlagsLen := 0, + RuntimeVer := 0, + SplitName := NIL, + SplitNameLen := 0, + Kind := M3DIB.LLVMDWARFEmissionKind.DWARFEmissionFull, + DWOId := 0, + SplitDebugInlining := TRUE, + DebugInfoForProfiling := FALSE, + SysRoot := NIL, + SysRootLen := 0, + SDK := NIL, + SDKLen := 0); CreateModuleFlags(self); END DebugInit; @@ -5871,10 +5872,10 @@ a declare_local _result *) END; funcTy := M3DIB.CreateSubroutineType(self.debugRef, - File := self.fileRef, - ParameterTypes := paramsMetadata.Data, + File := self.fileRef, + ParameterTypes := paramsMetadata.Data, NumParameterTypes := numParams + 1, - Flags := 0); + Flags := 0); IF proc.parent # NIL THEN scope := proc.parent.funcScope.value; @@ -5882,20 +5883,20 @@ a declare_local _result *) scope := self.fileRef; END; - self.funcRef := M3DIB.CreateFunction(self.debugRef, - Scope := scope, - Name := procName, - NameLen := Text.Length(procName), - LinkageName := linkageName, - LinkageNameLen:= Text.Length(linkageName), - File := self.fileRef, - LineNo := self.curLine, - Ty := funcTy, - IsLocalToUnit := TRUE, - IsDefinition := TRUE, - ScopeLine := self.curLine, - Flags := 0, - IsOptimized := FALSE); + self.funcRef := M3DIB.CreateFunction(self.debugRef, + Scope := scope, + Name := procName, + NameLen := Text.Length(procName), + LinkageName := linkageName, + LinkageNameLen:= Text.Length(linkageName), + File := self.fileRef, + LineNo := self.curLine, + Ty := funcTy, + IsLocalToUnit := TRUE, + IsDefinition := TRUE, + ScopeLine := self.curLine, + Flags := 0, + IsOptimized := FALSE); proc.funcScope := NEW(BlockDebug, value := self.funcRef); @@ -5931,9 +5932,9 @@ PROCEDURE DebugPushBlock(self : U) = (* this val has to be referred to by the var as the scope *) lexBlock := M3DIB.CreateLexicalBlock(self.debugRef, - Scope := scope, - File := self.fileRef, - Line := self.curLine, + Scope := scope, + File := self.fileRef, + Line := self.curLine, Column := 0); blockRef := NEW(BlockDebug, value:= lexBlock); END; @@ -5973,11 +5974,11 @@ PROCEDURE DebugBasic(self : U; b : BaseDebug) : MetadataRef = BEGIN typeName := M3ID.ToText(b.typeName); RETURN M3DIB.CreateBasicType(self.debugRef, - Name := typeName, - NameLen := Text.Length(typeName), - SizeInBits := VAL(b.bitSize,uint64_t), - Encoding := b.encoding, - Flags := 0); + Name := typeName, + NameLen := Text.Length(typeName), + SizeInBits := VAL(b.bitSize,uint64_t), + Encoding := b.encoding, + Flags := 0); END DebugBasic; PROCEDURE DebugSubrange(self : U; subrange : SubrangeDebug) @@ -5987,7 +5988,6 @@ PROCEDURE DebugSubrange(self : U; subrange : SubrangeDebug) MLBase : BaseDebug; baseName,srName : TEXT; card : BOOLEAN := FALSE; -v13test : BOOLEAN := TRUE; BEGIN srName := M3ID.ToText(subrange.typeName); IF Text.Length(srName) = 0 THEN srName := "AnonSR"; END; @@ -6016,15 +6016,14 @@ v13test : BOOLEAN := TRUE; (* cannot use MLBase type since we need the correct size and encoding *) baseType := M3DIB.CreateBasicType(self.debugRef, - Name := baseName, - NameLen := Text.Length(baseName), - SizeInBits := VAL(subrange.bitSize,uint64_t), - Encoding := subrange.encoding, - Flags := 0); -(* temp until DebugInfo updated *) -IF v13test THEN - RETURN baseType; -END; + Name := baseName, + NameLen := Text.Length(baseName), + SizeInBits := VAL(subrange.bitSize,uint64_t), + Encoding := subrange.encoding, + Flags := 0); + +(* does not need llvm13 *) + RETURN baseType; IF MLBase = NIL AND card = FALSE THEN (* this case is for inbuilt integer longint char boolean widechar, @@ -6040,15 +6039,15 @@ END; END; END; -(* not in debuginfo yet +(* needs llvm13 Result := M3DIB.GetSubrangeConst (self.debugRef, - Scope := DebugScope(self,subrange), - Name := srName, - NameLen := Text.Length(srName), - File := self.fileRef, - BaseTy := baseType, - LowerBound := TIntToint64_t(subrange.min), - Count := TIntToint64_t(subrange.count)); + Scope := DebugScope(self,subrange), + Name := srName, + NameLen := Text.Length(srName), + File := self.fileRef, + BaseTy := baseType, + LowerBound := TIntToint64_t(subrange.min), + Count := TIntToint64_t(subrange.count)); *) (* REVIEW: How does llvm handle subranges for different signedness? *) @@ -6065,12 +6064,12 @@ PROCEDURE DebugPointer(self : U; p : PointerDebug) : MetadataRef = typeName := M3ID.ToText(p.typeName); RETURN M3DIB.CreatePointerType(self.debugRef, - PointeeTy := referentDIType, - SizeInBits := VAL(p.bitSize,uint64_t), - AlignInBits := VAL(p.align,uint32_t), - AddressSpace := 0, - Name := typeName, - NameLen := Text.Length(typeName)); + PointeeTy := referentDIType, + SizeInBits := VAL(p.bitSize,uint64_t), + AlignInBits := VAL(p.align,uint32_t), + AddressSpace := 0, + Name := typeName, + NameLen := Text.Length(typeName)); END DebugPointer; PROCEDURE DebugIndirect(self : U; p : IndirectDebug) : MetadataRef = @@ -6089,18 +6088,18 @@ PROCEDURE DebugArray(self : U; a : ArrayDebug) : MetadataRef = DebugLookupOrdinalBounds (self, a.index, (*OUT*)min, (*OUT*)count); subsVal := M3DIB.GetOrCreateSubrange(self.debugRef, - LowerBound := TIntToint64_t(min), - Count := TIntToint64_t(count)); + LowerBound := TIntToint64_t(min), + Count := TIntToint64_t(count)); NewArrayRefOfMetadataRef(1, (*OUT*)paramsArr, (*OUT*)paramsMetadata); paramsArr[0] := subsVal; arrDIT := M3DIB.CreateArrayType(self.debugRef, - Size := VAL(a.bitSize,uint64_t), - AlignInBits := VAL(a.align,uint32_t), - Ty := eltVal, - Subscripts := paramsMetadata.Data, - NumSubscripts := 1); + Size := VAL(a.bitSize,uint64_t), + AlignInBits := VAL(a.align,uint32_t), + Ty := eltVal, + Subscripts := paramsMetadata.Data, + NumSubscripts := 1); RETURN arrDIT; END DebugArray; @@ -6116,7 +6115,6 @@ PROCEDURE DebugOpenArray(self : U; a : OpenArrayDebug; ofs : CARDINAL := 0) : Me elts : MetadataRef; typeName : TEXT; srBaseType : MetadataRef; -v13test : BOOLEAN := TRUE; (* temp until debuginfo has open array support *) BEGIN (* data location only really meaningful for outermost dimension *) IF ofs = 0 THEN @@ -6140,51 +6138,49 @@ v13test : BOOLEAN := TRUE; (* temp until debuginfo has open array support *) srBaseType := DebugLookupLL(self,UID_INTEGER); -IF v13test THEN +(* does not need llvm13 *) subrange := M3DIB.GetOrCreateSubrange(self.debugRef, - LowerBound := TIntToint64_t(TInt.Zero), - Count := TIntToint64_t(TInt.One)); -ELSE + LowerBound := TIntToint64_t(TInt.Zero), + Count := TIntToint64_t(TInt.One)); + +(* needs llvm13 typeName := M3ID.ToText(a.typeName) & "_rng"; -(* not in v13 *) -(* subrange := M3DIB.GetSubrangeExpr (self.debugRef, - Scope := DebugScope(self,a), - Name := typeName, - NameLen := Text.Length(typeName), - File := self.fileRef, - BaseTy := srBaseType, - LowerBound := low, - Count := cnt); + Scope := DebugScope(self,a), + Name := typeName, + NameLen := Text.Length(typeName), + File := self.fileRef, + BaseTy := srBaseType, + LowerBound := low, + Count := cnt); *) -END; NewArrayRefOfMetadataRef(1, (*OUT*)paramsArr, (*OUT*)paramsMetadata); paramsArr[0] := subrange; -IF v13test THEN +(* does not need llvm13 *) oarrDIT := M3DIB.CreateArrayType(self.debugRef, - Size := VAL(a.bitSize,uint64_t), - AlignInBits := VAL(a.align,uint32_t), - Ty := elts, - Subscripts := paramsMetadata.Data, - NumSubscripts := 1); -ELSE -(* not in v13 actually not in DebugInfo since the guy who did + Size := VAL(a.bitSize,uint64_t), + AlignInBits := VAL(a.align,uint32_t), + Ty := elts, + Subscripts := paramsMetadata.Data, + NumSubscripts := 1); + +(* needs llvm13 + not in v13 actually not in DebugInfo since the guy who did the fortran updates didnt do the C interface. oarrDIT := M3DIB.CreateDynamicArrayType(self.debugRef, - Size := 0L, (* we dont know the size *) - AlignInBits := VAL(a.align,uint32_t), - Ty := elts, - Subscripts := paramsMetadata.Data, - NumSubscripts := 1, - DataLocation := dataLoc, - Associated := NIL, - Allocated := NIL, - Rank := NIL); (* rank needed if genericsubrange used *) + Size := 0L, (* we dont know the size *) + AlignInBits := VAL(a.align,uint32_t), + Ty := elts, + Subscripts := paramsMetadata.Data, + NumSubscripts := 1, + DataLocation := dataLoc, + Associated := NIL, + Allocated := NIL, + Rank := NIL); (* rank needed if genericsubrange used *) *) -END; a.diType := oarrDIT; @@ -6196,27 +6192,23 @@ PROCEDURE DebugSet(self : U; s : SetDebug) : MetadataRef = baseType : MetadataRef; setDIT : MetadataRef; typeName : TEXT; -v13test : BOOLEAN := TRUE; (* temp until set in debuginfo *) BEGIN baseType := DebugLookupLL(self,s.domain); -(* not in debuginfo *) -IF v13test THEN +(* does not need llvm13 *) setDIT := baseType; -ELSE +(* needs llvm13 typeName := M3ID.ToText(s.typeName); -(* not in debuginfo yet setDIT := M3DIB.CreateSetType(self.debugRef, - Scope := DebugScope(self,s), - Name := typeName, - NameLen := Text.Length(typeName), - File := self.fileRef, - LineNumber := self.curLine, - SizeInBits := VAL(s.bitSize,uint64_t), - AlignInBits := VAL(s.align,uint32_t), - BaseTy := baseType); + Scope := DebugScope(self,s), + Name := typeName, + NameLen := Text.Length(typeName), + File := self.fileRef, + LineNumber := self.curLine, + SizeInBits := VAL(s.bitSize,uint64_t), + AlignInBits := VAL(s.align,uint32_t), + BaseTy := baseType); *) -END; RETURN setDIT; END DebugSet; @@ -6240,18 +6232,18 @@ PROCEDURE DebugEnum(self : U; e : EnumDebug) : MetadataRef = paramsArr[i] := eltVal; END; - typeName := M3ID.ToText(e.typeName); - RETURN M3DIB.CreateEnumerationType(self.debugRef, - Scope := DebugScope(self,e), - Name := typeName, - NameLen := Text.Length(typeName), - File := self.fileRef, - LineNumber := self.curLine, - SizeInBits := VAL(e.bitSize,uint64_t), - AlignInBits := VAL(e.align,uint32_t), - Elements := paramsMetadata.Data, - NumElements := e.numElts, - ClassTy := NIL); + typeName := M3ID.ToText(e.typeName); + RETURN M3DIB.CreateEnumerationType(self.debugRef, + Scope := DebugScope(self,e), + Name := typeName, + NameLen := Text.Length(typeName), + File := self.fileRef, + LineNumber := self.curLine, + SizeInBits := VAL(e.bitSize,uint64_t), + AlignInBits := VAL(e.align,uint32_t), + Elements := paramsMetadata.Data, + NumElements := e.numElts, + ClassTy := NIL); END DebugEnum; @@ -6289,12 +6281,12 @@ FIXME^ - need to handle recursive proc type typeName := M3ID.ToText(p.typeName); PTy := M3DIB.CreatePointerType(self.debugRef, - PointeeTy := tempTy, - SizeInBits := VAL(p.bitSize,uint64_t), - AlignInBits := VAL(p.align,uint32_t), - AddressSpace := 0, - Name := typeName, - NameLen := Text.Length(typeName)); + PointeeTy := tempTy, + SizeInBits := VAL(p.bitSize,uint64_t), + AlignInBits := VAL(p.align,uint32_t), + AddressSpace := 0, + Name := typeName, + NameLen := Text.Length(typeName)); p.diType := PTy; *) IF p.numFormals > 0 THEN @@ -6304,21 +6296,20 @@ FIXME^ - need to handle recursive proc type END; END; - LDISubprogTy - := M3DIB.CreateSubroutineType(self.debugRef, - File := self.fileRef, - ParameterTypes := paramsMetadata.Data, - NumParameterTypes := p.numFormals + 1, - Flags := 0); + LDISubprogTy := M3DIB.CreateSubroutineType(self.debugRef, + File := self.fileRef, + ParameterTypes := paramsMetadata.Data, + NumParameterTypes := p.numFormals + 1, + Flags := 0); typeName := M3ID.ToText(p.typeName); PTy := M3DIB.CreatePointerType(self.debugRef, - PointeeTy := LDISubprogTy, - SizeInBits := VAL(p.bitSize,uint64_t), - AlignInBits := VAL(p.align,uint32_t), - AddressSpace := 0, - Name := typeName, - NameLen := Text.Length(typeName)); + PointeeTy := LDISubprogTy, + SizeInBits := VAL(p.bitSize,uint64_t), + AlignInBits := VAL(p.align,uint32_t), + AddressSpace := 0, + Name := typeName, + NameLen := Text.Length(typeName)); (* does not work - a replacetypes similar to replacearrays @@ -6349,17 +6340,17 @@ PROCEDURE DebugObject(self : U; o : ObjectDebug) : MetadataRef = IF o.opaque THEN className := "__OpaqueObject"; opaqueObjectDIT := M3DIB.CreateForwardDecl (self.debugRef, - Tag := DC.DW_TAG_class_type, - Name := className, - NameLen := Text.Length(className), - Scope := DebugScope(self,o), - File := self.fileRef, - Line := self.curLine, - RuntimeLang := 0, - SizeInBits := 0L, - AlignInBits := 0, - UniqueIdentifier := uniqueId, - UniqueIdentifierLen := Text.Length(uniqueId)); + Tag := DC.DW_TAG_class_type, + Name := className, + NameLen := Text.Length(className), + Scope := DebugScope(self,o), + File := self.fileRef, + Line := self.curLine, + RuntimeLang := 0, + SizeInBits := 0L, + AlignInBits := 0, + UniqueIdentifier := uniqueId, + UniqueIdentifierLen := Text.Length(uniqueId)); o.objectType := opaqueObjectDIT; @@ -6372,23 +6363,21 @@ PROCEDURE DebugObject(self : U; o : ObjectDebug) : MetadataRef = (*OUT*) paramsMetadata); typeName := M3ID.ToText(o.typeName) & "__HeapObject"; - heapObjectDIT - := M3DIB.CreateReplaceableCompositeType - (self.debugRef, - Tag := DC.DW_TAG_class_type, - Name := typeName, - NameLen := Text.Length(typeName), - Scope := DebugScope(self,o), - File := self.fileRef, - Line := self.curLine, + heapObjectDIT := M3DIB.CreateReplaceableCompositeType (self.debugRef, + Tag := DC.DW_TAG_class_type, + Name := typeName, + NameLen := Text.Length(typeName), + Scope := DebugScope(self,o), + File := self.fileRef, + Line := self.curLine, (* CHECK ^ the line number is pretty meaningless for the type since it is usually at the beginning of the module not at the type creation line. *) - RuntimeLang := 0, - SizeInBits := VAL(o.objSize + ptrBits,uint64_t), - AlignInBits := VAL(o.align,uint32_t), - Flags := 0, - UniqueIdentifier := uniqueId, - UniqueIdentifierLen := Text.Length(uniqueId)); + RuntimeLang := 0, + SizeInBits := VAL(o.objSize + ptrBits,uint64_t), + AlignInBits := VAL(o.align,uint32_t), + Flags := 0, + UniqueIdentifier := uniqueId, + UniqueIdentifierLen := Text.Length(uniqueId)); (* save for possible inherit node *) o.objectType := heapObjectDIT; @@ -6399,12 +6388,12 @@ PROCEDURE DebugObject(self : U; o : ObjectDebug) : MetadataRef = typeName := M3ID.ToText(o.typeName); ptrDIT := M3DIB.CreatePointerType(self.debugRef, - PointeeTy := heapObjectDIT, - SizeInBits := VAL(ptrBits,uint64_t), - AlignInBits := VAL(ptrBits,uint32_t), - AddressSpace := 0, - Name := typeName, - NameLen := Text.Length(typeName)); + PointeeTy := heapObjectDIT, + SizeInBits := VAL(ptrBits,uint64_t), + AlignInBits := VAL(ptrBits,uint32_t), + AddressSpace := 0, + Name := typeName, + NameLen := Text.Length(typeName)); (* save for recursive lookups in fields *) o.diType := ptrDIT; @@ -6424,17 +6413,15 @@ PROCEDURE DebugObject(self : U; o : ObjectDebug) : MetadataRef = superObj := NARROW(debugObj,ObjectDebug); EnsureDebugTypeName(superObj); - (* Create a DIBuilder inherit node connecting to the supertype + (* Create a DIBuilder inherit node connecting to the supertype and make it the first "param". *) - inheritDIT - := M3DIB.CreateInheritance - (self.debugRef, - Ty := heapObjectDIT, - BaseTy := superObj.objectType, - BaseOffset := VAL(0L,uint64_t), - VBPtrOffset := 0, - Flags := 0); + inheritDIT := M3DIB.CreateInheritance (self.debugRef, + Ty := heapObjectDIT, + BaseTy := superObj.objectType, + BaseOffset := VAL(0L,uint64_t), + VBPtrOffset := 0, + Flags := 0); paramsArr[0] := inheritDIT; ELSE paramsArr[0] := NIL; (* Is this truly a C++ null? *) @@ -6491,11 +6478,12 @@ PROCEDURE DebugObject(self : U; o : ObjectDebug) : MetadataRef = END; (* this works *) +(* needs llvm13 M3DIB.LLVMReplaceArrays(self.debugRef, T := ADR(heapObjectDIT), Elements := paramsMetadata.Data, NumElements := nextMemberNo); - +*) (* this should work but no. M3DIB.LLVMMetadataReplaceAllUsesWith( TempTargetMetadata := heapObjectDIT, @@ -6520,20 +6508,19 @@ PROCEDURE DebugRecord(self : U; r : RecordDebug) : MetadataRef = (r.numFields, (*OUT*)paramsArr, (*OUT*)paramsMetadata); typeName := M3ID.ToText(r.typeName); - structDIT - := M3DIB.CreateReplaceableCompositeType(self.debugRef, - Tag := DC.DW_TAG_structure_type, - Name := typeName, - NameLen := Text.Length(typeName), - Scope := DebugScope(self,r), - File := self.fileRef, - Line := self.curLine, - RuntimeLang := 0, - SizeInBits := VAL(r.bitSize,uint64_t), - AlignInBits := VAL(r.align,uint32_t), - Flags := 0, - UniqueIdentifier := uniqueId, - UniqueIdentifierLen := Text.Length(uniqueId)); + structDIT := M3DIB.CreateReplaceableCompositeType(self.debugRef, + Tag := DC.DW_TAG_structure_type, + Name := typeName, + NameLen := Text.Length(typeName), + Scope := DebugScope(self,r), + File := self.fileRef, + Line := self.curLine, + RuntimeLang := 0, + SizeInBits := VAL(r.bitSize,uint64_t), + AlignInBits := VAL(r.align,uint32_t), + Flags := 0, + UniqueIdentifier := uniqueId, + UniqueIdentifierLen := Text.Length(uniqueId)); r.diType := structDIT; @@ -6589,23 +6576,22 @@ PROCEDURE DebugRecord(self : U; r : RecordDebug) : MetadataRef = paramsArr[i] := memberDIT; END; - resStructDIT - := M3DIB.CreateStructType(self.debugRef, - Name := typeName, - NameLen := Text.Length(typeName), - Scope := DebugScope(self,r), - File := self.fileRef, - LineNumber := self.curLine, - SizeInBits := VAL(r.bitSize,uint64_t), - AlignInBits := VAL(r.align,uint32_t), - Flags := 0, - DerivedFrom := NIL, - Elements := paramsMetadata.Data, - NumElements := r.numFields, - RunTimeLang := 0, - VTableHolder := NIL, - UniqueId := uniqueId, - UniqueIdLen := Text.Length(uniqueId)); + resStructDIT := M3DIB.CreateStructType(self.debugRef, + Name := typeName, + NameLen := Text.Length(typeName), + Scope := DebugScope(self,r), + File := self.fileRef, + LineNumber := self.curLine, + SizeInBits := VAL(r.bitSize,uint64_t), + AlignInBits := VAL(r.align,uint32_t), + Flags := 0, + DerivedFrom := NIL, + Elements := paramsMetadata.Data, + NumElements := r.numFields, + RunTimeLang := 0, + VTableHolder := NIL, + UniqueId := uniqueId, + UniqueIdLen := Text.Length(uniqueId)); (* This seems to work but better to use replace arrays as in object*) M3DIB.LLVMMetadataReplaceAllUsesWith( diff --git a/m3-sys/llvm/llvm13bindings/src/M3DebugInfo.i b/m3-sys/llvm/llvm13bindings/src/M3DebugInfo.i index 1497e4015f..0faf34d961 100644 --- a/m3-sys/llvm/llvm13bindings/src/M3DebugInfo.i +++ b/m3-sys/llvm/llvm13bindings/src/M3DebugInfo.i @@ -215,6 +215,14 @@ DoEnum(LLVMDWARFMacinfoRecordType); //Useful in development where you ignore everything except //the method you are working on and want to cut the error list down. + +%ignore LLVMDIBuilderCreateSetType; +%ignore LLVMDIBuilderGetSubrangeConst; +%ignore LLVMDIBuilderGetSubrangeExpr; +%ignore LLVMDIBuilderCreateDynamicArrayType; +%ignore LLVMReplaceArrays; + + /* %ignore LLVMDebugMetadataVersion; %ignore LLVMGetModuleDebugMetadataVersion; diff --git a/m3-sys/llvm/llvm13bindings/src/M3DebugInfo.i3 b/m3-sys/llvm/llvm13bindings/src/M3DebugInfo.i3 index 0910b29d27..2a4a58b349 100644 --- a/m3-sys/llvm/llvm13bindings/src/M3DebugInfo.i3 +++ b/m3-sys/llvm/llvm13bindings/src/M3DebugInfo.i3 @@ -675,73 +675,6 @@ PROCEDURE CreateEnumerationType (Builder : BuilderRef; MetadataRef; -(** - * Create debugging information entry for a set.
- * @param Builder The DIBuilder.
- * @param Scope The scope this module is imported into.
- * @param Name A name that uniquely identifies this set.
- * @param NameLen The length of the C string passed to Name.
- * @param File File where the set is located.
- *
- * @param SizeInBits Set size.
- * @param AlignInBits Set alignment.
- * @param BaseTy The base type of the set. - *) - -(* 2021-11-26: temporary disabled -PROCEDURE CreateSetType (Builder : BuilderRef; - Scope : MetadataRef; - Name : TEXT; - NameLen : uint32_t; - File : MetadataRef; - LineNumber : uint; - SizeInBits : uint64_t; - AlignInBits: uint32_t; - BaseTy : MetadataRef; ): MetadataRef; -*) - -(** - * Create a descriptor for a subrange with constant bounds.
- * @param Builder The DIBuilder.
- * @param Scope The scope this module is imported into.
- * @param Name A name that uniquely identifies this set.
- * @param NameLen The length of the C string passed to Name.
- * @param File File where the subrange is located.
- * @param BaseTy The base type of the subrange. eg integer or enumeration
- * @param LowerBound Lower bound of the subrange.
- * @param Count Count of elements in the subrange. - *) - -(* VVM -PROCEDURE GetSubrangeConst (Builder : BuilderRef; - Scope : MetadataRef; - Name : TEXT; - NameLen : uint32_t; - File, BaseTy : MetadataRef; - LowerBound, Count: int64_t; ): MetadataRef; -*) - -(** - * Create a descriptor for a subrange with dynamic bounds.
- * @param Builder The DIBuilder.
- * @param Scope The scope this module is imported into.
- * @param Name A name that uniquely identifies this set.
- * @param NameLen The length of the C string passed to Name.
- * @param File File where the subrange is located.
- * @param BaseTy The base type of the subrange. eg integer or enumeration
- * @param LowerBound Lower bound of the subrange.
- * @param Count Count of elements in the subrange. - *) - -(* 2021-11-26: temporary disabled -PROCEDURE GetSubrangeExpr (Builder : BuilderRef; - Scope : MetadataRef; - Name : TEXT; - NameLen : uint32_t; - File, BaseTy, LowerBound, Count: MetadataRef; ): - MetadataRef; -*) - (** * Create debugging information entry for a union.
* @param Builder The DIBuilder.
@@ -795,32 +728,6 @@ PROCEDURE CreateArrayType (Builder : BuilderRef; MetadataRef; -(** - * Create debugging information entry for a dynamic array.
- * @param Builder The DIBuilder.
- * @param Size Array size.
- * @param AlignInBits Alignment.
- * @param Ty Element type.
- * @param Subscripts Subscripts.
- * @param NumSubscripts Number of subscripts.
- * @param DataLocation DataLocation.
- * @param Associated Associated.
- * @param Allocated Allocated.
- * @param Rank Rank. - *) - -(* 2021-11-26: temporary disabled -PROCEDURE CreateDynamicArrayType - (Builder : BuilderRef; - Size : uint64_t; - AlignInBits : uint32_t; - Ty : MetadataRef; - Subscripts : UNTRACED REF MetadataRef; - NumSubscripts : uint; - DataLocation, Associated, Allocated, Rank: MetadataRef; ): - MetadataRef; -*) - (** * Create debugging information entry for a vector type.
* @param Builder The DIBuilder.
@@ -1727,10 +1634,5 @@ PROCEDURE LLVMInstructionSetDebugLoc (Inst: ValueRef; Loc: MetadataRef; ); PROCEDURE LLVMGetMetadataKind (Metadata: MetadataRef; ): CARDINAL; -(* 2021-11-26: temporary disabled -PROCEDURE LLVMReplaceArrays (Builder : BuilderRef; - T, Elements: UNTRACED REF MetadataRef; - NumElements: uint; ); -*) END M3DebugInfo. diff --git a/m3-sys/llvm/llvm13bindings/src/M3DebugInfo.m3 b/m3-sys/llvm/llvm13bindings/src/M3DebugInfo.m3 index 450be4c49b..1b138cae78 100644 --- a/m3-sys/llvm/llvm13bindings/src/M3DebugInfo.m3 +++ b/m3-sys/llvm/llvm13bindings/src/M3DebugInfo.m3 @@ -415,70 +415,6 @@ PROCEDURE CreateEnumerationType (Builder : BuilderRef; RETURN result; END CreateEnumerationType; -(* 2021-11-26: temporary disabled -PROCEDURE CreateSetType (Builder : BuilderRef; - Scope : MetadataRef; - Name : TEXT; - NameLen : uint32_t; - File : MetadataRef; - LineNumber : uint; - SizeInBits : uint64_t; - AlignInBits: uint32_t; - BaseTy : MetadataRef; ): MetadataRef = - VAR - arg3 : C.char_star; - result: MetadataRef; - BEGIN - arg3 := M3toC.SharedTtoS(Name); - result := M3DebugInfoRaw.CreateSetType( - Builder, Scope, arg3, NameLen, File, LineNumber, - SizeInBits, AlignInBits, BaseTy); - M3toC.FreeSharedS(Name, arg3); - RETURN result; - END CreateSetType; -*) - -(* 2021-11-26: temporary disabled -PROCEDURE GetSubrangeConst (Builder : BuilderRef; - Scope : MetadataRef; - Name : TEXT; - NameLen : uint32_t; - File, BaseTy : MetadataRef; - LowerBound, Count: int64_t; ): - MetadataRef = - VAR - arg3 : C.char_star; - result: MetadataRef; - BEGIN - arg3 := M3toC.SharedTtoS(Name); - result := - M3DebugInfoRaw.GetSubrangeConst( - Builder, Scope, arg3, NameLen, File, BaseTy, LowerBound, Count); - M3toC.FreeSharedS(Name, arg3); - RETURN result; - END GetSubrangeConst; -*) - -(* 2021-11-26: temporary disabled -PROCEDURE GetSubrangeExpr (Builder : BuilderRef; - Scope : MetadataRef; - Name : TEXT; - NameLen : uint32_t; - File, BaseTy, LowerBound, Count: MetadataRef; ): - MetadataRef = - VAR - arg3 : C.char_star; - result: MetadataRef; - BEGIN - arg3 := M3toC.SharedTtoS(Name); - result := - M3DebugInfoRaw.GetSubrangeExpr( - Builder, Scope, arg3, NameLen, File, BaseTy, LowerBound, Count); - M3toC.FreeSharedS(Name, arg3); - RETURN result; - END GetSubrangeExpr; -*) - PROCEDURE CreateUnionType (Builder : BuilderRef; Scope : MetadataRef; Name : TEXT; @@ -523,23 +459,6 @@ PROCEDURE CreateArrayType (Builder : BuilderRef; Builder, Size, AlignInBits, Ty, Subscripts, NumSubscripts); END CreateArrayType; -(* 2021-11-26: temporary disabled -PROCEDURE CreateDynamicArrayType - (Builder : BuilderRef; - Size : uint64_t; - AlignInBits : uint32_t; - Ty : MetadataRef; - Subscripts : UNTRACED REF MetadataRef; - NumSubscripts : uint; - DataLocation, Associated, Allocated, Rank: MetadataRef; ): - MetadataRef = - BEGIN - RETURN M3DebugInfoRaw.CreateDynamicArrayType( - Builder, Size, AlignInBits, Ty, Subscripts, NumSubscripts, - DataLocation, Associated, Allocated, Rank); - END CreateDynamicArrayType; -*) - PROCEDURE CreateVectorType (Builder : BuilderRef; Size : uint64_t; AlignInBits : uint32_t; @@ -1220,14 +1139,6 @@ PROCEDURE LLVMGetMetadataKind (Metadata: MetadataRef; ): CARDINAL = RETURN M3DebugInfoRaw.LLVMGetMetadataKind(Metadata); END LLVMGetMetadataKind; -(* 2021-11-26: temporary disabled -PROCEDURE LLVMReplaceArrays (Builder : BuilderRef; - T, Elements: UNTRACED REF MetadataRef; - NumElements: uint; ) = - BEGIN - M3DebugInfoRaw.LLVMReplaceArrays(Builder, T, Elements, NumElements); - END LLVMReplaceArrays; -*) BEGIN END M3DebugInfo. diff --git a/m3-sys/llvm/llvm13bindings/src/M3DebugInfoRaw.i3 b/m3-sys/llvm/llvm13bindings/src/M3DebugInfoRaw.i3 index e3b061003b..9fcaa55aba 100644 --- a/m3-sys/llvm/llvm13bindings/src/M3DebugInfoRaw.i3 +++ b/m3-sys/llvm/llvm13bindings/src/M3DebugInfoRaw.i3 @@ -204,36 +204,6 @@ PROCEDURE CreateEnumerationType (Builder, Scope: ADDRESS; ClassTy : ADDRESS; ): ADDRESS; -(* 2021-11-26: temporary disabled -<* EXTERNAL LLVMDIBuilderCreateSetType *> -PROCEDURE CreateSetType (Builder, Scope: ADDRESS; - Name : C.char_star; - NameLen : C.unsigned_int; - File : ADDRESS; - LineNumber : C.unsigned_int; - SizeInBits : C.unsigned_long_long; - AlignInBits : C.unsigned_int; - BaseTy : ADDRESS; ): ADDRESS; -*) - -(* 2021-11-26: temporary disabled -<* EXTERNAL LLVMDIBuilderGetSubrangeConst *> -PROCEDURE GetSubrangeConst (Builder, Scope : ADDRESS; - Name : C.char_star; - NameLen : C.unsigned_int; - File, BaseTy : ADDRESS; - LowerBound, Count: C.long_long; ): ADDRESS; -*) - -(* 2021-11-26: temporary disabled -<* EXTERNAL LLVMDIBuilderGetSubrangeExpr *> -PROCEDURE GetSubrangeExpr (Builder, Scope: ADDRESS; - Name : C.char_star; - NameLen : C.unsigned_int; - File, BaseTy, LowerBound, Count: ADDRESS; ): - ADDRESS; -*) - <* EXTERNAL LLVMDIBuilderCreateUnionType *> PROCEDURE CreateUnionType (Builder, Scope: ADDRESS; Name : C.char_star; @@ -257,19 +227,6 @@ PROCEDURE CreateArrayType (Builder : ADDRESS; Subscripts : ADDRESS; NumSubscripts: C.unsigned_int; ): ADDRESS; -(* 2021-11-26: temporary disabled -<* EXTERNAL LLVMDIBuilderCreateDynamicArrayType *> -PROCEDURE CreateDynamicArrayType - (Builder : ADDRESS; - Size : C.unsigned_long_long; - AlignInBits : C.unsigned_int; - Ty : ADDRESS; - Subscripts : ADDRESS; - NumSubscripts : C.unsigned_int; - DataLocation, Associated, Allocated, Rank: ADDRESS; ): - ADDRESS; -*) - <* EXTERNAL LLVMDIBuilderCreateVectorType *> PROCEDURE CreateVectorType (Builder : ADDRESS; Size : C.unsigned_long_long; @@ -615,10 +572,4 @@ PROCEDURE LLVMInstructionSetDebugLoc (Inst, Loc: ADDRESS; ); <* EXTERNAL LLVMGetMetadataKind *> PROCEDURE LLVMGetMetadataKind (Metadata: ADDRESS; ): C.unsigned_int; -(* 2021-11-26: temporary disabled -<* EXTERNAL LLVMReplaceArrays *> -PROCEDURE LLVMReplaceArrays - (Builder: ADDRESS; T, Elements: ADDRESS; NumElements: C.unsigned_int; ); -*) - END M3DebugInfoRaw.