]> granicus.if.org Git - clang/commit
IRgen: Add a -fuse-register-sized-bitfield-access option, for testing.
authorDaniel Dunbar <daniel@zuster.org>
Tue, 21 Jun 2011 18:54:46 +0000 (18:54 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Tue, 21 Jun 2011 18:54:46 +0000 (18:54 +0000)
commite26bdb91b7e3912ffe895b78a446db94471a59dd
treea455cb228d6d1a1021bd56774d9f27d95088c44c
parent08737c49bd98f73b50fe90fd19f97c41cd29e3d1
IRgen: Add a -fuse-register-sized-bitfield-access option, for testing.
 - Changes bit-field access policy to try to use (aligned) register sized accesses.

The idea here is that by using larger accesses we expose more coalescing
potential to the backend when we have situations like adjacent bit-fields in the
same structure (which is common), and that the backend should be smart enough to
narrow the accesses down when no coalescing is done or when it is shown not to
be profitable.

--
$ clang -m32 -O3 -S -o - t.c
_f0:                                    ## @f0
pushl %ebp
movl %esp, %ebp
movl 8(%ebp), %eax
movb (%eax), %cl
andb $-128, %cl
orb $1, %cl
movb %cl, (%eax)
movb 1(%eax), %cl
andb $-128, %cl
orb $1, %cl
movb %cl, 1(%eax)
movb 2(%eax), %cl
andb $-128, %cl
orb $1, %cl
movb %cl, 2(%eax)
movb 3(%eax), %cl
andb $-128, %cl
orb $1, %cl
movb %cl, 3(%eax)
popl %ebp
ret

$ clang -m32 -O3 -S -o - t.c -Xclang -fuse-register-sized-bitfield-access
_f0:                                    ## @f0
pushl %ebp
movl %esp, %ebp
movl 8(%ebp), %eax
movl $-2139062144, %ecx      ## imm = 0xFFFFFFFF80808080
andl (%eax), %ecx
orl $16843009, %ecx         ## imm = 0x1010101
movl %ecx, (%eax)
popl %ebp
ret
--

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133532 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Driver/CC1Options.td
include/clang/Frontend/CodeGenOptions.h
lib/CodeGen/CGRecordLayoutBuilder.cpp
lib/Frontend/CompilerInvocation.cpp