aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2009-08-07 10:42:28 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2009-08-07 10:42:28 +0000
commitbaad7740f8d4ae796fff337e6546180e0d44293b (patch)
treed64bd0bfe87261da878557d84ea7a1bd0136811c
parent1cff9b4a6fc4a073b64037cf98e2c334fde8fb81 (diff)
downloadexternal_llvm-baad7740f8d4ae796fff337e6546180e0d44293b.zip
external_llvm-baad7740f8d4ae796fff337e6546180e0d44293b.tar.gz
external_llvm-baad7740f8d4ae796fff337e6546180e0d44293b.tar.bz2
Simplify code and avoid allocations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78382 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/PIC16/PIC16AsmPrinter.cpp13
1 files changed, 3 insertions, 10 deletions
diff --git a/lib/Target/PIC16/PIC16AsmPrinter.cpp b/lib/Target/PIC16/PIC16AsmPrinter.cpp
index 55ec1fe..dc332ff 100644
--- a/lib/Target/PIC16/PIC16AsmPrinter.cpp
+++ b/lib/Target/PIC16/PIC16AsmPrinter.cpp
@@ -27,6 +27,7 @@
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/Mangler.h"
+#include <cstring>
using namespace llvm;
#include "PIC16GenAsmWriter.inc"
@@ -181,21 +182,13 @@ void PIC16AsmPrinter::printCCOperand(const MachineInstr *MI, int opNum) {
// This function is used to sort the decls list.
// should return true if s1 should come before s2.
static bool is_before(const char *s1, const char *s2) {
- std::string str1 = s1;
- std::string str2 = s2;
- int i = str1.compare(str2);
- // Return true if s1 is smaller or equal.
- if (i <= 0) return true;
- // false if s1 should come after s2.
- return false;
+ return strcmp(s1, s2) <= 0;
}
// This is used by list::unique below.
// unique will filter out duplicates if it knows them.
static bool is_duplicate(const char *s1, const char *s2) {
- std::string str1 = s1;
- std::string str2 = s2;
- return str1 == str2;
+ return !strcmp(s1, s2);
}
/// printLibcallDecls - print the extern declarations for compiler