[PATCH] lld] handle the case of errors from createLinkerInput

Shankar Kalpathi Easwaran shankarke at gmail.com
Mon Sep 2 20:12:50 PDT 2013



================
Comment at: include/lld/Driver/GnuLDInputGraph.h:77
@@ -72,2 +76,3 @@
   bool _asNeeded : 1;
+  bool _isDashlPrefix : 1;
   std::vector<StringRef> _libraryPaths;
----------------
Rui Ueyama wrote:
> Shankar Kalpathi Easwaran wrote:
> > Rui Ueyama wrote:
> > > Why did you make them bitfields? I think we don't usually make boolean fields bitfields only because they need only 1 bit.
> > bool is an alias for a char, which takes a byte instead of a bit.
> > 
> > Below is an example :-
> > 
> > #include <stdio.h>
> > 
> > struct x {
> > bool a:1;
> > bool b:1;
> > bool c:1;
> > };
> > 
> > struct y {
> >   bool a;
> >   bool b;
> >   bool c;
> > };
> > 
> > int main() {
> >   printf("%ld\n",sizeof(struct x));
> >   printf("%ld\n",sizeof(struct y));
> > }
> > 
> > Prints :
> > 1
> > 3
> > 
> As far as I know in LLVM and in general we don't use bitfield unless
> 
>  - it's mapped to some concrete data structure that already exists in memory or file, nor
>  - the number of instance is really large and need to save memory.
> 
> Otherwise bitfield is not necessary. It will actually slows down the execution of code because the compiler need to emit load, mask, and shift operations to get a boolean bitfield value, instead of one load instruction.
I feel all the options that are either true/false should just use a bitfield. and bit fields are usually faster as the compiler needs to just do one store instead of three stores(stores are usually more costlier).


http://llvm-reviews.chandlerc.com/D1571



More information about the llvm-commits mailing list