Browse Source

compiler: avoid all debug info with -no-debug

pull/165/head
Ayke van Laethem 6 years ago
committed by Ron Evans
parent
commit
d63ce0646c
  1. 6
      compiler/compiler.go

6
compiler/compiler.go

@ -110,7 +110,9 @@ func NewCompiler(pkgName string, config Config) (*Compiler, error) {
c.mod.SetTarget(config.Triple)
c.mod.SetDataLayout(c.targetData.String())
c.builder = c.ctx.NewBuilder()
if c.Debug {
c.dibuilder = llvm.NewDIBuilder(c.mod)
}
c.uintptrType = c.ctx.IntType(c.targetData.PointerSize() * 8)
if c.targetData.PointerSize() <= 4 {
@ -214,6 +216,7 @@ func (c *Compiler) Compile(mainPath string) error {
c.ir.SimpleDCE()
// Initialize debug information.
if c.Debug {
c.cu = c.dibuilder.CreateCompileUnit(llvm.DICompileUnit{
Language: llvm.DW_LANG_Go,
File: mainPath,
@ -221,6 +224,7 @@ func (c *Compiler) Compile(mainPath string) error {
Producer: "TinyGo",
Optimized: true,
})
}
var frames []*Frame
@ -373,6 +377,7 @@ func (c *Compiler) Compile(mainPath string) error {
c.mod.NamedFunction("runtime.scheduler").SetLinkage(llvm.ExternalLinkage)
// see: https://reviews.llvm.org/D18355
if c.Debug {
c.mod.AddNamedMetadataOperand("llvm.module.flags",
c.ctx.MDNode([]llvm.Metadata{
llvm.ConstInt(c.ctx.Int32Type(), 1, false).ConstantAsMetadata(), // Error on mismatch
@ -381,6 +386,7 @@ func (c *Compiler) Compile(mainPath string) error {
}),
)
c.dibuilder.Finalize()
}
return nil
}

Loading…
Cancel
Save