turn some templated inline functions into static functions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77873 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2009-08-02 04:52:00 +00:00
parent f67de7a69e
commit 7bbd178d4b
2 changed files with 11 additions and 14 deletions

View File

@ -83,15 +83,15 @@ ARMELFTargetAsmInfo::ARMELFTargetAsmInfo(const ARMBaseTargetMachine &TM):
/// Count the number of comma-separated arguments. /// Count the number of comma-separated arguments.
/// Do not try to detect errors. /// Do not try to detect errors.
template <class BaseTAI> static unsigned countArguments(const char* p,
unsigned ARMTargetAsmInfo<BaseTAI>::countArguments(const char* p) const { const TargetAsmInfo &TAI) {
unsigned count = 0; unsigned count = 0;
while (*p && isspace(*p) && *p != '\n') while (*p && isspace(*p) && *p != '\n')
p++; p++;
count++; count++;
while (*p && *p!='\n' && while (*p && *p!='\n' &&
strncmp(p, BaseTAI::CommentString, strncmp(p, TAI.getCommentString(),
strlen(BaseTAI::CommentString))!=0) { strlen(TAI.getCommentString())) != 0) {
if (*p==',') if (*p==',')
count++; count++;
p++; p++;
@ -101,8 +101,7 @@ unsigned ARMTargetAsmInfo<BaseTAI>::countArguments(const char* p) const {
/// Count the length of a string enclosed in quote characters. /// Count the length of a string enclosed in quote characters.
/// Do not try to detect errors. /// Do not try to detect errors.
template <class BaseTAI> static unsigned countString(const char *p) {
unsigned ARMTargetAsmInfo<BaseTAI>::countString(const char* p) const {
unsigned count = 0; unsigned count = 0;
while (*p && isspace(*p) && *p!='\n') while (*p && isspace(*p) && *p!='\n')
p++; p++;
@ -197,17 +196,17 @@ unsigned ARMTargetAsmInfo<BaseTAI>::getInlineAsmLength(const char *s) const {
// Some generate code, but this is only interesting in the text section. // Some generate code, but this is only interesting in the text section.
else if (inTextSection) { else if (inTextSection) {
if (strncmp(Str, ".long", strlen(".long"))==0) if (strncmp(Str, ".long", strlen(".long"))==0)
Length += 4*countArguments(Str+strlen(".long")); Length += 4*countArguments(Str+strlen(".long"), *this);
else if (strncmp(Str, ".short", strlen(".short"))==0) else if (strncmp(Str, ".short", strlen(".short"))==0)
Length += 2*countArguments(Str+strlen(".short")); Length += 2*countArguments(Str+strlen(".short"), *this);
else if (strncmp(Str, ".byte", strlen(".byte"))==0) else if (strncmp(Str, ".byte", strlen(".byte"))==0)
Length += 1*countArguments(Str+strlen(".byte")); Length += 1*countArguments(Str+strlen(".byte"), *this);
else if (strncmp(Str, ".single", strlen(".single"))==0) else if (strncmp(Str, ".single", strlen(".single"))==0)
Length += 4*countArguments(Str+strlen(".single")); Length += 4*countArguments(Str+strlen(".single"), *this);
else if (strncmp(Str, ".double", strlen(".double"))==0) else if (strncmp(Str, ".double", strlen(".double"))==0)
Length += 8*countArguments(Str+strlen(".double")); Length += 8*countArguments(Str+strlen(".double"), *this);
else if (strncmp(Str, ".quad", strlen(".quad"))==0) else if (strncmp(Str, ".quad", strlen(".quad"))==0)
Length += 16*countArguments(Str+strlen(".quad")); Length += 16*countArguments(Str+strlen(".quad"), *this);
else if (strncmp(Str, ".ascii", strlen(".ascii"))==0) else if (strncmp(Str, ".ascii", strlen(".ascii"))==0)
Length += countString(Str+strlen(".ascii")); Length += countString(Str+strlen(".ascii"));
else if (strncmp(Str, ".asciz", strlen(".asciz"))==0) else if (strncmp(Str, ".asciz", strlen(".asciz"))==0)

View File

@ -40,8 +40,6 @@ namespace llvm {
const ARMSubtarget *Subtarget; const ARMSubtarget *Subtarget;
virtual unsigned getInlineAsmLength(const char *Str) const; virtual unsigned getInlineAsmLength(const char *Str) const;
unsigned countArguments(const char *p) const;
unsigned countString(const char *p) const;
}; };
EXTERN_TEMPLATE_INSTANTIATION(class ARMTargetAsmInfo<TargetAsmInfo>); EXTERN_TEMPLATE_INSTANTIATION(class ARMTargetAsmInfo<TargetAsmInfo>);