[Intel-gfx] [RFC 00/15] Selectable platform support
Chris Wilson
chris at chris-wilson.co.uk
Fri Feb 9 21:14:48 UTC 2018
Quoting Chris Wilson (2018-02-09 11:19:44)
> Ideas? A long time ago, we wanted a static INTEL_INFO. I think now we
> have driver_caps, we try to kill off mkwrite_intel_info() and where
> need be use INTEL_INFO() && DRIVER_CAPS().
>
> Tvrtko, how easy do you think it will be to go from Kconfig to
>
> #define INTEL_INFO(dev_priv) (&platform_info)
> ?
Fwiw, I've been playing around with getting INTEL_INFO() back to being a
static blob, but the DCE elimination for a single platform_info does
require LTO. (And no, I can't build Andi Keen's lto-415-2 branch either.)
--- ctl.h ---
#include <stdbool.h>
struct control {
bool exists;
};
--- ctl.c ---
#include "ctl.h"
const struct control ctl = {
.exists = false,
};
--- test.c ---
#include "ctl.h"
static void unwanted(int *x)
{
*x = 0;
}
extern const struct control ctl;
int main(void)
{
if (ctl.exists)
unwanted(0);
return 0;
}
Without LTO, gcc -Wall -g test.c ctl.c -O2
Dump of assembler code for function main:
0x00000000004003e0 <+0>: cmpb $0x0,0x1ad(%rip) # 0x400594 <ctl>
0x00000000004003e7 <+7>: je 0x400400 <main+32>
0x00000000004003e9 <+9>: movl $0x0,0x0
0x00000000004003f4 <+20>: ud2
0x00000000004003f6 <+22>: nopw %cs:0x0(%rax,%rax,1)
0x0000000000400400 <+32>: xor %eax,%eax
0x0000000000400402 <+34>: retq
With LTO, gcc -Wall -g test.c ctl.c -flto -O2
Dump of assembler code for function main:
0x00000000004003e0 <+0>: xor %eax,%eax
0x00000000004003e2 <+2>: retq
Let's hope that magic scales!
-Chris
More information about the Intel-gfx
mailing list