[cfe-commits] r157601 - /cfe/trunk/lib/AST/MicrosoftMangle.cpp
Charles Davis
cdavis at mines.edu
Tue May 29 00:01:45 PDT 2012
Author: cdavis
Date: Tue May 29 02:01:45 2012
New Revision: 157601
URL: http://llvm.org/viewvc/llvm-project?rev=157601&view=rev
Log:
Use fewer temporaries mangling APSInt objects. The performance difference
is negligible, but it makes the code clearer. Based on a suggestion by
Jordy Rose.
Modified:
cfe/trunk/lib/AST/MicrosoftMangle.cpp
Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=157601&r1=157600&r2=157601&view=diff
==============================================================================
--- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original)
+++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Tue May 29 02:01:45 2012
@@ -308,10 +308,11 @@
mangleNumber(llvm::APSInt(Value.abs()));
return;
}
- if (Value.uge(1) && Value.ule(10))
- (Value-llvm::APSInt(llvm::APInt(Value.getBitWidth(), 1, Value.isSigned()),
- Value.isUnsigned())).print(Out, false);
- else {
+ llvm::APSInt Temp(Value);
+ if (Value.uge(1) && Value.ule(10)) {
+ --Temp;
+ Temp.print(Out, false);
+ } else {
// We have to build up the encoding in reverse order, so it will come
// out right when we write it out.
char Encoding[64];
@@ -320,8 +321,8 @@
llvm::APSInt NibbleMask(Value.getBitWidth(), Value.isUnsigned());
NibbleMask = 0xf;
for (int i = 0, e = Value.getActiveBits() / 4; i != e; ++i) {
- *--CurPtr = 'A' + Value.And(NibbleMask).lshr(i*4).getLimitedValue(0xf);
- NibbleMask = NibbleMask.shl(4);
+ *--CurPtr = 'A' + Temp.And(NibbleMask).getLimitedValue(0xf);
+ Temp = Temp.lshr(4);
};
Out.write(CurPtr, EndPtr-CurPtr);
Out << '@';
More information about the cfe-commits
mailing list