compiler: move NonConstGlobals pass to transform package

This commit is contained in:
Ayke van Laethem
2020-03-18 20:41:19 +01:00
committed by Ron Evans
parent b6314fa6ab
commit c5cb2cec9b
6 changed files with 31 additions and 12 deletions
-11
View File
@@ -2585,17 +2585,6 @@ func (c *Compiler) Verify() error {
return llvm.VerifyModule(c.mod, llvm.PrintMessageAction)
}
// Turn all global constants into global variables. This works around a
// limitation on Harvard architectures (e.g. AVR), where constant and
// non-constant pointers point to a different address space.
func (c *Compiler) NonConstGlobals() {
global := c.mod.FirstGlobal()
for !global.IsNil() {
global.SetGlobalConstant(false)
global = llvm.NextGlobal(global)
}
}
// Emit object file (.o).
func (c *Compiler) EmitObject(path string) error {
llvmBuf, err := c.machine.EmitToMemoryBuffer(c.mod, llvm.ObjectFile)