compiler: add //go:inline pragma

This commit is contained in:
Ayke van Laethem
2019-05-10 21:01:41 +02:00
committed by Ron Evans
parent 397b90753c
commit 6f6afb0515
2 changed files with 36 additions and 5 deletions
+8
View File
@@ -828,6 +828,14 @@ func (c *Compiler) parseFunc(frame *Frame) {
frame.fn.LLVMFn.SetFunctionCallConv(85) // CallingConv::AVR_SIGNAL
}
// Some functions have a pragma controlling the inlining level.
switch frame.fn.Inline() {
case ir.InlineHint:
// Add LLVM inline hint to functions with //go:inline pragma.
inline := c.ctx.CreateEnumAttribute(llvm.AttributeKindID("inlinehint"), 0)
frame.fn.LLVMFn.AddFunctionAttr(inline)
}
// Add debug info, if needed.
if c.Debug {
if frame.fn.Synthetic == "package initializer" {