[llvm-commits] [llvm] r84753 - in /llvm/trunk/lib/Target/PIC16: AsmPrinter/PIC16AsmPrinter.cpp AsmPrinter/PIC16AsmPrinter.h Makefile PIC16ABINames.h PIC16Passes/ PIC16Passes/Makefile PIC16Passes/PIC16Overlay.cpp PIC16Passes/PIC16Overlay.h PIC16Section.cpp PIC16Section.h PIC16TargetObjectFile.cpp PIC16TargetObjectFile.h
Benjamin Kramer
benny.kra at googlemail.com
Wed Oct 21 14:44:02 PDT 2009
Am 21.10.2009 um 12:42 schrieb Sanjiv Gupta:
> Author: sgupta
> Date: Wed Oct 21 05:42:44 2009
> New Revision: 84753
>
> URL: http://llvm.org/viewvc/llvm-project?rev=84753&view=rev
> Log:
> Add a pass to overlay pic16 data sections for function frame and
> automatic
> variables. This pass can be invoked by llvm-ld or opt to traverse
> over the call graph
> to detect what function frames and their automatic variables can be
> overlaid.
> Currently this builds an archive , but needs to be changed to a
> loadable module.
>
> Modified: llvm/trunk/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp?rev=84753&r1=84752&r2=84753&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp
> (original)
> +++ llvm/trunk/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp Wed
> Oct 21 05:42:44 2009
> @@ -53,6 +53,45 @@
> return true;
> }
>
> +static int getFunctionColor(const Function *F) {
> + if (F->hasSection()) {
> + std::string Sectn = F->getSection();
> + std::string StrToFind = "Overlay=";
> + unsigned Pos = Sectn.find(StrToFind);
> +
> + // Retreive the color number if the key is found.
> + if (Pos != std::string::npos) {
GCC warns (64 bit osx):
PIC16AsmPrinter.cpp: In function ‘int getFunctionColor(const
llvm::Function*)’:
PIC16AsmPrinter.cpp:63: warning: comparison is always true due to
limited range of data type
Please use std::string::size_type instead of unsigned.
> + Pos += StrToFind.length();
> + std::string Color = "";
> + char c = Sectn.at(Pos);
> + // A Color can only consist of digits.
> + while (c >= '0' && c<= '9') {
> + Color.append(1,c);
> + Pos++;
> + if (Pos >= Sectn.length())
> + break;
> + c = Sectn.at(Pos);
> + }
> + return atoi(Color.c_str());
> + }
> + }
> +
> + // Color was not set for function, so return -1.
> + return -1;
> +}
More information about the llvm-commits
mailing list