[llvm-commits] CVS: llvm/lib/Target/ARM/ARMTargetAsmInfo.h ARMTargetAsmInfo.cpp

Lauro Ramos Venancio lauro.venancio at gmail.com
Sun Apr 29 17:17:45 PDT 2007


>
>
> +/// ARM-specific version of TargetAsmInfo::getInlineAsmLength.
> +unsigned ARMTargetAsmInfo::getInlineAsmLength(const char *Str) const {
> +  // Count the number of bytes in the asm.
> +  bool atInsnStart = true;
> +  unsigned Length = 0;
> +  for (; *Str; ++Str) {
> +    if (atInsnStart) {
> +      // Skip whitespace
> +      while (*Str && isspace(*Str) && *Str != '\n')
> +        Str++;
> +      // Skip label
> +      for (const char* p = Str; *p && !isspace(*p); p++)
> +        if (*p == ':') {
> +          Str = p+1;
> +          break;
> +        }
> +      // Ignore everything from comment char(s) to EOL
> +      if (strncmp(Str, CommentString, strlen(CommentString))==-0)
> +        atInsnStart = false;
> +      else {
> +        // An instruction
> +        atInsnStart = false;
> +        if (isThumb) {
> +          // BL and BLX <non-reg> are 4 bytes, all others 2.
> +          const char*p = Str;


"p" is an unused variable.
/home/laurov/llvm/llvm/lib/Target/ARM/ARMTargetAsmInfo.cpp: In member
function 'virtual unsigned int
llvm::ARMTargetAsmInfo::getInlineAsmLength(const char*) const':
/home/laurov/llvm/llvm/lib/Target/ARM/ARMTargetAsmInfo.cpp:115: warning:
unused variable 'p'



+          if ((*Str=='b' || *Str=='B') &&
> +              (*(Str+1)=='l' || *(Str+1)=='L')) {
> +            if (*(Str+2)=='x' || *(Str+2)=='X') {
> +              const char* p = Str+3;
> +              while (*p && isspace(*p))
> +                p++;
> +              if (*p == 'r' || *p=='R')
> +                Length += 2;    // BLX reg
> +              else
> +                Length += 4;    // BLX non-reg
> +            }
> +            else
> +              Length += 4;    // BL
> +          } else
> +            Length += 2;    // Thumb anything else
> +        }
> +        else
> +          Length += 4;    // ARM
> +      }
> +    }
> +    if (*Str == '\n' || *Str == SeparatorChar)
> +      atInsnStart = true;
> +  }
> +  return Length;
> +}
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20070429/29ca0d73/attachment.html>


More information about the llvm-commits mailing list