示例#1
0
文件: debug.go 项目: hinike/llgo
// Finalize must be called after all compilation units are translated,
// generating the final debug metadata for the module.
func (d *DIBuilder) Finalize() {
	d.module.AddNamedMetadataOperand(
		"llvm.module.flags",
		llvm.MDNode([]llvm.Value{
			llvm.ConstInt(llvm.Int32Type(), 2, false), // Warn on mismatch
			llvm.MDString("Dwarf Version"),
			llvm.ConstInt(llvm.Int32Type(), 4, false),
		}),
	)
	d.module.AddNamedMetadataOperand(
		"llvm.module.flags",
		llvm.MDNode([]llvm.Value{
			llvm.ConstInt(llvm.Int32Type(), 1, false), // Error on mismatch
			llvm.MDString("Debug Info Version"),
			llvm.ConstInt(llvm.Int32Type(), 1, false),
		}),
	)
	d.builder.Finalize()
}
示例#2
0
文件: errors.go 项目: hinike/llgo
func (fr *frame) setBranchWeightMetadata(br llvm.Value, trueweight, falseweight uint64) {
	mdprof := llvm.MDKindID("prof")

	mdnode := llvm.MDNode([]llvm.Value{
		llvm.MDString("branch_weights"),
		llvm.ConstInt(llvm.Int32Type(), trueweight, false),
		llvm.ConstInt(llvm.Int32Type(), falseweight, false),
	})

	br.SetMetadata(mdprof, mdnode)
}