mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-15 00:13:43 +00:00
compiler: move NonConstGlobals pass to transform package
This commit is contained in:
committed by
Ron Evans
parent
b6314fa6ab
commit
c5cb2cec9b
@@ -18,3 +18,16 @@ func ApplyFunctionSections(mod llvm.Module) {
|
||||
llvmFn = llvm.NextFunction(llvmFn)
|
||||
}
|
||||
}
|
||||
|
||||
// NonConstGlobals turns 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. Normal pointer
|
||||
// behavior is restored by using the data space only, at the cost of RAM for
|
||||
// constant global variables.
|
||||
func NonConstGlobals(mod llvm.Module) {
|
||||
global := mod.FirstGlobal()
|
||||
for !global.IsNil() {
|
||||
global.SetGlobalConstant(false)
|
||||
global = llvm.NextGlobal(global)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user