- To unpack the files, take each one, unzip it, and then untar it. A fast
- way to do that is with the following:
-
-
-
- For example, to extract the LLVM source code, use the following command:
-
-
-
+ Before configuring and compiling the LLVM suite, it is best to extract the
+ LLVM C front end. While not used in building, the C front end is used by
+ the LLVM test suite, and its location must be given to the
+ configure script before the LLVM suite can be built.
+
+
+
The following options can be used to set or enable LLVM specific options:
+
If you have multiple processors in your machine, you may wish to use some
@@ -495,22 +571,22 @@
There are several other targets which are useful when working with the LLVM
source code:
+ Be forewarned, though: the build system for the C front end is not as
+ polished as the rest of the LLVM code, so there will be many warnings and
+ errors that you will need to ignore for now:
+
+
@@ -881,7 +964,9 @@
-
+
Below are common problems and their remedies:
@@ -933,7 +1018,7 @@
-
+
This document is just an introduction to how to use LLVM to do
From vadve at cs.uiuc.edu Tue Jul 8 18:13:01 2003
From: vadve at cs.uiuc.edu (Vikram Adve)
Date: Tue Jul 8 18:13:01 2003
Subject: [llvm-commits] CVS: llvm/test/Programs/Makefile.programs
Message-ID: <200307082311.SAA19426@tank.cs.uiuc.edu>
Changes in directory llvm/test/Programs:
Makefile.programs updated: 1.64 -> 1.65
---
Log message:
Added a final "opt -$(OPTPASSES)" pass before generating Output/PROG.llvm.bc.
This allows any opt passes to be run after linking.
Most immediately, this vastly simplified the rules for tracing --
there are no special rules any more.
---
Diffs of the changes:
Index: llvm/test/Programs/Makefile.programs
diff -u llvm/test/Programs/Makefile.programs:1.64 llvm/test/Programs/Makefile.programs:1.65
--- llvm/test/Programs/Makefile.programs:1.64 Tue Jul 8 13:47:56 2003
+++ llvm/test/Programs/Makefile.programs Tue Jul 8 18:11:48 2003
@@ -93,8 +93,6 @@
# Generated code for llc (which does not require the target platform)
LLCCODEGEN := $(addsuffix .llc.s, $(PREFIXED_PROGRAMS_TO_TEST))
CBECODEGEN := $(addsuffix .cbe, $(PREFIXED_PROGRAMS_TO_TEST))
-LLCTRACECODEGEN := $(addsuffix .trace.llc.s, $(PREFIXED_PROGRAMS_TO_TEST))
-CBETRACECODEGEN := $(addsuffix .trace.cbe.c, $(PREFIXED_PROGRAMS_TO_TEST))
# Output produced by programs run
GCCOUTPUT := $(addsuffix .ll, $(addprefix Output/,$basename $(Source)))
@@ -129,27 +127,23 @@
endif
ifdef DISABLE_FOR_LLVM_PROGRAMS
-DISABLE_DIFFS := 1
+ DISABLE_DIFFS := 1
+endif
+
+ifdef DOTRACING
+ DISABLE_DIFFS = 1
+ OPTPASSES += $(TRACEFLAGS)
+ LDFLAGS += $(TRACELIBS)
endif
ifndef DISABLE_LLC
-ifeq ($(DOTRACING), yes)
-all:: $(LLCTRACECODEGEN)
-DISABLE_LLC_DIFFS = 1
-else
all:: $(LLCCODEGEN)
-endif
else
DISABLE_LLC_DIFFS = 1
endif
ifndef DISABLE_CBE
-ifeq ($(DOTRACING), yes)
-all:: $(CBETRACECODEGEN)
-DISABLE_CBE_DIFFS = 1
-else
all:: $(CBECODEGEN)
-endif
else
DISABLE_CBE_DIFFS = 1
endif
@@ -184,19 +178,18 @@
# Rule to produce final program bytecode file from linked, optimized, bytecode.
# Link the program to the libraries it uses, then perform postlink
# optimization...
+
$(PROGRAMS_TO_TEST:%=Output/%.llvm.bc): \
Output/%.llvm.bc: Output/%.linked.bc $(LGCCLDPROG)
$(LGCCLD) $(STATS) $< -lgcc -lc $(LIBS) crtend.o -o Output/$*.llvm
+ $(LOPT) $(OPTPASSES) < $@ > $@.tmp
+ $(MV) -f $@.tmp $@
+
$(PROGRAMS_TO_TEST:%=Output/%.llvm): \
Output/%.llvm: Output/%.linked.bc $(LGCCLDPROG)
$(LGCCLD) $(STATS) $< -lgcc -lc $(LIBS) crtend.o -o Output/$*.llvm
-endif
-
-# Rule to get the tracing version of the llvm.bc file for tracing:
-ifeq ($(DOTRACING), yes)
-$(PROGRAMS_TO_TEST:%=Output/%.llvm.trace.bc): \
-Output/%.llvm.trace.bc: Output/%.llvm.bc
- $(LOPT) $(TRACEFLAGS) $< -o $@
+ $(LOPT) $(OPTPASSES) < $@ > $@.tmp
+ $(MV) -f $@.tmp $@
endif
# Targets to get the pass arguments that gccas and gccld are using...
@@ -228,15 +221,7 @@
$(PROGRAMS_TO_TEST:%=Output/%.cbe): \
Output/%.cbe: Output/%.cbe.c
- -$(CC) -o $@ $< $(LDFLAGS) $(CFLAGS)
-
-$(PROGRAMS_TO_TEST:%=Output/%.trace.cbe.c): \
-Output/%.trace.cbe.c: Output/%.llvm.trace.bc $(LDIS)
- -$(LDIS) -c < $< > $@
-
-$(PROGRAMS_TO_TEST:%=Output/%.trace.cbe): \
-Output/%.trace.cbe: Output/%.trace.cbe.c
- -$(CC) -o $@ $< $(LDFLAGS) $(CFLAGS) $(TRACELIBS)
+ -$(CC) $< $(LDFLAGS) $(CFLAGS) -o $@
#
# Compile a linked program to machine code with LLC.
@@ -245,20 +230,11 @@
Output/%.llc.s: Output/%.llvm.bc $(LLC)
-$(LLC) $(LLCFLAGS) -f $< -o $@
-$(PROGRAMS_TO_TEST:%=Output/%.trace.llc.s): \
-Output/%.trace.llc.s: Output/%.llvm.trace.bc $(LLC)
- -$(LLC) $(LLCFLAGS) -f $< -o $@
-
# Assemble (and link) an LLVM-linked program using the system assembler...
#
$(PROGRAMS_TO_TEST:%=Output/%.llc): \
Output/%.llc: Output/%.llc.s
- -$(CC) $(CFLAGS) $< $(LLCLIBS) -o $@
-
-$(PROGRAMS_TO_TEST:%=Output/%.trace.llc): \
-Output/%.trace.llc: Output/%.trace.llc.s
- -$(CC) $(CFLAGS) $< $(LLCLIBS) $(TRACELIBS) -o $@
-
+ -$(CC) $(CFLAGS) $< $(LLCLIBS) $(LDFLAGS) -o $@
#
# Rules to execute the program
@@ -299,13 +275,6 @@
Output/%.out-cbe: Output/%.cbe
-$(RUNSAFELY) $(STDIN_FILENAME) $@ $< $(RUN_OPTIONS)
-$(PROGRAMS_TO_TEST:%=Output/%.trace-out-llc): \
-Output/%.trace-out-llc: Output/%.trace.llc
- -$(RUNSAFELY) $(STDIN_FILENAME) $@ $< $(RUN_OPTIONS)
-
-$(PROGRAMS_TO_TEST:%=Output/%.trace-out-cbe): \
-Output/%.trace-out-cbe: Output/%.trace.cbe
- -$(RUNSAFELY) $(STDIN_FILENAME) $@ $< $(RUN_OPTIONS)
endif
#
From vadve at cs.uiuc.edu Tue Jul 8 18:19:01 2003
From: vadve at cs.uiuc.edu (Vikram Adve)
Date: Tue Jul 8 18:19:01 2003
Subject: [llvm-commits] CVS: llvm/test/Programs/Makefile.programs
Message-ID: <200307082318.SAA19777@tank.cs.uiuc.edu>
Changes in directory llvm/test/Programs:
Makefile.programs updated: 1.65 -> 1.66
---
Log message:
Changed default targets when tracing so out-llc and out-cbe are
generated by default.
---
Diffs of the changes:
Index: llvm/test/Programs/Makefile.programs
diff -u llvm/test/Programs/Makefile.programs:1.65 llvm/test/Programs/Makefile.programs:1.66
--- llvm/test/Programs/Makefile.programs:1.65 Tue Jul 8 18:11:48 2003
+++ llvm/test/Programs/Makefile.programs Tue Jul 8 18:18:00 2003
@@ -131,9 +131,20 @@
endif
ifdef DOTRACING
- DISABLE_DIFFS = 1
- OPTPASSES += $(TRACEFLAGS)
- LDFLAGS += $(TRACELIBS)
+ ## When tracing is enabled do the following:
+ ## -- disable output diffs
+ ## -- generate llc output if not disabled
+ ## -- generate cbe output if not disabled
+
+DISABLE_DIFFS = 1
+OPTPASSES += $(TRACEFLAGS)
+LDFLAGS += $(TRACELIBS)
+ifndef DISABLE_LLC
+all:: $(LLCOUTPUT)
+endif
+ifndef DISABLE_CBE
+all:: $(CBEOUTPUT)
+endif
endif
ifndef DISABLE_LLC
From vadve at cs.uiuc.edu Tue Jul 8 18:41:01 2003
From: vadve at cs.uiuc.edu (Vikram Adve)
Date: Tue Jul 8 18:41:01 2003
Subject: [llvm-commits] CVS: llvm/test/Makefile.tests
Message-ID: <200307082340.SAA22269@tank.cs.uiuc.edu>
Changes in directory llvm/test:
Makefile.tests updated: 1.69 -> 1.70
---
Log message:
Simplified DOTRACING flag.
---
Diffs of the changes:
Index: llvm/test/Makefile.tests
diff -u llvm/test/Makefile.tests:1.69 llvm/test/Makefile.tests:1.70
--- llvm/test/Makefile.tests:1.69 Tue Jul 8 13:39:51 2003
+++ llvm/test/Makefile.tests Tue Jul 8 18:40:48 2003
@@ -65,6 +65,7 @@
## If TRACE or TRACEM is "yes", set the appropriate llc flag (-trace or -tracem)
## mark that tracing on, and set the TRACELIBS variable.
TRACEFLAGS =
+DOTRACING =
ifeq ($(TRACE), yes)
TRACEFLAGS += -trace
DOTRACING = yes
@@ -74,7 +75,7 @@
DOTRACING = yes
endif
endif
-ifeq ($(DOTRACING), yes)
+ifdef DOTRACING
TRACELIBS := -L$(LEVEL)/test/Libraries/Output -linstr.$(ARCH)
endif
From vadve at cs.uiuc.edu Tue Jul 8 19:00:01 2003
From: vadve at cs.uiuc.edu (Vikram Adve)
Date: Tue Jul 8 19:00:01 2003
Subject: [llvm-commits] CVS: llvm/test/Programs/SingleSource/UnitTests/2002-05-03-NotTest.c
Message-ID: <200307082359.SAA04695@psmith.cs.uiuc.edu>
Changes in directory llvm/test/Programs/SingleSource/UnitTests:
2002-05-03-NotTest.c updated: 1.1 -> 1.2
---
Log message:
Adding boolean not tests, which are more complicated on a
machine with condition codes!
---
Diffs of the changes:
Index: llvm/test/Programs/SingleSource/UnitTests/2002-05-03-NotTest.c
diff -u llvm/test/Programs/SingleSource/UnitTests/2002-05-03-NotTest.c:1.1 llvm/test/Programs/SingleSource/UnitTests/2002-05-03-NotTest.c:1.2
--- llvm/test/Programs/SingleSource/UnitTests/2002-05-03-NotTest.c:1.1 Fri May 3 14:44:08 2002
+++ llvm/test/Programs/SingleSource/UnitTests/2002-05-03-NotTest.c Tue Jul 8 18:59:31 2003
@@ -1,10 +1,23 @@
#include
-void test(int A, int B, int C, int D) {
- printf("%d %d %d %d\n", ~A, ~B, ~C, ~D);
+void testBitWiseNot(int A, int B, int C, int D) {
+ printf("Bitwise Not: %d %d %d %d\n", ~A, ~B, ~C, ~D);
}
-void main() {
- test(1, 2, -3, 5);
+void testBooleanNot(int A, int B, int C, int D) {
+ printf("Boolean Not: %d %d %d %d %d %d\n",
+ !(A > 0 && B > 0),
+ !(A > 0 && C > 0),
+ !(A > 0 && D > 0),
+ !(B > 0 && C > 0),
+ !(B > 0 && D > 0),
+ !(C > 0 && D > 0));
+
+}
+
+int main() {
+ testBitWiseNot(1, 2, -3, 5);
+ testBooleanNot(1, 2, -3, 5);
+ return 0;
}
From vadve at cs.uiuc.edu Wed Jul 9 10:15:02 2003
From: vadve at cs.uiuc.edu (Vikram Adve)
Date: Wed Jul 9 10:15:02 2003
Subject: [llvm-commits] CVS: llvm/test/Programs/MultiSource/Olden-mst/Makefile
Message-ID: <200307091514.KAA15628@tank.cs.uiuc.edu>
Changes in directory llvm/test/Programs/MultiSource/Olden-mst:
Makefile updated: 1.8 -> 1.9
---
Log message:
Make these runs shorter!
---
Diffs of the changes:
Index: llvm/test/Programs/MultiSource/Olden-mst/Makefile
diff -u llvm/test/Programs/MultiSource/Olden-mst/Makefile:1.8 llvm/test/Programs/MultiSource/Olden-mst/Makefile:1.9
--- llvm/test/Programs/MultiSource/Olden-mst/Makefile:1.8 Mon Jun 16 10:51:26 2003
+++ llvm/test/Programs/MultiSource/Olden-mst/Makefile Wed Jul 9 10:14:10 2003
@@ -3,6 +3,6 @@
PROG = mst
CPPFLAGS = -DTORONTO
LDFLAGS =
-RUN_OPTIONS = 3000
+RUN_OPTIONS = 500
include ../Makefile.multisrc
From brukman at cs.uiuc.edu Wed Jul 9 12:35:05 2003
From: brukman at cs.uiuc.edu (Misha Brukman)
Date: Wed Jul 9 12:35:05 2003
Subject: [llvm-commits] CVS: llvm/lib/CWriter/Writer.cpp
Message-ID: <200307091734.MAA16445@zion.cs.uiuc.edu>
Changes in directory llvm/lib/CWriter:
Writer.cpp updated: 1.105 -> 1.106
---
Log message:
Some beautification changes (tabs to spaces, removed extra blank lines);
no functionality changed.
---
Diffs of the changes:
Index: llvm/lib/CWriter/Writer.cpp
diff -u llvm/lib/CWriter/Writer.cpp:1.105 llvm/lib/CWriter/Writer.cpp:1.106
--- llvm/lib/CWriter/Writer.cpp:1.105 Tue Jul 8 09:52:09 2003
+++ llvm/lib/CWriter/Writer.cpp Wed Jul 9 12:33:50 2003
@@ -471,9 +471,9 @@
<< "*)&FloatConstant" << I->second << ")";
} else {
if (FPCSafeToPrint (FPC)) {
- Out << ftostr (FPC->getValue ());
+ Out << ftostr (FPC->getValue ());
} else {
- Out << FPC->getValue(); // Who knows? Give it our best shot...
+ Out << FPC->getValue(); // Who knows? Give it our best shot...
}
}
break;
@@ -674,7 +674,7 @@
}
// Print Malloc prototype if needed
- if (needsMalloc){
+ if (needsMalloc) {
Out << "\n/* Malloc to make sun happy */\n";
Out << "extern void * malloc();\n\n";
}
@@ -691,7 +691,6 @@
}
}
-
// Output the global variable definitions and contents...
if (!M->gempty()) {
Out << "\n\n/* Global Variable Definitions and Initialization */\n";
@@ -779,7 +778,7 @@
// this one depends on.
void CWriter::printContainedStructs(const Type *Ty,
std::set &StructPrinted){
- if (const StructType *STy = dyn_cast(Ty)){
+ if (const StructType *STy = dyn_cast(Ty)) {
//Check to see if we have already printed this struct
if (StructPrinted.count(STy) == 0) {
// Print all contained types first...
@@ -860,7 +859,6 @@
FunctionInnards << ")";
// Print out the return type and the entire signature for that matter
printType(Out, F->getReturnType(), FunctionInnards.str());
-
}
void CWriter::printFunction(Function *F) {
From brukman at cs.uiuc.edu Thu Jul 10 11:36:01 2003
From: brukman at cs.uiuc.edu (Misha Brukman)
Date: Thu Jul 10 11:36:01 2003
Subject: [llvm-commits] CVS: llvm/tools/opt/Makefile
Message-ID: <200307101635.LAA31368@zion.cs.uiuc.edu>
Changes in directory llvm/tools/opt:
Makefile updated: 1.40 -> 1.41
---
Log message:
Converted tabs to spaces.
---
Diffs of the changes:
Index: llvm/tools/opt/Makefile
diff -u llvm/tools/opt/Makefile:1.40 llvm/tools/opt/Makefile:1.41
--- llvm/tools/opt/Makefile:1.40 Tue Jun 17 15:09:18 2003
+++ llvm/tools/opt/Makefile Thu Jul 10 11:35:17 2003
@@ -2,7 +2,7 @@
TOOLNAME = opt
USEDLIBS = bcreader bcwriter \
- instrument profpaths scalaropts \
+ instrument profpaths scalaropts \
ipo ipa.a datastructure transforms target.a analysis \
transformutils vmcore support
From brukman at cs.uiuc.edu Thu Jul 10 11:51:02 2003
From: brukman at cs.uiuc.edu (Misha Brukman)
Date: Thu Jul 10 11:51:02 2003
Subject: [llvm-commits] CVS: llvm/lib/Support/CommandLine.cpp
Message-ID: <200307101650.LAA32275@zion.cs.uiuc.edu>
Changes in directory llvm/lib/Support:
CommandLine.cpp updated: 1.30 -> 1.31
---
Log message:
`Occurrence' has no `a' and the `r' is doubled.
---
Diffs of the changes:
Index: llvm/lib/Support/CommandLine.cpp
diff -u llvm/lib/Support/CommandLine.cpp:1.30 llvm/lib/Support/CommandLine.cpp:1.31
--- llvm/lib/Support/CommandLine.cpp:1.30 Sat Jun 28 10:47:20 2003
+++ llvm/lib/Support/CommandLine.cpp Thu Jul 10 11:49:51 2003
@@ -93,7 +93,7 @@
}
// Run the handler now!
- return Handler->addOccurance(ArgName, Value);
+ return Handler->addOccurrence(ArgName, Value);
}
static bool ProvidePositionalOption(Option *Handler, std::string &Arg) {
@@ -143,13 +143,13 @@
}
static bool RequiresValue(const Option *O) {
- return O->getNumOccurancesFlag() == cl::Required ||
- O->getNumOccurancesFlag() == cl::OneOrMore;
+ return O->getNumOccurrencesFlag() == cl::Required ||
+ O->getNumOccurrencesFlag() == cl::OneOrMore;
}
static bool EatsUnboundedNumberOfValues(const Option *O) {
- return O->getNumOccurancesFlag() == cl::ZeroOrMore ||
- O->getNumOccurancesFlag() == cl::OneOrMore;
+ return O->getNumOccurrencesFlag() == cl::ZeroOrMore ||
+ O->getNumOccurrencesFlag() == cl::OneOrMore;
}
void cl::ParseCommandLineOptions(int &argc, char **argv,
@@ -168,7 +168,7 @@
unsigned NumPositionalRequired = 0;
Option *ConsumeAfterOpt = 0;
if (!PositionalOpts.empty()) {
- if (PositionalOpts[0]->getNumOccurancesFlag() == cl::ConsumeAfter) {
+ if (PositionalOpts[0]->getNumOccurrencesFlag() == cl::ConsumeAfter) {
assert(PositionalOpts.size() > 1 &&
"Cannot specify cl::ConsumeAfter without a positional argument!");
ConsumeAfterOpt = PositionalOpts[0];
@@ -362,9 +362,9 @@
// do not give it values that others need. 'Done' controls whether the
// option even _WANTS_ any more.
//
- bool Done = PositionalOpts[i]->getNumOccurancesFlag() == cl::Required;
+ bool Done = PositionalOpts[i]->getNumOccurrencesFlag() == cl::Required;
while (NumVals-ValNo > NumPositionalRequired && !Done) {
- switch (PositionalOpts[i]->getNumOccurancesFlag()) {
+ switch (PositionalOpts[i]->getNumOccurrencesFlag()) {
case cl::Optional:
Done = true; // Optional arguments want _at most_ one value
// FALL THROUGH
@@ -373,7 +373,7 @@
ProvidePositionalOption(PositionalOpts[i], PositionalVals[ValNo++]);
break;
default:
- assert(0 && "Internal error, unexpected NumOccurances flag in "
+ assert(0 && "Internal error, unexpected NumOccurrences flag in "
"positional argument processing!");
}
}
@@ -405,10 +405,10 @@
// Loop over args and make sure all required args are specified!
for (std::map::iterator I = Opts.begin(),
E = Opts.end(); I != E; ++I) {
- switch (I->second->getNumOccurancesFlag()) {
+ switch (I->second->getNumOccurrencesFlag()) {
case Required:
case OneOrMore:
- if (I->second->getNumOccurances() == 0) {
+ if (I->second->getNumOccurrences() == 0) {
I->second->error(" must be specified at least once!");
ErrorParsing = true;
}
@@ -442,16 +442,16 @@
return true;
}
-bool Option::addOccurance(const char *ArgName, const std::string &Value) {
- NumOccurances++; // Increment the number of times we have been seen
+bool Option::addOccurrence(const char *ArgName, const std::string &Value) {
+ NumOccurrences++; // Increment the number of times we have been seen
- switch (getNumOccurancesFlag()) {
+ switch (getNumOccurrencesFlag()) {
case Optional:
- if (NumOccurances > 1)
+ if (NumOccurrences > 1)
return error(": may only occur zero or one times!", ArgName);
break;
case Required:
- if (NumOccurances > 1)
+ if (NumOccurrences > 1)
return error(": must occur exactly one time!", ArgName);
// Fall through
case OneOrMore:
@@ -460,7 +460,7 @@
default: return error(": bad num occurances flag value!");
}
- return handleOccurance(ArgName, Value);
+ return handleOccurrence(ArgName, Value);
}
// addArgument - Tell the system that this Option subclass will handle all
@@ -471,9 +471,9 @@
AddArgument(ArgStr, this);
else if (getFormattingFlag() == Positional)
getPositionalOpts().push_back(this);
- else if (getNumOccurancesFlag() == ConsumeAfter) {
+ else if (getNumOccurrencesFlag() == ConsumeAfter) {
assert((getPositionalOpts().empty() ||
- getPositionalOpts().front()->getNumOccurancesFlag() != ConsumeAfter)
+ getPositionalOpts().front()->getNumOccurrencesFlag() != ConsumeAfter)
&& "Cannot specify more than one option with cl::ConsumeAfter "
"specified!");
getPositionalOpts().insert(getPositionalOpts().begin(), this);
@@ -488,7 +488,7 @@
std::find(getPositionalOpts().begin(), getPositionalOpts().end(), this);
assert(I != getPositionalOpts().end() && "Arg not registered!");
getPositionalOpts().erase(I);
- } else if (getNumOccurancesFlag() == ConsumeAfter) {
+ } else if (getNumOccurrencesFlag() == ConsumeAfter) {
assert(!getPositionalOpts().empty() && getPositionalOpts()[0] == this &&
"Arg not registered correctly!");
getPositionalOpts().erase(getPositionalOpts().begin());
@@ -735,7 +735,7 @@
// Print out the positional options...
std::vector &PosOpts = getPositionalOpts();
Option *CAOpt = 0; // The cl::ConsumeAfter option, if it exists...
- if (!PosOpts.empty() && PosOpts[0]->getNumOccurancesFlag() == ConsumeAfter)
+ if (!PosOpts.empty() && PosOpts[0]->getNumOccurrencesFlag() == ConsumeAfter)
CAOpt = PosOpts[0];
for (unsigned i = CAOpt != 0, e = PosOpts.size(); i != e; ++i)
From brukman at cs.uiuc.edu Thu Jul 10 11:51:04 2003
From: brukman at cs.uiuc.edu (Misha Brukman)
Date: Thu Jul 10 11:51:04 2003
Subject: [llvm-commits] CVS: llvm/include/Support/CommandLine.h
Message-ID: <200307101650.LAA32267@zion.cs.uiuc.edu>
Changes in directory llvm/include/Support:
CommandLine.h updated: 1.16 -> 1.17
---
Log message:
`Occurrence' has no `a' and the `r' is doubled.
---
Diffs of the changes:
Index: llvm/include/Support/CommandLine.h
diff -u llvm/include/Support/CommandLine.h:1.16 llvm/include/Support/CommandLine.h:1.17
--- llvm/include/Support/CommandLine.h:1.16 Mon Jun 30 16:58:23 2003
+++ llvm/include/Support/CommandLine.h Thu Jul 10 11:49:50 2003
@@ -34,7 +34,7 @@
// Flags permitted to be passed to command line arguments
//
-enum NumOccurances { // Flags for the number of occurances allowed...
+enum NumOccurrences { // Flags for the number of occurances allowed...
Optional = 0x01, // Zero or One occurance
ZeroOrMore = 0x02, // Zero or more occurances allowed
Required = 0x03, // One occurance required
@@ -49,7 +49,7 @@
//
ConsumeAfter = 0x05,
- OccurancesMask = 0x07,
+ OccurrencesMask = 0x07,
};
enum ValueExpected { // Is a value required for the option?
@@ -104,13 +104,13 @@
friend void cl::ParseCommandLineOptions(int &, char **, const char *, int);
friend class alias;
- // handleOccurances - Overriden by subclasses to handle the value passed into
+ // handleOccurrences - Overriden by subclasses to handle the value passed into
// an argument. Should return true if there was an error processing the
// argument and the program should exit.
//
- virtual bool handleOccurance(const char *ArgName, const std::string &Arg) = 0;
+ virtual bool handleOccurrence(const char *ArgName, const std::string &Arg) = 0;
- virtual enum NumOccurances getNumOccurancesFlagDefault() const {
+ virtual enum NumOccurrences getNumOccurrencesFlagDefault() const {
return Optional;
}
virtual enum ValueExpected getValueExpectedFlagDefault() const {
@@ -123,16 +123,16 @@
return NormalFormatting;
}
- int NumOccurances; // The number of times specified
+ int NumOccurrences; // The number of times specified
int Flags; // Flags for the argument
public:
const char *ArgStr; // The argument string itself (ex: "help", "o")
const char *HelpStr; // The descriptive text message for --help
const char *ValueStr; // String describing what the value of this option is
- inline enum NumOccurances getNumOccurancesFlag() const {
- int NO = Flags & OccurancesMask;
- return NO ? (enum NumOccurances)NO : getNumOccurancesFlagDefault();
+ inline enum NumOccurrences getNumOccurrencesFlag() const {
+ int NO = Flags & OccurrencesMask;
+ return NO ? (enum NumOccurrences)NO : getNumOccurrencesFlagDefault();
}
inline enum ValueExpected getValueExpectedFlag() const {
int VE = Flags & ValueMask;
@@ -169,15 +169,15 @@
Flags |= Flag;
}
- void setNumOccurancesFlag(enum NumOccurances Val) {
- setFlag(Val, OccurancesMask);
+ void setNumOccurrencesFlag(enum NumOccurrences Val) {
+ setFlag(Val, OccurrencesMask);
}
void setValueExpectedFlag(enum ValueExpected Val) { setFlag(Val, ValueMask); }
void setHiddenFlag(enum OptionHidden Val) { setFlag(Val, HiddenMask); }
void setFormattingFlag(enum FormattingFlags V) { setFlag(V, FormattingMask); }
void setMiscFlag(enum MiscFlags M) { setFlag(M, M); }
protected:
- Option() : NumOccurances(0), Flags(0),
+ Option() : NumOccurrences(0), Flags(0),
ArgStr(""), HelpStr(""), ValueStr("") {}
public:
@@ -195,15 +195,15 @@
//
virtual void printOptionInfo(unsigned GlobalWidth) const = 0;
- // addOccurance - Wrapper around handleOccurance that enforces Flags
+ // addOccurrence - Wrapper around handleOccurrence that enforces Flags
//
- bool addOccurance(const char *ArgName, const std::string &Value);
+ bool addOccurrence(const char *ArgName, const std::string &Value);
// Prints option name followed by message. Always returns true.
bool error(std::string Message, const char *ArgName = 0);
public:
- inline int getNumOccurances() const { return NumOccurances; }
+ inline int getNumOccurrences() const { return NumOccurrences; }
virtual ~Option() {}
};
@@ -598,8 +598,8 @@
static void opt(const char *Str, Opt &O) { O.setArgStr(Str); }
};
-template<> struct applicator {
- static void opt(NumOccurances NO, Option &O) { O.setNumOccurancesFlag(NO); }
+template<> struct applicator {
+ static void opt(NumOccurrences NO, Option &O) { O.setNumOccurrencesFlag(NO); }
};
template<> struct applicator {
static void opt(ValueExpected VE, Option &O) { O.setValueExpectedFlag(VE); }
@@ -700,7 +700,7 @@
::boost::is_class::value> {
ParserClass Parser;
- virtual bool handleOccurance(const char *ArgName, const std::string &Arg) {
+ virtual bool handleOccurrence(const char *ArgName, const std::string &Arg) {
typename ParserClass::parser_data_type Val;
if (Parser.parse(*this, ArgName, Arg, Val))
return true; // Parse error!
@@ -846,14 +846,14 @@
class list : public Option, public list_storage {
ParserClass Parser;
- virtual enum NumOccurances getNumOccurancesFlagDefault() const {
+ virtual enum NumOccurrences getNumOccurrencesFlagDefault() const {
return ZeroOrMore;
}
virtual enum ValueExpected getValueExpectedFlagDefault() const {
return Parser.getValueExpectedFlagDefault();
}
- virtual bool handleOccurance(const char *ArgName, const std::string &Arg) {
+ virtual bool handleOccurrence(const char *ArgName, const std::string &Arg) {
typename ParserClass::parser_data_type Val;
if (Parser.parse(*this, ArgName, Arg, Val))
return true; // Parse Error!
@@ -943,8 +943,8 @@
class alias : public Option {
Option *AliasFor;
- virtual bool handleOccurance(const char *ArgName, const std::string &Arg) {
- return AliasFor->handleOccurance(AliasFor->ArgStr, Arg);
+ virtual bool handleOccurrence(const char *ArgName, const std::string &Arg) {
+ return AliasFor->handleOccurrence(AliasFor->ArgStr, Arg);
}
// Aliases default to be hidden...
virtual enum OptionHidden getOptionHiddenFlagDefault() const {return Hidden;}
From brukman at cs.uiuc.edu Thu Jul 10 11:53:00 2003
From: brukman at cs.uiuc.edu (Misha Brukman)
Date: Thu Jul 10 11:53:00 2003
Subject: [llvm-commits] CVS: llvm/Makefile.common
Message-ID: <200307101652.LAA32325@zion.cs.uiuc.edu>
Changes in directory llvm:
Makefile.common updated: 1.97 -> 1.98
---
Log message:
Move the space separator to where it really belongs: in the print statement, not
in a variable assignment.
---
Diffs of the changes:
Index: llvm/Makefile.common
diff -u llvm/Makefile.common:1.97 llvm/Makefile.common:1.98
--- llvm/Makefile.common:1.97 Mon Jul 7 17:27:05 2003
+++ llvm/Makefile.common Thu Jul 10 11:52:41 2003
@@ -297,7 +297,7 @@
# By default, strip symbol information from executable
ifndef KEEP_SYMBOLS
STRIP = $(PLATFORMSTRIPOPTS)
-STRIP_WARN_MSG = "(without symbols) "
+STRIP_WARN_MSG = "(without symbols)"
endif
# Allow gnu extensions...
@@ -618,7 +618,7 @@
$(VERB) $(RM) -f $(TOOLEXENAMES)
$(TOOLEXENAME_G): $(ObjectsG) $(USED_LIB_PATHS_G) $(DESTTOOLDEBUG)/.dir
- @echo ======= Linking $(TOOLNAME) debug executable $(STRIP_WARN_MSG)=======
+ @echo ======= Linking $(TOOLNAME) debug executable $(STRIP_WARN_MSG) =======
$(VERB) $(LinkG) -o $@ $(ObjectsG) $(LIB_OPTS_G) $(LINK_OPTS) $(LIBS)
$(TOOLEXENAME_O): $(ObjectsO) $(USED_LIB_PATHS_O) $(DESTTOOLRELEASE)/.dir
From brukman at cs.uiuc.edu Thu Jul 10 12:06:03 2003
From: brukman at cs.uiuc.edu (Misha Brukman)
Date: Thu Jul 10 12:06:03 2003
Subject: [llvm-commits] CVS: llvm/lib/Support/CommandLine.cpp
Message-ID: <200307101705.MAA32654@zion.cs.uiuc.edu>
Changes in directory llvm/lib/Support:
CommandLine.cpp updated: 1.31 -> 1.32
---
Log message:
Lowercase versions of `occurrence' need to be spelled correctly, too.
---
Diffs of the changes:
Index: llvm/lib/Support/CommandLine.cpp
diff -u llvm/lib/Support/CommandLine.cpp:1.31 llvm/lib/Support/CommandLine.cpp:1.32
--- llvm/lib/Support/CommandLine.cpp:1.31 Thu Jul 10 11:49:51 2003
+++ llvm/lib/Support/CommandLine.cpp Thu Jul 10 12:05:26 2003
@@ -247,18 +247,18 @@
const char *ArgNameEnd = ArgName;
while (*ArgNameEnd && *ArgNameEnd != '=')
- ++ArgNameEnd; // Scan till end of argument name...
+ ++ArgNameEnd; // Scan till end of argument name...
Value = ArgNameEnd;
if (*Value) // If we have an equals sign...
- ++Value; // Advance to value...
+ ++Value; // Advance to value...
if (*ArgName != 0) {
- std::string RealName(ArgName, ArgNameEnd);
- // Extract arg name part
+ std::string RealName(ArgName, ArgNameEnd);
+ // Extract arg name part
std::map::iterator I = Opts.find(RealName);
- if (I == Opts.end() && !*Value && RealName.size() > 1) {
+ if (I == Opts.end() && !*Value && RealName.size() > 1) {
// Check to see if this "option" is really a prefixed or grouped
// argument...
//
@@ -283,13 +283,13 @@
std::string RealArgName(RealName.begin(),RealName.begin()+Length);
RealName.erase(RealName.begin(), RealName.begin()+Length);
- // Because ValueRequired is an invalid flag for grouped arguments,
- // we don't need to pass argc/argv in...
- //
+ // Because ValueRequired is an invalid flag for grouped arguments,
+ // we don't need to pass argc/argv in...
+ //
assert(PGOpt->getValueExpectedFlag() != cl::ValueRequired &&
"Option can not be cl::Grouping AND cl::ValueRequired!");
int Dummy;
- ErrorParsing |= ProvideOption(PGOpt, RealArgName.c_str(), "",
+ ErrorParsing |= ProvideOption(PGOpt, RealArgName.c_str(), "",
0, 0, Dummy);
// Get the next grouping option...
@@ -305,7 +305,7 @@
//
I = Opts.end();
}
- }
+ }
Handler = I != Opts.end() ? I->second : 0;
}
@@ -404,12 +404,12 @@
// Loop over args and make sure all required args are specified!
for (std::map::iterator I = Opts.begin(),
- E = Opts.end(); I != E; ++I) {
+ E = Opts.end(); I != E; ++I) {
switch (I->second->getNumOccurrencesFlag()) {
case Required:
case OneOrMore:
if (I->second->getNumOccurrences() == 0) {
- I->second->error(" must be specified at least once!");
+ I->second->error(" must be specified at least once!");
ErrorParsing = true;
}
// Fall through
@@ -457,14 +457,14 @@
case OneOrMore:
case ZeroOrMore:
case ConsumeAfter: break;
- default: return error(": bad num occurances flag value!");
+ default: return error(": bad num occurrences flag value!");
}
return handleOccurrence(ArgName, Value);
}
// addArgument - Tell the system that this Option subclass will handle all
-// occurances of -ArgStr on the command line.
+// occurrences of -ArgStr on the command line.
//
void Option::addArgument(const char *ArgStr) {
if (ArgStr[0])
@@ -715,7 +715,7 @@
// Eliminate Hidden or ReallyHidden arguments, depending on ShowHidden
Options.erase(std::remove_if(Options.begin(), Options.end(),
std::ptr_fun(ShowHidden ? isReallyHidden : isHidden)),
- Options.end());
+ Options.end());
// Eliminate duplicate entries in table (from enum flags options, f.e.)
{ // Give OptionSet a scope
From brukman at cs.uiuc.edu Thu Jul 10 12:06:06 2003
From: brukman at cs.uiuc.edu (Misha Brukman)
Date: Thu Jul 10 12:06:06 2003
Subject: [llvm-commits] CVS: llvm/include/Support/CommandLine.h
Message-ID: <200307101705.MAA32647@zion.cs.uiuc.edu>
Changes in directory llvm/include/Support:
CommandLine.h updated: 1.17 -> 1.18
---
Log message:
Lowercase versions of `occurrence' need to be spelled correctly, too.
---
Diffs of the changes:
Index: llvm/include/Support/CommandLine.h
diff -u llvm/include/Support/CommandLine.h:1.17 llvm/include/Support/CommandLine.h:1.18
--- llvm/include/Support/CommandLine.h:1.17 Thu Jul 10 11:49:50 2003
+++ llvm/include/Support/CommandLine.h Thu Jul 10 12:05:25 2003
@@ -34,11 +34,11 @@
// Flags permitted to be passed to command line arguments
//
-enum NumOccurrences { // Flags for the number of occurances allowed...
- Optional = 0x01, // Zero or One occurance
- ZeroOrMore = 0x02, // Zero or more occurances allowed
- Required = 0x03, // One occurance required
- OneOrMore = 0x04, // One or more occurances required
+enum NumOccurrences { // Flags for the number of occurrences allowed
+ Optional = 0x01, // Zero or One occurrence
+ ZeroOrMore = 0x02, // Zero or more occurrences allowed
+ Required = 0x03, // One occurrence required
+ OneOrMore = 0x04, // One or more occurrences required
// ConsumeAfter - Indicates that this option is fed anything that follows the
// last positional argument required by the application (it is an error if
@@ -182,7 +182,7 @@
public:
// addArgument - Tell the system that this Option subclass will handle all
- // occurances of -ArgStr on the command line.
+ // occurrences of -ArgStr on the command line.
//
void addArgument(const char *ArgStr);
void removeArgument(const char *ArgStr);
From ashukla at cs.uiuc.edu Thu Jul 10 13:58:01 2003
From: ashukla at cs.uiuc.edu (Anand Shukla)
Date: Thu Jul 10 13:58:01 2003
Subject: [llvm-commits] CVS: llvm/lib/Reoptimizer/TraceCache/MemoryManager.cpp
Message-ID: <200307101857.NAA06857@niobe.cs.uiuc.edu>
Changes in directory llvm/lib/Reoptimizer/TraceCache:
MemoryManager.cpp updated: 1.6 -> 1.7
---
Log message:
Some cleanup, and some additions for new trace framework
---
Diffs of the changes:
Index: llvm/lib/Reoptimizer/TraceCache/MemoryManager.cpp
diff -u llvm/lib/Reoptimizer/TraceCache/MemoryManager.cpp:1.6 llvm/lib/Reoptimizer/TraceCache/MemoryManager.cpp:1.7
--- llvm/lib/Reoptimizer/TraceCache/MemoryManager.cpp:1.6 Sat May 31 21:32:55 2003
+++ llvm/lib/Reoptimizer/TraceCache/MemoryManager.cpp Thu Jul 10 13:57:43 2003
@@ -29,21 +29,56 @@
using std::cerr;
-int dummyFunction(int i); //the function that provides memory!
+int FirstTraceFunction(int i); //the function that provides memory!
MemoryManager::MemoryManager(){
- uint64_t memAlign = (uint64_t)(intptr_t)&dummyFunction;
+ uint64_t memAlign = (uint64_t)(intptr_t)&FirstTraceFunction;
if(memAlign % 32){
memAlign -= (memAlign % 32);
memAlign += 32;
}
memStart = memAlign;
- memEnd = (uint64_t)(intptr_t)&dummyFunction+globalMemSize*4;
+ memEnd = (uint64_t)(intptr_t)&FirstTraceFunction+globalMemSize*4;
+
+ memorySize = globalMemSize;
+
+ //std::cerr<<"Dummy address :"<<(void *)memStart<<"\n";
+ freeMemList.push_back(std::make_pair(memStart, memEnd));
+}
+
+
+MemoryManager::MemoryManager(unsigned int memSize){
+ uint64_t memAlign = (uint64_t)(intptr_t)&FirstTraceFunction;
+ if(memAlign % 32){
+ memAlign -= (memAlign % 32);
+ memAlign += 32;
+ }
+
+ memorySize = memSize;
+
+ memStart = memAlign;
+ memEnd = (uint64_t)(intptr_t)&FirstTraceFunction+memSize*4;
+ //std::cerr<<"Dummy address :"<<(void *)memStart<<"\n";
+ freeMemList.push_back(std::make_pair(memStart, memEnd));
+}
+
+MemoryManager::MemoryManager(int (*dfunc)(int), unsigned int memSize){
+ uint64_t memAlign = (uint64_t)(intptr_t)dfunc;
+ if(memAlign % 32){
+ memAlign -= (memAlign % 32);
+ memAlign += 32;
+ }
+
+ memorySize = memSize;
+
+ memStart = memAlign;
+ memEnd = (uint64_t)(intptr_t)dfunc+memSize*4;
//std::cerr<<"Dummy address :"<<(void *)memStart<<"\n";
freeMemList.push_back(std::make_pair(memStart, memEnd));
}
+
//allocate the first free memory
//returns 0 if no memory can be assigned
uint64_t MemoryManager::getMemory(int sz){
@@ -102,8 +137,8 @@
freeMemList.push_back(std::make_pair(toRemove, toRemove + size - 1));
}
-//this provides space for traces!
-int dummyFunction(int i){
+//this provides space for traces: abt 128KB
+int FirstTraceFunction(int i){
for(int j=0; j<20; j++){
if(j>10)
i+=1;
@@ -4370,5 +4405,4276 @@
else
i+=2;
}
- return i;
-}
+
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+ for(int j=0; j<20; j++){
+ if(j>10)
+ i+=1;
+ else
+ i+=2;
+ }
+
+ return i;
+}
+
+
+//////////////////////////////////////////////////
From ashukla at cs.uiuc.edu Thu Jul 10 13:58:07 2003
From: ashukla at cs.uiuc.edu (Anand Shukla)
Date: Thu Jul 10 13:58:07 2003
Subject: [llvm-commits] CVS: llvm/lib/Reoptimizer/TraceCache/TraceCache.cpp
Message-ID: <200307101857.NAA06850@niobe.cs.uiuc.edu>
Changes in directory llvm/lib/Reoptimizer/TraceCache:
TraceCache.cpp updated: 1.13 -> 1.14
---
Log message:
Some cleanup, and some additions for new trace framework
---
Diffs of the changes:
Index: llvm/lib/Reoptimizer/TraceCache/TraceCache.cpp
diff -u llvm/lib/Reoptimizer/TraceCache/TraceCache.cpp:1.13 llvm/lib/Reoptimizer/TraceCache/TraceCache.cpp:1.14
--- llvm/lib/Reoptimizer/TraceCache/TraceCache.cpp:1.13 Thu Jun 5 16:02:07 2003
+++ llvm/lib/Reoptimizer/TraceCache/TraceCache.cpp Thu Jul 10 13:57:39 2003
@@ -19,7 +19,6 @@
#include "llvm/Reoptimizer/MemoryManager.h"
#include "llvm/Reoptimizer/TraceCache.h"
-#include "llvm/Reoptimizer/TraceCache2.h"
#include "llvm/Reoptimizer/VirtualMem.h"
#include "llvm/Reoptimizer/InstrUtils.h"
#include "llvm/Reoptimizer/GetTraceTime.h"
@@ -27,6 +26,8 @@
#include
#include
+//#define GET_ALL_INFO
+
using std::cerr;
TraceCache::TraceCache(int limitSize){
@@ -62,95 +63,32 @@
vm = vmem;
}
-void TraceCache::setLimit(int n) {
- assert(isLimitSet && "can't chage limit, if not set initially");
- assert(currSize < n && "trying to set to a smaller limit than current size");
- limit = n;
-}
-
-//add an array of instructions (trace[]), whose first instruction
-//has address instrAddr in the original program
-//size of array is sz (number of instructions)
-// returns false if cannot assign space to trace
-
-//Do the following:
-//1. Insert a jump at location instrAddr with target as new trace
-bool TraceCache::addTrace(uint64_t instAddr,
- std::vector &trace,
- int traceUniqId,
- std::map &callMap,
- std::map &branchMap){
-
- //remove trace if its already there
- if(hasTraceAddr(instAddr))
- removeTrace(instAddr);
+TraceCache::TraceCache(unsigned int memSize, VirtualMem *vmem){
+ mm = new MemoryManager(memSize);
- int sz = trace.size();
-
- while(isLimitSet && currSize+sz>limit){
- if(currSize == 0)
- return false;
-
- //erase first addr from queue
- assert(allocationOrder.size()>0 && "No entries in trace!");
- uint64_t addr = allocationOrder.front();
- allocationOrder.pop_front();
- removeTrace(addr);
- }
-
- uint64_t traceStartAddr = mm->getMemory(sz);
-
- if(traceStartAddr == 0) return false; //could not allocate space!
-
- //copy trace to the memory
- vm->copyToVM(trace, traceStartAddr);
+ isLimitSet = true; //making limit as the size of memory
+ currSize = 0;
+ limit = mm->getMemSize();
- traces[instAddr] = traceStartAddr;
- traceId[traceUniqId] = traceStartAddr;
- reverseTraceId[instAddr] = traceUniqId;
- traceSize[instAddr] = sz;
- reverseMap[traceStartAddr] = instAddr;
- currSize += sz;
-
- //add instAddr to queue
- allocationOrder.push_back(instAddr);
-
- //copy the first few instructions of the trace in the original code
- //and write a jump instruction in its place
- traceInstructions[instAddr].push_back(vm->readInstrFrmVm(instAddr));
- traceInstructions[instAddr].push_back(vm->readInstrFrmVm(instAddr+4));
-
-#ifdef GET_TRACE_TIME
- //two more: to accomodate call instruction and get time!
- traceInstructions[instAddr].push_back(vm->readInstrFrmVm(instAddr+8));
- traceInstructions[instAddr].push_back(vm->readInstrFrmVm(instAddr+12));
+ vm = vmem;
+}
- //write call instruction!
- vm->writeCallLLVMTime(instAddr);
- //Now write branch instruction with target as
- //traceStartAddr at the address instAddr
- vm->writeBranchInstruction(instAddr+8, traceStartAddr);
-#endif
+TraceCache::TraceCache(int (*dfunc)(int), unsigned int memSize,
+ VirtualMem *vmem){
+ mm = new MemoryManager(dfunc, memSize);
-#ifndef GET_TRACE_TIME
- vm->writeBranchInstruction(instAddr, traceStartAddr);
-#endif
-
- //now set correctly all branches
- vm->setBranches(branchMap, traceStartAddr);
-
- //set correctly all calls
- vm->setCalls(callMap, traceStartAddr);
-
- doFlush(traceStartAddr, traceStartAddr+4*sz);
- doFlush(instAddr, instAddr+4);
+ isLimitSet = true; //making limit as the size of memory
+ currSize = 0;
+ limit = mm->getMemSize();
+
+ vm = vmem;
+}
-#ifdef GET_TRACE_TIME
- doFlush(instAddr+8, instAddr+12);
-#endif
-
- return true;
+void TraceCache::setLimit(int n) {
+ assert(isLimitSet && "can't chage limit, if not set initially");
+ assert(currSize < n && "trying to set to a smaller limit than current size");
+ limit = n;
}
bool TraceCache::hasTraceInstructions(uint64_t addr){
@@ -158,6 +96,14 @@
traceInstructions[addr].size()!=0);
}
+uint64_t TraceCache::getEndAddress(uint64_t addr){
+ if(endAddress.find(addr) != endAddress.end())
+ return endAddress[addr];
+
+ return 0;
+}
+
+
unsigned int TraceCache::getAddr(uint64_t addr){
if(hasTraceInstructions(addr))
return traceInstructions[addr][0];
@@ -178,17 +124,24 @@
return traceInstructions[addr];
}
+//add an array of instructions (trace[]), whose first instruction
+//has address instrAddr in the original program
+//size of array is sz (number of instructions)
+// returns false if cannot assign space to trace
+
+////USING THIS
//Do the following:
//1. Insert a jump at location instrAddr with target as new trace
-bool TraceCache::addTrace(uint64_t instAddr,
- std::vector &trace,
- int traceUniqId,
- std::map &callMap,
- std::map &branchMap, TraceCache2 *tr2){
+bool TraceCache::addTrace(uint64_t &instAddr,
+ uint64_t &endAddr,
+ std::vector &trace,
+ uint64_t traceUniqId,
+ std::map &callMap,
+ std::map &branchMap, TraceCache *tr2){
//remove trace if its already there
- //if(hasTraceAddr(instAddr))
- //removeTrace(instAddr);
+ if(hasTraceAddr(instAddr))
+ removeTrace(instAddr);
int sz = trace.size();
@@ -199,7 +152,7 @@
while(isLimitSet && currSize+sz>limit){
- assert(0 && "out of space");
+ //assert(0 && "out of space");
if(currSize == 0)
return false;
@@ -219,6 +172,7 @@
vm->copyToVM(trace, traceStartAddr);
traces[instAddr] = traceStartAddr;
+ endAddress[instAddr] = endAddr;
traceId[traceUniqId] = traceStartAddr;
reverseTraceId[instAddr] = traceUniqId;
traceSize[instAddr] = sz;
@@ -296,6 +250,10 @@
if(traces.find(n) == traces.end())
return;
+#ifdef GET_ALL_INFO
+ std::cerr<<"Removing-trace\t"<<(void *)n<<"\t"<<(void *)endAddress[n]<<"\n";
+#endif
+
uint64_t toRemove = traces[n];
//put back the original instruction at n
@@ -321,6 +279,7 @@
currSize -= traceSize[n];
//remove allocated spaces to n
traces.erase(n);
+ endAddress.erase(n);
traceId.erase(reverseTraceId[n]);
reverseTraceId.erase(n);
traceSize.erase(n);
@@ -332,7 +291,7 @@
bool TraceCache::addTrace(uint64_t instAddr,
std::vector &trace,
- int traceUniqId,
+ uint64_t traceUniqId,
std::map &callMap,
std::map &branchMap,
std::vector *exitStubs){
@@ -416,7 +375,7 @@
//#undef GET_TRACE_TIME
bool TraceCache::addTrace(uint64_t instAddr, int sz,
- int traceUniqId, uint64_t &addr){
+ uint64_t traceUniqId, uint64_t &addr){
//remove trace if its already there
if(hasTraceAddr(instAddr))
@@ -480,29 +439,32 @@
return true;
}
+//USING THIS
//Do the following:
//1. Insert a jump at location instrAddr with target as new trace
-bool TraceCache::addTrace(uint64_t instAddr,
+bool TraceCache::addTrace(uint64_t instAddr,
+ uint64_t endAddr,
std::vector &trace,
- int traceUniqId,
+ uint64_t traceUniqId,
std::map &callMap,
std::map &myBranchMap,
std::map &branchMap,
- uint64_t firstLevelTraceStartAddr){
+ uint64_t firstLevelTraceStartAddr, TraceCache *tr){
//remove trace if its already there
- //if(hasTraceAddr(instAddr))// && uniqueID(instAddrtraceUniqId))
- //removeTrace(instAddr);
+ if(hasTraceAddr(instAddr))// && uniqueID(instAddrtraceUniqId))
+ removeTrace(instAddr);
int sz = trace.size();
+
if(sz%8){
sz = sz - (sz % 8);
sz = sz + 8;
}
-
+
while(isLimitSet && currSize+sz>limit){
- assert(0 && "Can't allocate more mem!");
+ //assert(0 && "Can't allocate more mem!");
if(currSize == 0)
return false;
@@ -522,7 +484,7 @@
vm->copyToVM(trace, traceStartAddr);
traces[instAddr] = traceStartAddr;
-
+ endAddress[instAddr] = endAddr;
traceId[traceUniqId] = traceStartAddr;
reverseTraceId[instAddr] = traceUniqId;
traceSize[instAddr] = sz;
@@ -532,16 +494,22 @@
//add instAddr to queue
allocationOrder.push_back(instAddr);
- //copy the first few instructions of the trace in the original code
- //and write a jump instruction in its place
- traceInstructions[instAddr].push_back(vm->readInstrFrmVm(instAddr));
- traceInstructions[instAddr].push_back(vm->readInstrFrmVm(instAddr+4));
-
+ bool ifPushed = false;
+ if(!hasTraceInstructions(instAddr)){
+ //traceInstructions[instAddr].clear();
+ //copy the first few instructions of the trace in the original code
+ //and write a jump instruction in its place
+ traceInstructions[instAddr].push_back(vm->readInstrFrmVm(instAddr, tr));
+ //traceInstructions[instAddr].push_back(vm->readInstrFrmVm(instAddr+4));
+ ifPushed = true;
+ }
#ifdef GET_TRACE_TIME
- //two more: to accomodate call instruction and get time!
- traceInstructions[instAddr].push_back(vm->readInstrFrmVm(instAddr+8));
- traceInstructions[instAddr].push_back(vm->readInstrFrmVm(instAddr+12));
-
+ if(ifPushed){
+ //two more: to accomodate call instruction and get time!
+ traceInstructions[instAddr].push_back(vm->readInstrFrmVm(instAddr+4, tr));
+ traceInstructions[instAddr].push_back(vm->readInstrFrmVm(instAddr+8, tr));
+ ifPushed = false;
+ }
//write call instruction!
vm->writeCallLLVMTime(instAddr);
@@ -571,7 +539,7 @@
#endif
//now write branch in the level 1 tracecache
- vm->writeBranchInstruction(firstLevelTraceStartAddr+4, traceStartAddr);
+ vm->writeBranchInstruction(firstLevelTraceStartAddr, traceStartAddr);
doFlush(firstLevelTraceStartAddr+4, firstLevelTraceStartAddr+20);
return true;
@@ -590,4 +558,16 @@
return RMI->first;
abort();
-}
+}
+
+bool TraceCache::hasTraceInRange(uint64_t addr1, uint64_t addr2){
+ for(std::map::iterator MI = traces.begin(),
+ ME = traces.end(); MI != ME; ++MI)
+ if(MI->first >= addr1 &&
+ (endAddress.find(addr1) != endAddress.end() &&
+ endAddress[addr1] <= addr2))
+ return true;
+
+ return false;
+}
+
From ashukla at cs.uiuc.edu Thu Jul 10 13:58:10 2003
From: ashukla at cs.uiuc.edu (Anand Shukla)
Date: Thu Jul 10 13:58:10 2003
Subject: [llvm-commits] CVS: llvm/lib/Reoptimizer/Makefile
Message-ID: <200307101856.NAA06832@niobe.cs.uiuc.edu>
Changes in directory llvm/lib/Reoptimizer:
Makefile updated: 1.9 -> 1.10
---
Log message:
Restricted subdirectories to only Sparc
---
Diffs of the changes:
Index: llvm/lib/Reoptimizer/Makefile
diff -u llvm/lib/Reoptimizer/Makefile:1.9 llvm/lib/Reoptimizer/Makefile:1.10
--- llvm/lib/Reoptimizer/Makefile:1.9 Sat May 31 21:39:43 2003
+++ llvm/lib/Reoptimizer/Makefile Thu Jul 10 13:56:48 2003
@@ -1,4 +1,8 @@
LEVEL = ../..
-DIRS = Mapping TraceCache Trigger BinInterface
+include $(LEVEL)/Makefile.config
+ifeq ($(ARCH),Sparc)
+DIRS = Mapping TraceCache LightWtProfiling
+endif
+#Trigger BinInterface
include $(LEVEL)/Makefile.common
From ashukla at cs.uiuc.edu Thu Jul 10 13:59:24 2003
From: ashukla at cs.uiuc.edu (Anand Shukla)
Date: Thu Jul 10 13:59:24 2003
Subject: [llvm-commits] CVS: llvm/lib/Reoptimizer/TraceCache/VirtualMem.cpp
Message-ID: <200307101858.NAA06890@niobe.cs.uiuc.edu>
Changes in directory llvm/lib/Reoptimizer/TraceCache:
VirtualMem.cpp updated: 1.10 -> 1.11
---
Log message:
Some cleanup, and some additions for new trace framework
---
Diffs of the changes:
Index: llvm/lib/Reoptimizer/TraceCache/VirtualMem.cpp
diff -u llvm/lib/Reoptimizer/TraceCache/VirtualMem.cpp:1.10 llvm/lib/Reoptimizer/TraceCache/VirtualMem.cpp:1.11
--- llvm/lib/Reoptimizer/TraceCache/VirtualMem.cpp:1.10 Sat May 31 21:33:18 2003
+++ llvm/lib/Reoptimizer/TraceCache/VirtualMem.cpp Thu Jul 10 13:58:41 2003
@@ -7,7 +7,7 @@
#include "llvm/Reoptimizer/VirtualMem.h"
#include "llvm/Reoptimizer/InstrUtils.h"
#include "llvm/Reoptimizer/TraceCache.h"
-#include "llvm/Reoptimizer/TraceCache2.h"
+//#include "llvm/Reoptimizer/TraceCache2.h"
#include "llvm/Reoptimizer/GetTraceTime.h"
VirtualMem::VirtualMem(){
@@ -51,9 +51,8 @@
return instr;
}
-
-
-unsigned int VirtualMem::readInstrFrmVm(uint64_t frm, TraceCache2 *tr){
+/*
+unsigned int VirtualMem::readInstrFrmVm(uint64_t frm, TraceCache *tr){
unsigned int instr=0;
instr = tr->getAddr(frm);
@@ -65,11 +64,12 @@
read(fp, &instr, 4);
return instr;
}
+*/
-
-unsigned int VirtualMem::readInstrFrmVm(uint64_t frm, TraceCache *tr, TraceCache2 *tr2){
+unsigned int VirtualMem::readInstrFrmVm(uint64_t frm, TraceCache *tr,
+ TraceCache *tr2){
unsigned int instr=0;
-
+
instr = tr->getAddr(frm);
if(instr)
return instr;
From ashukla at cs.uiuc.edu Thu Jul 10 13:59:28 2003
From: ashukla at cs.uiuc.edu (Anand Shukla)
Date: Thu Jul 10 13:59:28 2003
Subject: [llvm-commits] CVS: llvm/lib/Reoptimizer/TraceCache/MemoryManager2.h
Message-ID: <200307101858.NAA06880@niobe.cs.uiuc.edu>
Changes in directory llvm/lib/Reoptimizer/TraceCache:
MemoryManager2.h (r1.1) removed
---
Log message:
Removed a file no longer required
---
Diffs of the changes:
From ashukla at cs.uiuc.edu Thu Jul 10 13:59:31 2003
From: ashukla at cs.uiuc.edu (Anand Shukla)
Date: Thu Jul 10 13:59:31 2003
Subject: [llvm-commits] CVS: llvm/lib/Reoptimizer/TraceCache/MemoryManager2.cpp
Message-ID: <200307101858.NAA06872@niobe.cs.uiuc.edu>
Changes in directory llvm/lib/Reoptimizer/TraceCache:
MemoryManager2.cpp (r1.3) removed
---
Log message:
Removed a file no longer required
---
Diffs of the changes:
From ashukla at cs.uiuc.edu Thu Jul 10 13:59:34 2003
From: ashukla at cs.uiuc.edu (Anand Shukla)
Date: Thu Jul 10 13:59:34 2003
Subject: [llvm-commits] CVS: llvm/lib/Reoptimizer/TraceCache/InstrUtils.cpp
Message-ID: <200307101858.NAA06863@niobe.cs.uiuc.edu>
Changes in directory llvm/lib/Reoptimizer/TraceCache:
InstrUtils.cpp updated: 1.10 -> 1.11
---
Log message:
Some cleanup, and some additions for new trace framework
---
Diffs of the changes:
Index: llvm/lib/Reoptimizer/TraceCache/InstrUtils.cpp
diff -u llvm/lib/Reoptimizer/TraceCache/InstrUtils.cpp:1.10 llvm/lib/Reoptimizer/TraceCache/InstrUtils.cpp:1.11
--- llvm/lib/Reoptimizer/TraceCache/InstrUtils.cpp:1.10 Sat May 31 21:32:49 2003
+++ llvm/lib/Reoptimizer/TraceCache/InstrUtils.cpp Thu Jul 10 13:57:33 2003
@@ -211,4 +211,14 @@
//mask with 2^32-1-2^25-2^26-2^27-2^28
return (br1 & 3791650815U)|(cond);
}
+
+bool isIndirectCall(unsigned instr){
+ return ((instr & 0xfff80000) == 0x9fc00000);
+}
+
+bool isReturn(unsigned int inst){
+ return (((inst & 0xc1ffffff) == 0x81cfe008) ||
+ ((inst & 0xffffffff) == 0x81c7e008) ||
+ ((inst & 0xffffffff) == 0x81c3e008));
+}
#endif
From ashukla at cs.uiuc.edu Thu Jul 10 14:00:02 2003
From: ashukla at cs.uiuc.edu (Anand Shukla)
Date: Thu Jul 10 14:00:02 2003
Subject: [llvm-commits] CVS: llvm/lib/Reoptimizer/TraceCache/TraceCache2.cpp
Message-ID: <200307101859.NAA06902@niobe.cs.uiuc.edu>
Changes in directory llvm/lib/Reoptimizer/TraceCache:
TraceCache2.cpp (r1.2) removed
---
Log message:
Some cleanup, and some additions for new trace framework
---
Diffs of the changes:
From ashukla at cs.uiuc.edu Thu Jul 10 14:01:01 2003
From: ashukla at cs.uiuc.edu (Anand Shukla)
Date: Thu Jul 10 14:01:01 2003
Subject: [llvm-commits] CVS: llvm/include/llvm/Reoptimizer/TraceCache.h
Message-ID: <200307101900.OAA06951@niobe.cs.uiuc.edu>
Changes in directory llvm/include/llvm/Reoptimizer:
TraceCache.h updated: 1.11 -> 1.12
---
Log message:
Some cleanup, and some additions for new trace framework
---
Diffs of the changes:
Index: llvm/include/llvm/Reoptimizer/TraceCache.h
diff -u llvm/include/llvm/Reoptimizer/TraceCache.h:1.11 llvm/include/llvm/Reoptimizer/TraceCache.h:1.12
--- llvm/include/llvm/Reoptimizer/TraceCache.h:1.11 Mon Jun 30 16:58:31 2003
+++ llvm/include/llvm/Reoptimizer/TraceCache.h Thu Jul 10 14:00:47 2003
@@ -15,16 +15,17 @@
class VirtualMem;
class MemoryManager;
-class TraceCache2;
+//class TraceCache2;
class TraceCache{
private:
std::map traces; //map from addr to addr
+ std::map endAddress; //end of loop address
std::map traceSize;//size of trace allocatted
- std::map traceId;
- std::map reverseTraceId;
+ std::map traceId; //id -> startAddr map
+ std::map reverseTraceId; //startAddr->ID
- std::map uniqueID;
+ //std::map uniqueID;
std::map > traceInstructions;
@@ -61,8 +62,19 @@
uint64_t getAddrLessThan(uint64_t brAddr);
+ uint64_t getEndAddress(uint64_t addr);
+
bool hasMaxSize(){ return isLimitSet;}
bool hasTraceAddr(uint64_t n){ return (traces.find(n)!=traces.end()); }
+
+ bool hasTraceAddr(uint64_t start, uint64_t end){
+ return hasTraceAddr(start) && getEndAddress(start) == end;
+ }
+
+ bool hasTraceWithId(uint64_t addr, uint64_t id){
+ return hasTraceAddr(addr) && reverseTraceId[addr] == id;
+ }
+
bool hasTraceId(int n) { return (traceId.find(n)!=traceId.end()); }
bool hasTraceInstructions(uint64_t addr);
@@ -73,12 +85,26 @@
return reverseMap[n];
}
- unsigned int getAddr(uint64_t addr);
+ unsigned int getAddr(uint64_t addr); //return instruction at an address
+
+ //address where trace starts
+ uint64_t getStartAddr(uint64_t addr){
+ assert(hasTraceAddr(addr) && "No such trace!");
+ return traces[addr];
+ }
+
+ //see if there is a trace in trace cache that could be
+ //within some address range
+ bool hasTraceInRange(uint64_t addr1, uint64_t addr2);
//constructors
TraceCache(int limitSize);
TraceCache(VirtualMem *vmem);
+ TraceCache(unsigned int size, VirtualMem *vmem);
TraceCache();
+ //the code region of dfunc is used for memory allocation
+ //instead of default memory allocation space used by memory manager
+ TraceCache(int (*dfunc)(int), unsigned int memSize, VirtualMem *vmem);
//remove the branch from the original code into the trace
void patchTrace(uint64_t n);
@@ -91,41 +117,36 @@
//addresses to jump to the new location for addresses that use the
//basic block bb as target
- bool addTrace(uint64_t instAddr,
+ //USING THIS
+ bool addTrace(uint64_t &instAddr, uint64_t &endAddr,
std::vector &trace,
- int traceUniqId,
+ uint64_t traceUniqId,
std::map &callMap,
- std::map &branchMap);
-
- bool addTrace(uint64_t instAddr,
- std::vector &trace,
- int traceUniqId,
- std::map &callMap,
- std::map &branchMap, TraceCache2 *tr2);
+ std::map &branchMap, TraceCache *tr2);
bool addTrace(uint64_t instAddr,
std::vector &trace,
- int traceUniqId,
+ uint64_t traceUniqId,
std::map &callMap,
std::map &branchMap,
std::vector *exitStubs);
- bool addTrace(uint64_t instAddr, int sz, int traceUniqId,
+ bool addTrace(uint64_t instAddr, int sz, uint64_t traceUniqId,
uint64_t &addr);
-
- bool addTrace(uint64_t instAddr,
+ //for managing multiple traces:
+ //the firstLevelTraceStartAddr is the address
+ //where a branch should be placed to jump to new
+ //trace
+ bool addTrace(uint64_t instAddr,
+ uint64_t endAddr,
std::vector &trace,
- int traceUniqId,
+ uint64_t traceUniqId,
std::map &callMap,
std::map &myBranchMap,
std::map &branchMap,
- uint64_t firstLevelTraceStartAddr);
-
- //bool addTrace(uint64_t instAddr, unsigned int trace[], int sz,
- // std::vector &inBranches,
- // std::vector > &outBranches, int traceUniqId);
-
+ uint64_t firstLevelTraceStartAddr, TraceCache *tr);
+
//remove trace starting with address n
void removeTrace(uint64_t n);
From ashukla at cs.uiuc.edu Thu Jul 10 14:01:04 2003
From: ashukla at cs.uiuc.edu (Anand Shukla)
Date: Thu Jul 10 14:01:04 2003
Subject: [llvm-commits] CVS: llvm/include/llvm/Reoptimizer/MemoryManager.h
Message-ID: <200307101900.OAA06943@niobe.cs.uiuc.edu>
Changes in directory llvm/include/llvm/Reoptimizer:
MemoryManager.h updated: 1.2 -> 1.3
---
Log message:
Some cleanup, and some additions for new trace framework
---
Diffs of the changes:
Index: llvm/include/llvm/Reoptimizer/MemoryManager.h
diff -u llvm/include/llvm/Reoptimizer/MemoryManager.h:1.2 llvm/include/llvm/Reoptimizer/MemoryManager.h:1.3
--- llvm/include/llvm/Reoptimizer/MemoryManager.h:1.2 Tue Sep 17 12:19:00 2002
+++ llvm/include/llvm/Reoptimizer/MemoryManager.h Thu Jul 10 14:00:39 2003
@@ -34,13 +34,21 @@
class MemoryManager{
private:
uint64_t memStart, memEnd;
+ unsigned int memorySize;
std::list > freeMemList;
public:
//Memory management
+ //Ctor: using default memory manager function as space
MemoryManager(); //Constructor
+ //make sure memsize is < number of instructions in dumyFunc
+ MemoryManager(unsigned int memSize); //Constructor
- int getMemSize(){ return globalMemSize; }
+ //Ctor: Using user provided function for space. The size of memory
+ //is assumed as memSize. Must ensure the provided function >= memSize bytes
+ MemoryManager(int (*dfunc)(int), unsigned int memSize);
+
+ int getMemSize(){ return memorySize; }
uint64_t getMemory(int sz); //return a pointer to memory of size sz
void freeTraceMemory(uint64_t toRemove, int size);//size is no if instructions
};
From ashukla at cs.uiuc.edu Thu Jul 10 14:01:07 2003
From: ashukla at cs.uiuc.edu (Anand Shukla)
Date: Thu Jul 10 14:01:07 2003
Subject: [llvm-commits] CVS: llvm/include/llvm/Reoptimizer/InstrUtils.h
Message-ID: <200307101900.OAA06933@niobe.cs.uiuc.edu>
Changes in directory llvm/include/llvm/Reoptimizer:
InstrUtils.h updated: 1.5 -> 1.6
---
Log message:
Some cleanup, and some additions for new trace framework
---
Diffs of the changes:
Index: llvm/include/llvm/Reoptimizer/InstrUtils.h
diff -u llvm/include/llvm/Reoptimizer/InstrUtils.h:1.5 llvm/include/llvm/Reoptimizer/InstrUtils.h:1.6
--- llvm/include/llvm/Reoptimizer/InstrUtils.h:1.5 Sat May 31 21:31:10 2003
+++ llvm/include/llvm/Reoptimizer/InstrUtils.h Thu Jul 10 14:00:35 2003
@@ -43,4 +43,7 @@
unsigned int getInvertedBranch(unsigned int br1);
+bool isIndirectCall(unsigned instr);
+
+bool isReturn(unsigned int inst);
#endif
From ashukla at cs.uiuc.edu Thu Jul 10 14:01:11 2003
From: ashukla at cs.uiuc.edu (Anand Shukla)
Date: Thu Jul 10 14:01:11 2003
Subject: [llvm-commits] CVS: llvm/lib/Reoptimizer/TraceCache/Makefile
Message-ID: <200307101900.OAA06916@niobe.cs.uiuc.edu>
Changes in directory llvm/lib/Reoptimizer/TraceCache:
Makefile updated: 1.2 -> 1.3
---
Log message:
Modified makefile to allow multiple libraries
---
Diffs of the changes:
Index: llvm/lib/Reoptimizer/TraceCache/Makefile
diff -u llvm/lib/Reoptimizer/TraceCache/Makefile:1.2 llvm/lib/Reoptimizer/TraceCache/Makefile:1.3
--- llvm/lib/Reoptimizer/TraceCache/Makefile:1.2 Wed Apr 30 16:27:38 2003
+++ llvm/lib/Reoptimizer/TraceCache/Makefile Thu Jul 10 13:59:51 2003
@@ -1,5 +1,9 @@
LEVEL = ../../..
+ifdef GET_EXTENSIVE
+LIBRARYNAME = tracecache2
+else
LIBRARYNAME = tracecache
+endif
BUILD_ARCHIVE = 1
include $(LEVEL)/Makefile.common
From ashukla at cs.uiuc.edu Thu Jul 10 14:02:01 2003
From: ashukla at cs.uiuc.edu (Anand Shukla)
Date: Thu Jul 10 14:02:01 2003
Subject: [llvm-commits] CVS: llvm/include/llvm/Reoptimizer/VirtualMem.h
Message-ID: <200307101901.OAA06994@niobe.cs.uiuc.edu>
Changes in directory llvm/include/llvm/Reoptimizer:
VirtualMem.h updated: 1.8 -> 1.9
---
Log message:
Some cleanup, and some additions for new trace framework
---
Diffs of the changes:
Index: llvm/include/llvm/Reoptimizer/VirtualMem.h
diff -u llvm/include/llvm/Reoptimizer/VirtualMem.h:1.8 llvm/include/llvm/Reoptimizer/VirtualMem.h:1.9
--- llvm/include/llvm/Reoptimizer/VirtualMem.h:1.8 Mon Jun 30 16:58:32 2003
+++ llvm/include/llvm/Reoptimizer/VirtualMem.h Thu Jul 10 14:01:36 2003
@@ -20,7 +20,7 @@
#include "llvm/Reoptimizer/GetTraceTime.h"
class TraceCache;
-class TraceCache2;
+//class TraceCache2;
class VirtualMem {
int fp; //file pointer
@@ -37,8 +37,8 @@
unsigned int readInstrFrmVm(uint64_t frm);
unsigned int readInstrFrmVm(uint64_t frm, TraceCache *tr);
- unsigned int readInstrFrmVm(uint64_t frm, TraceCache2 *tr);
- unsigned int readInstrFrmVm(uint64_t frm, TraceCache *tr, TraceCache2 *tr2);
+ // unsigned int readInstrFrmVm(uint64_t frm, TraceCache2 *tr);
+ unsigned int readInstrFrmVm(uint64_t frm, TraceCache *tr, TraceCache *tr2);
void writeInstToVM(uint64_t dest, unsigned newInstr);
From ashukla at cs.uiuc.edu Thu Jul 10 14:02:04 2003
From: ashukla at cs.uiuc.edu (Anand Shukla)
Date: Thu Jul 10 14:02:04 2003
Subject: [llvm-commits] CVS: llvm/include/llvm/Reoptimizer/Mapping/LLVMinfo.h
Message-ID: <200307101901.OAA06982@niobe.cs.uiuc.edu>
Changes in directory llvm/include/llvm/Reoptimizer/Mapping:
LLVMinfo.h updated: 1.6 -> 1.7
---
Log message:
Some cleanup, and some additions for new trace framework
---
Diffs of the changes:
Index: llvm/include/llvm/Reoptimizer/Mapping/LLVMinfo.h
diff -u llvm/include/llvm/Reoptimizer/Mapping/LLVMinfo.h:1.6 llvm/include/llvm/Reoptimizer/Mapping/LLVMinfo.h:1.7
--- llvm/include/llvm/Reoptimizer/Mapping/LLVMinfo.h:1.6 Sat May 31 21:30:03 2003
+++ llvm/include/llvm/Reoptimizer/Mapping/LLVMinfo.h Thu Jul 10 14:01:26 2003
@@ -1,10 +1,13 @@
#include "llvm/Instruction.h"
#include "Support/DataTypes.h"
-//vector getBasicBlockInfo(int FunctionNo, int
-//BasicBlockNo);
-//vector getLLVMInstrInfo(int FunctionNo, int BasicBlockNo,
-// int LLVMInstrNo);
+class BasicBlock;
+class Module;
+class Function;
+
std::vector getLLVMInstrPositionInfo(Instruction *LI);
std::vector getLLVMInstrInfo(Instruction *LI);
std::pair getBasicBlockInfo(BasicBlock *BB);
+bool getReverseBBMap(uint64_t addr, Module *M, BasicBlock* &bb);
+Function *getRevFunction(Module *M, uint64_t addr);
+bool isInlinable(Function *F);
From ashukla at cs.uiuc.edu Thu Jul 10 14:02:09 2003
From: ashukla at cs.uiuc.edu (Anand Shukla)
Date: Thu Jul 10 14:02:09 2003
Subject: [llvm-commits] CVS: llvm/include/llvm/Reoptimizer/TraceCache2.h
Message-ID: <200307101901.OAA06971@niobe.cs.uiuc.edu>
Changes in directory llvm/include/llvm/Reoptimizer:
TraceCache2.h (r1.2) removed
---
Log message:
Some cleanup, and some additions for new trace framework
---
Diffs of the changes:
From vadve at cs.uiuc.edu Thu Jul 10 14:05:04 2003
From: vadve at cs.uiuc.edu (Vikram Adve)
Date: Thu Jul 10 14:05:04 2003
Subject: [llvm-commits] CVS: llvm/test/Programs/MultiSource/Olden-perimeter/Makefile
Message-ID: <200307101904.OAA10401@psmith.cs.uiuc.edu>
Changes in directory llvm/test/Programs/MultiSource/Olden-perimeter:
Makefile updated: 1.6 -> 1.7
---
Log message:
Use smaller input -- this code takes way too long.
---
Diffs of the changes:
Index: llvm/test/Programs/MultiSource/Olden-perimeter/Makefile
diff -u llvm/test/Programs/MultiSource/Olden-perimeter/Makefile:1.6 llvm/test/Programs/MultiSource/Olden-perimeter/Makefile:1.7
--- llvm/test/Programs/MultiSource/Olden-perimeter/Makefile:1.6 Mon Jun 16 10:51:27 2003
+++ llvm/test/Programs/MultiSource/Olden-perimeter/Makefile Thu Jul 10 14:04:12 2003
@@ -3,6 +3,6 @@
PROG = perimeter
CPPFLAGS = -DTORONTO
LDFLAGS =
-RUN_OPTIONS = 11
+RUN_OPTIONS = 4
include ../Makefile.multisrc
From vadve at cs.uiuc.edu Thu Jul 10 14:09:01 2003
From: vadve at cs.uiuc.edu (Vikram Adve)
Date: Thu Jul 10 14:09:01 2003
Subject: [llvm-commits] CVS: llvm/test/Programs/SingleSource/UnitTests/2003-05-26-Shorts.c
Message-ID: <200307101908.OAA10430@psmith.cs.uiuc.edu>
Changes in directory llvm/test/Programs/SingleSource/UnitTests:
2003-05-26-Shorts.c updated: 1.3 -> 1.4
---
Log message:
Add arithmetic with small signed and unsigned values.
Lots of errors are masked when simply passing shorts around as arguments.
---
Diffs of the changes:
Index: llvm/test/Programs/SingleSource/UnitTests/2003-05-26-Shorts.c
diff -u llvm/test/Programs/SingleSource/UnitTests/2003-05-26-Shorts.c:1.3 llvm/test/Programs/SingleSource/UnitTests/2003-05-26-Shorts.c:1.4
--- llvm/test/Programs/SingleSource/UnitTests/2003-05-26-Shorts.c:1.3 Tue Jun 3 13:59:34 2003
+++ llvm/test/Programs/SingleSource/UnitTests/2003-05-26-Shorts.c Thu Jul 10 14:08:43 2003
@@ -54,5 +54,46 @@
printf(" b* b = %d (0x%x)\t\t\tL/b = %lld (0x%llx)\n\n",
(signed char) b*b, (signed char) b*b, L/b, L/b);
+
+ /* Do some arithmetic with the small signed and unsigned values */
+
+ unsigned int uiprod = (ui+1u) * (ui+1u) /* ui*ui unless overflow! */
+ - (unsigned int ) (ui << 2) - (unsigned int ) 1u;
+ unsigned short usprod = (us+1u) * (us+1u) /* us*us unless overflow! */
+ - (unsigned short) (us << 2) - (unsigned short) 1u;
+ unsigned char ubprod = (ub+1u) * (ub+1u) /* ub*ub unless overflow! */
+ - (unsigned char ) (ub << 2) - (unsigned char ) 1u;
+
+ int iprod = (i+1) * (i+1) - (int ) (i << 2) - (int ) 1;
+ short sprod = (s+1) * (s+1) - (short) (s << 2) - (short) 1;
+ signed char bprod = (b+1) * (b+1) - (char) (b << 2) - (char) 1;
+
+ unsigned int uidiv = (unsigned int ) (UL/ui) * (unsigned int ) (UL/ui);
+ unsigned short usdiv = (unsigned short) (UL/us) * (unsigned short) (UL/us);
+ unsigned char ubdiv = (unsigned char ) (UL/ub) * (unsigned char ) (UL/ub);
+
+ int idiv = ( int) ( L/ i) * ( int) ( L/ i);
+ short sdiv = ( short) ( L/ s) * ( short) ( L/ s);
+ signed char bdiv = ( signed char ) ( L/ b) * ( signed char ) ( L/ b);
+
+ printf("\n");
+ printf("uiprod = %u (0x%x)\t uidiv = %u (0x%x)\n\n",
+ uiprod, uiprod, uidiv, uidiv);
+
+ printf("usprod = %u (0x%x)\t usdiv = %u (0x%x)\n\n",
+ usprod, usprod, usdiv, usdiv);
+
+ printf("ubprod = %u (0x%x)\t ubdiv = %u (0x%x)\n\n",
+ ubprod, ubprod, ubdiv, ubdiv);
+
+ printf(" iprod = %u (0x%x)\t idiv = %u (0x%x)\n\n",
+ iprod, iprod, idiv, idiv);
+
+ printf(" sprod = %u (0x%x)\t sdiv = %u (0x%x)\n\n",
+ sprod, sprod, sdiv, sdiv);
+
+ printf(" bprod = %u (0x%x)\t bdiv = %u (0x%x)\n\n",
+ bprod, bprod, bdiv, bdiv);
+
return 0;
}
From vadve at cs.uiuc.edu Thu Jul 10 14:21:02 2003
From: vadve at cs.uiuc.edu (Vikram Adve)
Date: Thu Jul 10 14:21:02 2003
Subject: [llvm-commits] CVS: llvm/test/Programs/SingleSource/UnitTests/2003-07-06-IntOverflow.c 2003-07-09-LoadShorts.c 2003-07-09-SignedArgs.c 2003-07-10-SignConversions.c
Message-ID: <200307101920.OAA10504@psmith.cs.uiuc.edu>
Changes in directory llvm/test/Programs/SingleSource/UnitTests:
2003-07-06-IntOverflow.c added (r1.1)
2003-07-09-LoadShorts.c added (r1.1)
2003-07-09-SignedArgs.c added (r1.1)
2003-07-10-SignConversions.c added (r1.1)
---
Log message:
Four new unit tests for different situations with integer values:
(1) SignConversions: Basic signed/unsigned conversions.
(2) IntOverflow: Operations after one that overflows
(3) LoadShorts: Load/store operations on short values
(4) SignedArgs: Passing short signed values as arguments to normal
and varargs functions
---
Diffs of the changes:
Index: llvm/test/Programs/SingleSource/UnitTests/2003-07-06-IntOverflow.c
diff -c /dev/null llvm/test/Programs/SingleSource/UnitTests/2003-07-06-IntOverflow.c:1.1
*** /dev/null Thu Jul 10 14:20:03 2003
--- llvm/test/Programs/SingleSource/UnitTests/2003-07-06-IntOverflow.c Thu Jul 10 14:19:53 2003
***************
*** 0 ****
--- 1,52 ----
+ /*
+ * This test stresses masking and sign-extension after int operations
+ * that cause overflow, producing bogus high-order bits.
+ * The basic overflow situation (x * x + y * y, for x = y = 1 << 21)
+ * actually happens in Olden-perimeter, in the function CheckOutside.
+ *
+ * Several things have to happen correctly:
+ * -- correct constant folding if it is done at compile-time
+ * -- correct sign-extensions during native code generation for -, * and /.
+ * -- correct handling of high bits during native code generation for
+ * a sequence of operations involving -, * and /.
+ */
+ #include
+
+ void compareOvf(int x, int y)
+ {
+ int sum = x * x + y * y;
+ if (sum < (1 << 22))
+ printf("compare after overflow is TRUE\n");
+ else
+ printf("compare after overflow is FALSE\n");
+ }
+
+ void divideOvf(int x, int y)
+ {
+ int sum = x * x + y * y;
+ int rem = (1 << 31) / sum;
+ printf("divide after overflow = %d (0x%lx)\n", rem, rem);
+ }
+
+ void divideNeg(int x, int y)
+ {
+ int sum = x * x - y * y;
+ int rem = sum / (1 << 18);
+ printf("divide negative value by power-of-2 = %d (0x%lx)\n", rem, rem);
+ }
+
+ void subtractOvf(int x, int y)
+ {
+ int sum = x * x + y * y;
+ int rem = (1u << 31) - sum;
+ printf("subtract after overflow = %d (0x%lx)\n", rem, rem);
+ }
+
+ int main()
+ {
+ int b21 = 1 << 21;
+ compareOvf(b21, b21);
+ divideOvf(b21 + 1, b21 + 2);
+ divideNeg(b21 + 1, b21 + 2); /* arg1 must be < arg2 */
+ subtractOvf(b21 + 1, b21 + 2);
+ }
Index: llvm/test/Programs/SingleSource/UnitTests/2003-07-09-LoadShorts.c
diff -c /dev/null llvm/test/Programs/SingleSource/UnitTests/2003-07-09-LoadShorts.c:1.1
*** /dev/null Thu Jul 10 14:20:03 2003
--- llvm/test/Programs/SingleSource/UnitTests/2003-07-09-LoadShorts.c Thu Jul 10 14:19:53 2003
***************
*** 0 ****
--- 1,75 ----
+ /*
+ * This test is similar to 2003-05-26-Shorts.c except that it stores all
+ * short values in a structure to test load and store operations on those
+ * values. It stresses masking and sign-extension for such load/stores.
+ */
+ #include
+ #include
+
+ typedef struct ShortsSet_struct {
+ unsigned int ui;
+ int i;
+ unsigned short us;
+ short s;
+ unsigned char ub;
+ signed char b;
+ } ShortsSet;
+
+
+ /* Move the value here to prevent constant folding */
+ unsigned long long getL()
+ {
+ return 0xafafafafc5c5b8a3ull;
+ }
+
+ int
+ main(int argc, char** argv)
+ {
+ unsigned long long UL = getL(); /* 0xafafafafc5c5b8a3 */
+ long long L = (long long) UL;
+
+ ShortsSet* S = (ShortsSet*) malloc(sizeof(ShortsSet));
+ S->ui = (unsigned int) UL; /* 0xc5c5b8a3 = 3318069411 */
+ S-> i = (int) UL; /* 0xc5c5b8a3 = -976897885 */
+
+ S->us = (unsigned short) UL; /* 0xb8a3 = 47267 */
+ S-> s = (short) UL; /* 0xb8a3 = -18269 */
+
+ S->ub = (unsigned char) UL; /* 0xa3 = 163 */
+ S-> b = ( signed char) UL; /* 0xa3 = -93 */
+
+ printf(" ui = %u (0x%x)\t\tUL-ui = %lld (0x%llx)\n",
+ S->ui, S->ui, UL - S->ui, UL - S->ui);
+ printf("ui*ui = %u (0x%x)\t UL/ui = %lld (0x%llx)\n\n",
+ (unsigned int) S->ui * S->ui, (unsigned int) S->ui * S->ui,
+ UL/S->ui, UL/S->ui);
+
+ printf(" i = %d (0x%x)\tL-i = %lld (0x%llx)\n",
+ S->i, S->i, L - S->i, L - S->i);
+ printf(" i* i = %d (0x%x)\tL/ i = %lld (0x%llx)\n\n",
+ (int) S->i * S->i, (int) S->i * S->i, L/S->i, L/S->i);
+
+ printf("us = %u (0x%x)\t\tUL-us = %lld (0x%llx)\n",
+ S->us, S->us, UL - S->us, UL - S->us);
+ printf("us*us = %u (0x%x)\t UL/us = %lld (0x%llx)\n\n",
+ (unsigned short) S->us * S->us, (unsigned short) S->us * S->us,
+ UL/S->us, UL/S->us);
+
+ printf(" s = %d (0x%x)\tL-s = %lld (0x%llx)\n",
+ S->s, S->s, L - S->s, L - S->s);
+ printf(" s* s = %d (0x%x)\tL/ s = %lld (0x%llx)\n\n",
+ (short) S->s * S->s, (short) S->s * S->s, L/S->s, L/S->s);
+
+ printf("ub = %u (0x%x)\t\tUL-ub = %lld (0x%llx)\n",
+ S->ub, S->ub, UL - S->ub, UL - S->ub);
+ printf("ub*ub = %u (0x%x)\t\tUL/ub = %lld (0x%llx)\n\n",
+ (unsigned char) S->ub * S->ub, (unsigned char) S->ub * S->ub,
+ UL/S->ub, UL/S->ub);
+
+ printf(" b = %d (0x%x)\t\tL-b = %lld (0x%llx)\n",
+ S->b, S->b, L - S->b, L - S->b);
+ printf(" b* b = %d (0x%x)\t\t\tL/b = %lld (0x%llx)\n\n",
+ (signed char) S->b * S->b, (signed char) S->b * S->b, L/S->b, L/S->b);
+
+ return 0;
+ }
Index: llvm/test/Programs/SingleSource/UnitTests/2003-07-09-SignedArgs.c
diff -c /dev/null llvm/test/Programs/SingleSource/UnitTests/2003-07-09-SignedArgs.c:1.1
*** /dev/null Thu Jul 10 14:20:03 2003
--- llvm/test/Programs/SingleSource/UnitTests/2003-07-09-SignedArgs.c Thu Jul 10 14:19:53 2003
***************
*** 0 ****
--- 1,60 ----
+ /*
+ * Test sign extensions on short signed values passed as arguments
+ * to function calls. Include arithmetic to produce extra high bits
+ * from operations that overflow. Lots of codes do this!
+ */
+ #include
+ #include
+ #include
+
+ short getShort(char c, char c2, char c3, short s, short s2, int i);
+ int getUnknown(char c, ...);
+
+ int passShort(char c, short s)
+ {
+ char c2 = s + c;
+ char c3 = s - c;
+ short s2 = s * c;
+ int i = s * s * c * c;
+ short s3 = getShort(c, c2, c3, s, s2, i); /* args shd be sign-extended */
+ return getUnknown(c, c2, c3, s, s2, s3, i); /* args shd be promoted to int */
+ }
+
+ int main()
+ {
+ printf("%d\n", passShort(0x80, 0xf0f4));
+ }
+
+ short getShort(char c, char c2, char c3, short s, short s2, int i)
+ {
+ int bc = c == (char) -128;
+ int bc2 = c2 == (char) 116;
+ int bc3 = c3 == (char) 116;
+ int bs = s == (short) -3852;
+ int bs2 = s2 == (short) -31232;
+ int bi = i == (int) -1708916736;
+
+ printf("getShort():\t%d %d %d %d %d %d\n", bc, bc2, bc3, bs, bs2, bi);
+ printf("getShort():\t%d %d %d %d %d %d\n", c, c2, c3, s, s2, i);
+ return (c + c2 + c3 + s + s2) + (short) i;
+ }
+
+ int getUnknown(char c, ...)
+ {
+ char c2, c3;
+ short s, s2, s3;
+ int i;
+ va_list ap;
+
+ va_start(ap, c);
+ c2 = (char) va_arg(ap, int);
+ c3 = (char) va_arg(ap, int);
+ s = (short) va_arg(ap, int);
+ s2 = (short) va_arg(ap, int);
+ s3 = (short) va_arg(ap, int);
+ i = va_arg(ap, int);
+ va_end(ap);
+
+ printf("getUnknown():\t%d %d %d %d %d %d %d\n", c, c2, c3, s, s2, s3, i);
+ return c + c2 + c3 + s + s2 + s3 + i;
+ }
Index: llvm/test/Programs/SingleSource/UnitTests/2003-07-10-SignConversions.c
diff -c /dev/null llvm/test/Programs/SingleSource/UnitTests/2003-07-10-SignConversions.c:1.1
*** /dev/null Thu Jul 10 14:20:03 2003
--- llvm/test/Programs/SingleSource/UnitTests/2003-07-10-SignConversions.c Thu Jul 10 14:19:53 2003
***************
*** 0 ****
--- 1,31 ----
+ /*
+ * Test basic conversions between short signed and unsigned values
+ * with no function calls and no arithmetic.
+ */
+ #include
+
+ unsigned char getUC() { return 0x80; }
+
+ char getC() { return 0x80; }
+
+ int main()
+ {
+ char C80 = getC();
+ unsigned char UC80 = getUC();
+
+ /* source is smaller than dest: both decide */
+ unsigned short us = (unsigned short) C80; /* sign-ext then zero-ext */
+ unsigned short us2 = (unsigned short) UC80; /* zero-ext only: NOP! */
+ short s = ( short) C80; /* sign-ext */
+ short s2 = ( short) UC80; /* zero-extend only : NOP! */
+ printf("%d %d --> unsigned: us = %d, us2 = %d\n", C80, UC80, us, us2);
+ printf("%d %d --> signed: s = %d, s2 = %d\n", C80, UC80, s, s2);
+
+ /* source is same size or larger than dest: dest decides */
+ unsigned char uc = (unsigned char ) C80; /* zero-ext */
+ unsigned char uc2 = (unsigned char ) UC80; /* NOP */
+ char c = ( char ) C80; /* NOP */
+ char c2 = ( char ) UC80; /* sign-extend */
+ printf("%d %d --> unsigned: uc = %d, uc2 = %d\n", C80, UC80, uc, uc2);
+ printf("%d %d --> signed: c = %d, c2 = %d\n", C80, UC80, c, c2);
+ }
From vadve at cs.uiuc.edu Thu Jul 10 14:24:04 2003
From: vadve at cs.uiuc.edu (Vikram Adve)
Date: Thu Jul 10 14:24:04 2003
Subject: [llvm-commits] CVS: llvm/test/Programs/SingleSource/UnitTests/2003-05-31-CastToBool.c
Message-ID: <200307101923.OAA10533@psmith.cs.uiuc.edu>
Changes in directory llvm/test/Programs/SingleSource/UnitTests:
2003-05-31-CastToBool.c updated: 1.2 -> 1.3
---
Log message:
Fix parentheses for casts to _Bool.
---
Diffs of the changes:
Index: llvm/test/Programs/SingleSource/UnitTests/2003-05-31-CastToBool.c
diff -u llvm/test/Programs/SingleSource/UnitTests/2003-05-31-CastToBool.c:1.2 llvm/test/Programs/SingleSource/UnitTests/2003-05-31-CastToBool.c:1.3
--- llvm/test/Programs/SingleSource/UnitTests/2003-05-31-CastToBool.c:1.2 Tue Jul 8 10:41:48 2003
+++ llvm/test/Programs/SingleSource/UnitTests/2003-05-31-CastToBool.c Thu Jul 10 14:23:08 2003
@@ -2,11 +2,11 @@
void testCastOps(int y) {
printf("y = %d, (y == 2 || y == 0) == %d\n",
- y, ((_Bool) y == 2) || ((_Bool) y == 0));
+ y, ((_Bool) (y == 2)) || ((_Bool) (y == 0)));
printf("y = %d, (y > 2 || y < 5) == %d\n",
- y, ((_Bool) y < 2) && ((_Bool) y > -10));
+ y, ((_Bool) (y < 2)) && ((_Bool) (y > -10)));
printf("y = %d, (y ^ 2 ^ ~y) == %d\n",
- y, ((_Bool) y ^ 2 ^ ~5));
+ y, (_Bool) (y ^ 2 ^ ~5));
}
void testBool(_Bool X) {
From vadve at cs.uiuc.edu Thu Jul 10 14:26:01 2003
From: vadve at cs.uiuc.edu (Vikram Adve)
Date: Thu Jul 10 14:26:01 2003
Subject: [llvm-commits] CVS: llvm/Makefile.common
Message-ID: <200307101925.OAA10558@psmith.cs.uiuc.edu>
Changes in directory llvm:
Makefile.common updated: 1.98 -> 1.99
---
Log message:
Add phony target "bytecode" to ensure that it works in recursive makes.
---
Diffs of the changes:
Index: llvm/Makefile.common
diff -u llvm/Makefile.common:1.98 llvm/Makefile.common:1.99
--- llvm/Makefile.common:1.98 Thu Jul 10 11:52:41 2003
+++ llvm/Makefile.common Thu Jul 10 14:25:29 2003
@@ -149,6 +149,9 @@
# Default rule for test. It ensures everything has a test rule
test::
+# Default rule for building only bytecode.
+bytecode::
+
# Print out the directories used for building
prdirs::
echo "Home Offset : " $(HOME_OBJ_ROOT);
@@ -400,7 +403,7 @@
#---------------------------------------------------------
ifdef DIRS
-all install clean test ::
+all install clean test bytecode ::
$(VERB) for dir in ${DIRS}; do \
(cd $$dir; $(MAKE) $@) || exit 1; \
done
@@ -408,18 +411,19 @@
# Handle PARALLEL_DIRS
ifdef PARALLEL_DIRS
-all :: $(addsuffix /.makeall , $(PARALLEL_DIRS))
-install :: $(addsuffix /.makeinstall, $(PARALLEL_DIRS))
-clean :: $(addsuffix /.makeclean , $(PARALLEL_DIRS))
-test :: $(addsuffix /.maketest , $(PARALLEL_DIRS))
+all :: $(addsuffix /.makeall , $(PARALLEL_DIRS))
+install :: $(addsuffix /.makeinstall , $(PARALLEL_DIRS))
+clean :: $(addsuffix /.makeclean , $(PARALLEL_DIRS))
+test :: $(addsuffix /.maketest , $(PARALLEL_DIRS))
+bytecode :: $(addsuffix /.makebytecode, $(PARALLEL_DIRS))
-%/.makeall %/.makeinstall %/.makeclean %/.maketest:
+%/.makeall %/.makeinstall %/.makeclean %/.maketest %/.makebytecode:
$(VERB) cd $(@D); $(MAKE) $(subst $(@D)/.make,,$@)
endif
# Handle directories that may or may not exist
ifdef OPTIONAL_DIRS
-all install clean test ::
+all install clean test bytecode ::
$(VERB) for dir in ${OPTIONAL_DIRS}; do \
if [ -d $$dir ]; \
then\
From vadve at cs.uiuc.edu Thu Jul 10 14:30:01 2003
From: vadve at cs.uiuc.edu (Vikram Adve)
Date: Thu Jul 10 14:30:01 2003
Subject: [llvm-commits] CVS: llvm/test/Programs/Makefile.programs
Message-ID: <200307101929.OAA10580@psmith.cs.uiuc.edu>
Changes in directory llvm/test/Programs:
Makefile.programs updated: 1.66 -> 1.67
---
Log message:
Make bytecode target work with recursive makes (see Makefile.common).
Also, add an optional "remote" version of the llc command; this is
commented out for now for manual use, but will be made first-class later.
---
Diffs of the changes:
Index: llvm/test/Programs/Makefile.programs
diff -u llvm/test/Programs/Makefile.programs:1.66 llvm/test/Programs/Makefile.programs:1.67
--- llvm/test/Programs/Makefile.programs:1.66 Tue Jul 8 18:18:00 2003
+++ llvm/test/Programs/Makefile.programs Thu Jul 10 14:29:01 2003
@@ -241,6 +241,10 @@
Output/%.llc.s: Output/%.llvm.bc $(LLC)
-$(LLC) $(LLCFLAGS) -f $< -o $@
+## Alternative command to run llc remotely on another machine:
+## This is very useful when debugging:
+## -rsh psmith "cd `/bin/pwd`; llc $(LLCFLAGS) -f $< -o $@"
+
# Assemble (and link) an LLVM-linked program using the system assembler...
#
$(PROGRAMS_TO_TEST:%=Output/%.llc): \
@@ -328,6 +332,10 @@
$(PROGRAMS_TO_TEST:%=Output/%.exe-cbe): \
Output/%.exe-cbe: Output/%.diff-cbe
-cp $< $@
+
+# Pseudo target to build just the bytecode file.
+bytecode:: $(PROGRAMS_TO_TEST:%=Output/%.llvm.bc)
+
endif
# Rules to support the USE_PRECOMPILED_BYTECODE setting If set, submakefiles
@@ -358,10 +366,6 @@
Output/%.LOC.txt: $(SRCDIR)/%.LOC.txt Output/.dir
cp $< $@
endif
-
-# Pseudo target to build just the bytecode file.
-bytecode: $(PROGRAMS_TO_TEST:%=Output/%.llvm.bc)
-
# Support for the TEST= option... when TEST= is specified on the command line,
# the default target is the test target. Here we dispatch to a specific set of
From vadve at cs.uiuc.edu Thu Jul 10 14:32:01 2003
From: vadve at cs.uiuc.edu (Vikram Adve)
Date: Thu Jul 10 14:32:01 2003
Subject: [llvm-commits] CVS: llvm/test/Regression/LLC/2003-07-08-BadCastToBool.ll
Message-ID: <200307101931.OAA10613@psmith.cs.uiuc.edu>
Changes in directory llvm/test/Regression/LLC:
2003-07-08-BadCastToBool.ll updated: 1.1 -> 1.2
---
Log message:
Just documentation.
---
Diffs of the changes:
Index: llvm/test/Regression/LLC/2003-07-08-BadCastToBool.ll
diff -u llvm/test/Regression/LLC/2003-07-08-BadCastToBool.ll:1.1 llvm/test/Regression/LLC/2003-07-08-BadCastToBool.ll:1.2
--- llvm/test/Regression/LLC/2003-07-08-BadCastToBool.ll:1.1 Tue Jul 8 10:39:02 2003
+++ llvm/test/Regression/LLC/2003-07-08-BadCastToBool.ll Thu Jul 10 14:31:26 2003
@@ -1,3 +1,26 @@
+;; Date: Jul 8, 2003.
+;; From: test/Programs/MultiSource/Olden-perimeter
+;; Function: int %adj(uint %d.1, uint %ct.1)
+;;
+;; Errors: (1) cast-int-to-bool was being treated as a NOP (i.e., the int
+;; register was treated as effectively true if non-zero).
+;; This cannot be used for later boolean operations.
+;; (2) (A or NOT(B)) was being folded into A orn B, which is ok
+;; for bitwise operations but not booleans! For booleans,
+;; the result has to be compared with 0.
+;;
+;; LLC Output for the basic block (LLVM assembly is shown below):
+;;
+;; .L_adj_7_LL_4:
+;; sethi 0, %i0
+;; subcc %i1, 2, %g0
+;; move %icc, 1, %i0
+;; orn %i0, %i1, %i0
+;; ba .L_adj_7_LL_5
+;; nop
+;;
+
+
target endian = big
target pointersize = 64
From vadve at cs.uiuc.edu Thu Jul 10 14:33:01 2003
From: vadve at cs.uiuc.edu (Vikram Adve)
Date: Thu Jul 10 14:33:01 2003
Subject: [llvm-commits] CVS: llvm/test/Regression/LLC/2003-07-07-BadLongConst.ll
Message-ID: <200307101932.OAA10635@psmith.cs.uiuc.edu>
Changes in directory llvm/test/Regression/LLC:
2003-07-07-BadLongConst.ll added (r1.1)
---
Log message:
(null)
---
Diffs of the changes:
Index: llvm/test/Regression/LLC/2003-07-07-BadLongConst.ll
diff -c /dev/null llvm/test/Regression/LLC/2003-07-07-BadLongConst.ll:1.1
*** /dev/null Thu Jul 10 14:32:48 2003
--- llvm/test/Regression/LLC/2003-07-07-BadLongConst.ll Thu Jul 10 14:32:38 2003
***************
*** 0 ****
--- 1,22 ----
+ target endian = big
+ target pointersize = 64
+
+ %.str_1 = internal constant [42 x sbyte] c" ui = %u (0x%x)\09\09UL-ui = %lld (0x%llx)\0A\00"
+
+ implementation ; Functions:
+
+ declare int %printf(sbyte*, ...)
+
+ internal ulong %getL() {
+ entry: ; No predecessors!
+ ret ulong 12659530247033960611
+ }
+
+ int %main(int %argc.1, sbyte** %argv.1) {
+ entry: ; No predecessors!
+ %tmp.11 = call ulong %getL( )
+ %tmp.5 = cast ulong %tmp.11 to uint
+ %tmp.23 = and ulong %tmp.11, 18446744069414584320
+ %tmp.16 = call int (sbyte*, ...)* %printf( sbyte* getelementptr ([42 x sbyte]* %.str_1, long 0, long 0), uint %tmp.5, uint %tmp.5, ulong %tmp.23, ulong %tmp.23 )
+ ret int 0
+ }
From vadve at cs.uiuc.edu Thu Jul 10 14:43:01 2003
From: vadve at cs.uiuc.edu (Vikram Adve)
Date: Thu Jul 10 14:43:01 2003
Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/SparcRegClassInfo.cpp SparcRegInfo.cpp EmitAssembly.cpp
Message-ID: <200307101942.OAA10679@psmith.cs.uiuc.edu>
Changes in directory llvm/lib/Target/Sparc:
SparcRegClassInfo.cpp updated: 1.23 -> 1.24
SparcRegInfo.cpp updated: 1.101 -> 1.102
EmitAssembly.cpp updated: 1.80 -> 1.81
---
Log message:
Several fixes to handling of int CC register:
(1) An int CC live range must be spilled if there are any interferences,
even if no other "neighbour" in the interf. graph has been allocated
that reg. yet. This is actually true of any class with only one reg!
(2) SparcIntCCRegClass::colorIGNode sets the color even if the LR must
be spilled so that the machine-independent spill code doesn't have to
make the machine-dependent decision of which CC name to use based on
operand type: %xcc or %icc. (These are two halves of the same register.)
(3) LR->isMarkedForSpill() is no longer the same as LR->hasColor().
These should never have been the same, and this is necessary now for #2.
(4) All RDCCR and WRCCR instructions are directly generated with the
phony number for %ccr so that EmitAssembly/EmitBinary doesn't have to
deal with this.
---
Diffs of the changes:
Index: llvm/lib/Target/Sparc/SparcRegClassInfo.cpp
diff -u llvm/lib/Target/Sparc/SparcRegClassInfo.cpp:1.23 llvm/lib/Target/Sparc/SparcRegClassInfo.cpp:1.24
--- llvm/lib/Target/Sparc/SparcRegClassInfo.cpp:1.23 Sun Jul 6 17:50:31 2003
+++ llvm/lib/Target/Sparc/SparcRegClassInfo.cpp Thu Jul 10 14:42:11 2003
@@ -117,7 +117,8 @@
//
// Algorithm:
//
-// If the single int CC register is used (either as icc or xcc)
+// If (node has any interferences)
+// /* all interference operations can use only one register! */
// mark the LR for spilling
// else {
// if (the LR is a 64-bit comparison) use %xcc
@@ -130,30 +131,33 @@
void SparcIntCCRegClass::colorIGNode(IGNode *Node,
std::vector &IsColorUsedArr) const
{
- if (IsColorUsedArr[xcc] && IsColorUsedArr[icc])
+ if (Node->getNumOfNeighbors() > 0)
Node->getParentLR()->markForSpill();
- else {
- // Choose whether to use %xcc or %icc based on type of value compared
- const LiveRange* ccLR = Node->getParentLR();
- const Type* setCCType = (* ccLR->begin())->getType(); // any Value in LR
- assert(setCCType->isIntegral() || isa(setCCType));
- int ccReg = ((isa(setCCType) || setCCType == Type::LongTy)
- ? xcc : icc);
+
+ // Mark the appropriate register in any case (even if it needs to be spilled)
+ // because there is only one possible register, but more importantly, the
+ // spill algorithm cannot find it. In particular, we have to choose
+ // whether to use %xcc or %icc based on type of value compared
+ //
+ const LiveRange* ccLR = Node->getParentLR();
+ const Type* setCCType = (* ccLR->begin())->getType(); // any Value in LR
+ assert(setCCType->isIntegral() || isa(setCCType));
+ int ccReg = ((isa(setCCType) || setCCType == Type::LongTy)
+ ? xcc : icc);
#ifndef NDEBUG
- // Let's just make sure values of two different types have not been
- // coalesced into this LR.
- for (ValueSet::const_iterator I=ccLR->begin(), E=ccLR->end(); I!=E; ++I) {
- const Type* ccType = (*I)->getType();
- assert((ccReg == xcc && (isa(ccType)
- || ccType == Type::LongTy)) ||
- (ccReg == icc && ccType->isIntegral() && ccType != Type::LongTy)
- && "Comparisons needing different intCC regs coalesced in LR!");
- }
+ // Let's just make sure values of two different types have not been
+ // coalesced into this LR.
+ for (ValueSet::const_iterator I=ccLR->begin(), E=ccLR->end(); I!=E; ++I) {
+ const Type* ccType = (*I)->getType();
+ assert((ccReg == xcc && (isa(ccType)
+ || ccType == Type::LongTy)) ||
+ (ccReg == icc && ccType->isIntegral() && ccType != Type::LongTy)
+ && "Comparisons needing different intCC regs coalesced in LR!");
+ }
#endif
- Node->setColor(ccReg); // only one int cc reg is available
- }
+ Node->setColor(ccReg); // only one int cc reg is available
}
Index: llvm/lib/Target/Sparc/SparcRegInfo.cpp
diff -u llvm/lib/Target/Sparc/SparcRegInfo.cpp:1.101 llvm/lib/Target/Sparc/SparcRegInfo.cpp:1.102
--- llvm/lib/Target/Sparc/SparcRegInfo.cpp:1.101 Sun Jul 6 15:13:59 2003
+++ llvm/lib/Target/Sparc/SparcRegInfo.cpp Thu Jul 10 14:42:11 2003
@@ -424,7 +424,7 @@
UniArgReg = getUnifiedRegNum( regClassIDOfArgReg, regNum);
}
- if( LR->hasColor() ) { // if this arg received a register
+ if( ! LR->isMarkedForSpill() ) { // if this arg received a register
unsigned UniLRReg = getUnifiedRegNum( RegClassID, LR->getColor() );
@@ -618,25 +618,7 @@
// If not, do NOTHING as this will be colored as a normal value.
if(regNum != getInvalidRegNum())
LR->setSuggestedColor(regNum);
-
-#ifdef CANNOT_PRECOPY_CALLARGS
- // Repeat for the second copy of the argument, which would be
- // an FP argument being passed to a function with no prototype
- const Value *argCopy = argDesc->getArgInfo(i).getArgCopy();
- if (argCopy != NULL)
- {
- assert(regType != IntRegType && argCopy->getType()->isInteger()
- && "Must be passing copy of FP argument in int register");
- int copyRegNum = regNumForIntArg(/*inCallee*/false, /*isVarArgs*/false,
- argNo, regClassIDOfArgReg);
- assert(copyRegNum != getInvalidRegNum());
- LiveRange *const copyLR = LRI.getLiveRangeForValue(argCopy);
- copyLR->setSuggestedColor(copyRegNum);
- }
-#endif
-
} // for all call arguments
-
}
@@ -664,7 +646,7 @@
UniArgReg = (unsigned) UniArgRegOrNone;
}
- if (LR->hasColor()) {
+ if (! LR->isMarkedForSpill()) {
unsigned UniLRReg = getUnifiedRegNum(RegClassID, LR->getColor());
// if LR received the correct color, nothing to do
@@ -772,42 +754,6 @@
CallMI->insertUsedReg(getUnifiedRegNum(RegClassID, CorrectCol));
-#ifdef CANNOT_PRECOPY_CALLARGS
- // unified number for CorrectCol
- unsigned UniRetReg = getUnifiedRegNum(RegClassID, CorrectCol);
- recvCorrectColor;
-
- // if the LR received the correct color, NOTHING to do
- bool recvCorrectColor = (RetValLR->hasColor()
- ? RetValLR->getColor() == CorrectCol : false);
-
- // if we didn't receive the correct color for some reason,
- // put copy instruction
- if( !recvCorrectColor ) {
-
- unsigned regType = getRegType(RetValLR);
-
- if( RetValLR->hasColor() ) {
-
- unsigned UniRetLRReg=getUnifiedRegNum(RegClassID,RetValLR->getColor());
-
- // the return value is coming in UniRetReg but has to go into
- // the UniRetLRReg
-
- cpReg2RegMI(CallAI->InstrnsAfter, UniRetReg, UniRetLRReg, regType);
-
- } // if LR has color
- else {
-
- // if the LR did NOT receive a color, we have to move the return
- // value coming in UniRetReg to the stack pos of spilled LR
-
- cpReg2MemMI(CallAI->InstrnsAfter, UniRetReg,
- getFramePointer(),RetValLR->getSpillOffFromFP(), regType);
- }
- } // the LR didn't receive the suggested color
-#endif
-
} // if there a return value
@@ -849,24 +795,6 @@
CallMI->insertUsedReg(UniArgReg); // mark the reg as used
}
-#ifdef CANNOT_PRECOPY_CALLARGS
-
- // Get the LR of call operand (parameter). There must be one because
- // all args (even constants) must be defined before.
- LiveRange *const LR = LRI.getLiveRangeForValue(CallArg);
- assert(LR && "NO LR for call arg");
-
- unsigned RegClassID = getRegClassIDOfType(CallArg->getType());
-
- if (regNum != getInvalidRegNum()) {
- assert(regClassIDOfArgReg == RegClassID &&
- "Moving values between reg classes must happen during selection");
- }
-
- InitializeOutgoingArg(CallMI, CallAI, PRA, LR, regType, RegClassID,
- UniArgReg, argNo, AddedInstrnsBefore);
-#endif
-
// Repeat for the second copy of the argument, which would be
// an FP argument being passed to a function with no prototype.
// It may either be passed as a copy in an integer register
@@ -875,38 +803,7 @@
if (argCopyReg != TargetRegInfo::getInvalidRegNum())
{
CallMI->insertUsedReg(argCopyReg); // mark the reg as used
-
-#ifdef CANNOT_PRECOPY_CALLARGS
- assert(regType != IntRegType && argCopy->getType()->isInteger()
- && "Must be passing copy of FP argument in int register");
-
- unsigned copyRegClassID = getRegClassIDOfType(argCopy->getType());
- unsigned copyRegType = getRegType(argCopy->getType());
-
- int copyRegNum = regNumForIntArg(/*inCallee*/false, /*isVarArgs*/false,
- argNo, regClassIDOfArgReg);
- assert(copyRegNum != getInvalidRegNum());
- assert(regClassIDOfArgReg == copyRegClassID &&
- "Moving values between reg classes must happen during selection");
-
- InitializeOutgoingArg(CallMI, CallAI, PRA,
- LRI.getLiveRangeForValue(argCopy), copyRegType,
- copyRegClassID, copyRegNum, argNo,
- AddedInstrnsBefore);
-#endif
- }
-
-#ifdef CANNOT_PRECOPY_CALLARGS
- if (regNum != getInvalidRegNum() &&
- argDesc->getArgInfo(i).usesStackSlot())
- {
- // Pass the argument via the stack in addition to regNum
- assert(regType != IntRegType && "Passing an integer arg. twice?");
- assert(!argCopy && "Passing FP arg in FP reg, INT reg, and stack?");
- InitializeOutgoingArg(CallMI, CallAI, PRA, LR, regType, RegClassID,
- getInvalidRegNum(), argNo, AddedInstrnsBefore);
}
-#endif
} // for each parameter in call instruction
// If we added any instruction before the call instruction, verify
@@ -1014,34 +911,6 @@
// Mark the register as used by this instruction
RetMI->insertUsedReg(UniRetReg);
-
-#ifdef CANNOT_PRECOPY_CALLARGS
- LiveRange *LR = LRI.getLiveRangeForValue(RetVal);
- assert(LR && "No LR for return value of non-void method?");
-
- if (LR->hasColor()) {
- // if the LR received the correct color, NOTHING to do
- if (LR->getColor() == CorrectCol)
- return;
-
- // We are here because the LR was allocated a register
- // It may be the suggested register or not
-
- // copy the LR of retun value to i0 or f0
-
- unsigned UniLRReg =getUnifiedRegNum( RegClassID, LR->getColor());
-
- // the LR received UniLRReg but must be colored with UniRetReg
- // to pass as the return value
- cpReg2RegMI(RetAI->InstrnsBefore, UniLRReg, UniRetReg, regType);
- }
- else { // if the LR is spilled
- cpMem2RegMI(RetAI->InstrnsBefore, getFramePointer(),
- LR->getSpillOffFromFP(), UniRetReg, regType);
- //std::cerr << "\nCopied the return value from stack\n";
- }
-#endif
-
} // if there is a return value
}
@@ -1088,14 +957,19 @@
case IntCCRegType:
if (getRegType(DestReg) == IntRegType) {
// copy intCC reg to int reg
- MI = (BuildMI(V9::RDCCR, 2).addMReg(SparcIntCCRegClass::ccr).
- addMReg(DestReg,MOTy::Def));
+ MI = (BuildMI(V9::RDCCR, 2)
+ .addMReg(getUnifiedRegNum(UltraSparcRegInfo::IntCCRegClassID,
+ SparcIntCCRegClass::ccr))
+ .addMReg(DestReg,MOTy::Def));
} else {
// copy int reg to intCC reg
assert(getRegType(SrcReg) == IntRegType
&& "Can only copy CC reg to/from integer reg");
- MI = (BuildMI(V9::WRCCRr, 3).addMReg(SrcReg).addMReg(SparcIntRegClass::g0)
- .addMReg(SparcIntCCRegClass::ccr, MOTy::Def));
+ MI = (BuildMI(V9::WRCCRr, 3)
+ .addMReg(SrcReg)
+ .addMReg(SparcIntRegClass::g0)
+ .addMReg(getUnifiedRegNum(UltraSparcRegInfo::IntCCRegClassID,
+ SparcIntCCRegClass::ccr), MOTy::Def));
}
break;
@@ -1160,7 +1034,9 @@
case IntCCRegType:
assert(scratchReg >= 0 && "Need scratch reg to store %ccr to memory");
assert(getRegType(scratchReg) ==IntRegType && "Invalid scratch reg");
- MI = (BuildMI(V9::RDCCR, 2).addMReg(SparcIntCCRegClass::ccr)
+ MI = (BuildMI(V9::RDCCR, 2)
+ .addMReg(getUnifiedRegNum(UltraSparcRegInfo::IntCCRegClassID,
+ SparcIntCCRegClass::ccr))
.addMReg(scratchReg, MOTy::Def));
mvec.push_back(MI);
@@ -1219,8 +1095,11 @@
assert(scratchReg >= 0 && "Need scratch reg to load %ccr from memory");
assert(getRegType(scratchReg) ==IntRegType && "Invalid scratch reg");
cpMem2RegMI(mvec, SrcPtrReg, Offset, scratchReg, IntRegType);
- MI = BuildMI(V9::WRCCRr, 3).addMReg(scratchReg)
- .addMReg(SparcIntRegClass::g0).addMReg(SparcIntCCRegClass::ccr,MOTy::Def);
+ MI = (BuildMI(V9::WRCCRr, 3)
+ .addMReg(scratchReg)
+ .addMReg(SparcIntRegClass::g0)
+ .addMReg(getUnifiedRegNum(UltraSparcRegInfo::IntCCRegClassID,
+ SparcIntCCRegClass::ccr), MOTy::Def));
break;
case FloatCCRegType: {
@@ -1323,7 +1202,7 @@
LiveRange *RetValLR = PRA.LRI.getLiveRangeForValue( tmpRetVal );
assert(RetValLR && "No LR for RetValue of call");
- if (RetValLR->hasColor())
+ if (! RetValLR->isMarkedForSpill())
PushedRegSet.insert(getUnifiedRegNum(RetValLR->getRegClassID(),
RetValLR->getColor()));
}
@@ -1341,8 +1220,9 @@
// doesn't have a dominating def - see Assumptions above
if( LR ) {
- if( LR->hasColor() ) {
+ if(! LR->isMarkedForSpill()) {
+ assert(LR->hasColor() && "LR is neither spilled nor colored?");
unsigned RCID = LR->getRegClassID();
unsigned Color = LR->getColor();
Index: llvm/lib/Target/Sparc/EmitAssembly.cpp
diff -u llvm/lib/Target/Sparc/EmitAssembly.cpp:1.80 llvm/lib/Target/Sparc/EmitAssembly.cpp:1.81
--- llvm/lib/Target/Sparc/EmitAssembly.cpp:1.80 Sun Jul 6 15:13:59 2003
+++ llvm/lib/Target/Sparc/EmitAssembly.cpp Thu Jul 10 14:42:11 2003
@@ -393,27 +393,12 @@
switch (mop.getType())
{
- case MachineOperand::MO_CCRegister:
- {
- // We need to print %icc or %xcc as %ccr for certain opcodes.
- int regNum = (int)mop.getAllocatedRegNum();
- if (regNum != Target.getRegInfo().getInvalidRegNum() &&
- Target.getRegInfo().getRegClassIDOfReg(regNum)
- == UltraSparcRegInfo::IntCCRegClassID)
- {
- if (opCode == V9::RDCCR || opCode == V9::WRCCRi || opCode == V9::WRCCRr)
- {
- toAsm << "%" << Target.getRegInfo().getMachineRegClass(UltraSparcRegInfo::IntCCRegClassID)->getRegName(SparcIntCCRegClass::ccr);
- break;
- }
- }
- // all other cases can be handled like any other register
- }
-
case MachineOperand::MO_VirtualRegister:
+ case MachineOperand::MO_CCRegister:
case MachineOperand::MO_MachineRegister:
{
int regNum = (int)mop.getAllocatedRegNum();
+
if (regNum == Target.getRegInfo().getInvalidRegNum()) {
// better to print code with NULL registers than to die
toAsm << "";
From vadve at cs.uiuc.edu Thu Jul 10 14:44:01 2003
From: vadve at cs.uiuc.edu (Vikram Adve)
Date: Thu Jul 10 14:44:01 2003
Subject: [llvm-commits] CVS: llvm/lib/CodeGen/RegAlloc/InterferenceGraph.cpp
Message-ID: <200307101943.OAA10707@psmith.cs.uiuc.edu>
Changes in directory llvm/lib/CodeGen/RegAlloc:
InterferenceGraph.cpp updated: 1.14 -> 1.15
---
Log message:
Print out all neighbors in interference graph, not just higher-numbered ones.
---
Diffs of the changes:
Index: llvm/lib/CodeGen/RegAlloc/InterferenceGraph.cpp
diff -u llvm/lib/CodeGen/RegAlloc/InterferenceGraph.cpp:1.14 llvm/lib/CodeGen/RegAlloc/InterferenceGraph.cpp:1.15
--- llvm/lib/CodeGen/RegAlloc/InterferenceGraph.cpp:1.14 Wed Jan 15 15:00:02 2003
+++ llvm/lib/CodeGen/RegAlloc/InterferenceGraph.cpp Thu Jul 10 14:43:33 2003
@@ -224,7 +224,7 @@
if(Node) {
cerr << " [" << i << "] ";
- for( unsigned int j=0; j < i; j++) {
+ for( unsigned int j=0; j < Size; j++) {
if(IG[i][j])
cerr << "(" << i << "," << j << ") ";
}
From vadve at cs.uiuc.edu Thu Jul 10 14:44:05 2003
From: vadve at cs.uiuc.edu (Vikram Adve)
Date: Thu Jul 10 14:44:05 2003
Subject: [llvm-commits] CVS: llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp
Message-ID: <200307101943.OAA10699@psmith.cs.uiuc.edu>
Changes in directory llvm/lib/CodeGen/RegAlloc:
PhyRegAlloc.cpp updated: 1.97 -> 1.98
---
Log message:
Several fixes to handling of int CC register:
(1) An int CC live range must be spilled if there are any interferences,
even if no other "neighbour" in the interf. graph has been allocated
that reg. yet. This is actually true of any class with only one reg!
(2) SparcIntCCRegClass::colorIGNode sets the color even if the LR must
be spilled so that the machine-independent spill code doesn't have to
make the machine-dependent decision of which CC name to use based on
operand type: %xcc or %icc. (These are two halves of the same
register.)
(3) LR->isMarkedForSpill() is no longer the same as LR->hasColor().
These should never have been the same, and this is necessary now for #2.
(4) All RDCCR and WRCCR instructions are directly generated with the
phony number for %ccr so that EmitAssembly/EmitBinary doesn't have to
deal with this.
---
Diffs of the changes:
Index: llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp
diff -u llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp:1.97 llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp:1.98
--- llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp:1.97 Tue Jul 1 20:24:00 2003
+++ llvm/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp Thu Jul 10 14:42:55 2003
@@ -547,7 +547,7 @@
{
const Value* Val = Op.getVRegValue();
if (const LiveRange *LR = LRI.getLiveRangeForValue(Val))
- if (! LR->hasColor())
+ if (LR->isMarkedForSpill())
insertCode4SpilledLR(LR, MInst, BB, OpNum);
}
} // for each operand
@@ -710,10 +710,12 @@
vector MIBef, MIAft;
vector AdIMid;
- // Choose a register to hold the spilled value. This may insert code
- // before and after MInst to free up the value. If so, this code should
- // be first and last in the spill sequence before/after MInst.
- int TmpRegU = getUsableUniRegAtMI(RegType, &LVSetBef, MInst, MIBef, MIAft);
+ // Choose a register to hold the spilled value, if one was not preallocated.
+ // This may insert code before and after MInst to free up the value. If so,
+ // this code should be first/last in the spill sequence before/after MInst.
+ int TmpRegU=(LR->hasColor()
+ ? MRI.getUnifiedRegNum(LR->getRegClass()->getID(),LR->getColor())
+ : getUsableUniRegAtMI(RegType, &LVSetBef, MInst, MIBef,MIAft));
// Set the operand first so that it this register does not get used
// as a scratch register for later calls to getUsableUniRegAtMI below
@@ -749,7 +751,7 @@
AdIMid.clear();
}
- if (isDef) { // if this is a Def
+ if (isDef || isDefAndUse) { // if this is a Def
// for a DEF, we have to store the value produced by this instruction
// on the stack position allocated for this LR
@@ -1125,8 +1127,8 @@
for ( ; HMI != HMIEnd ; ++HMI) {
if (HMI->first && HMI->second) {
- LiveRange *L = HMI->second; // get the LiveRange
- if (!L->hasColor()) { // NOTE: ** allocating the size of long Type **
+ LiveRange *L = HMI->second; // get the LiveRange
+ if (L->isMarkedForSpill()) { // NOTE: allocating size of long Type **
int stackOffset = MF.getInfo()->allocateSpilledValue(Type::LongTy);
L->setSpillOffFromFP(stackOffset);
if (DEBUG_RA)
From vadve at cs.uiuc.edu Thu Jul 10 14:45:01 2003
From: vadve at cs.uiuc.edu (Vikram Adve)
Date: Thu Jul 10 14:45:01 2003
Subject: [llvm-commits] CVS: llvm/lib/CodeGen/MachineInstr.cpp
Message-ID: <200307101944.OAA10722@psmith.cs.uiuc.edu>
Changes in directory llvm/lib/CodeGen:
MachineInstr.cpp updated: 1.72 -> 1.73
---
Log message:
Change interface to MachineInstr::substituteValue to specify more precisely
which args can be substituted: defsOnly, defsAndUses or usesOnly.
---
Diffs of the changes:
Index: llvm/lib/CodeGen/MachineInstr.cpp
diff -u llvm/lib/CodeGen/MachineInstr.cpp:1.72 llvm/lib/CodeGen/MachineInstr.cpp:1.73
--- llvm/lib/CodeGen/MachineInstr.cpp:1.72 Sat May 31 02:39:06 2003
+++ llvm/lib/CodeGen/MachineInstr.cpp Thu Jul 10 14:44:49 2003
@@ -153,29 +153,43 @@
// Subsitute all occurrences of Value* oldVal with newVal in all operands
-// and all implicit refs. If defsOnly == true, substitute defs only.
+// and all implicit refs.
+// If defsOnly == true, substitute defs only.
unsigned
-MachineInstr::substituteValue(const Value* oldVal, Value* newVal, bool defsOnly)
+MachineInstr::substituteValue(const Value* oldVal, Value* newVal,
+ bool defsOnly, bool notDefsAndUses,
+ bool& someArgsWereIgnored)
{
+ assert((defsOnly || !notDefsAndUses) &&
+ "notDefsAndUses is irrelevant if defsOnly == false.");
+
unsigned numSubst = 0;
// Subsitute operands
for (MachineInstr::val_op_iterator O = begin(), E = end(); O != E; ++O)
if (*O == oldVal)
- if (!defsOnly || !O.isUseOnly())
+ if (!defsOnly ||
+ notDefsAndUses && O.isDefOnly() ||
+ !notDefsAndUses && !O.isUseOnly())
{
O.getMachineOperand().value = newVal;
++numSubst;
}
+ else
+ someArgsWereIgnored = true;
// Subsitute implicit refs
for (unsigned i=0, N=getNumImplicitRefs(); i < N; ++i)
if (getImplicitRef(i) == oldVal)
- if (!defsOnly || !getImplicitOp(i).opIsUse())
+ if (!defsOnly ||
+ notDefsAndUses && getImplicitOp(i).opIsDefOnly() ||
+ !notDefsAndUses && !getImplicitOp(i).opIsUse())
{
getImplicitOp(i).value = newVal;
++numSubst;
}
+ else
+ someArgsWereIgnored = true;
return numSubst;
}
@@ -191,10 +205,10 @@
OutputValue(std::ostream &os, const Value* val)
{
os << "(val ";
+ os << (void*) val; // print address always
if (val && val->hasName())
- return os << val->getName() << ")";
- else
- return os << (void*) val << ")"; // print address only
+ os << " " << val->getName() << ")"; // print name also, if available
+ return os;
}
static inline void OutputReg(std::ostream &os, unsigned RegNo,
From vadve at cs.uiuc.edu Thu Jul 10 14:46:02 2003
From: vadve at cs.uiuc.edu (Vikram Adve)
Date: Thu Jul 10 14:46:02 2003
Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveRange.h
Message-ID: <200307101945.OAA10746@psmith.cs.uiuc.edu>
Changes in directory llvm/include/llvm/CodeGen:
LiveRange.h updated: 1.20 -> 1.21
---
Log message:
isMarkedForSpill() should be const.
---
Diffs of the changes:
Index: llvm/include/llvm/CodeGen/LiveRange.h
diff -u llvm/include/llvm/CodeGen/LiveRange.h:1.20 llvm/include/llvm/CodeGen/LiveRange.h:1.21
--- llvm/include/llvm/CodeGen/LiveRange.h:1.20 Sat Jun 21 22:06:13 2003
+++ llvm/include/llvm/CodeGen/LiveRange.h Thu Jul 10 14:45:28 2003
@@ -101,7 +101,7 @@
inline void markForSpill() { mustSpill = true; }
- inline bool isMarkedForSpill() { return mustSpill; }
+ inline bool isMarkedForSpill() const { return mustSpill; }
inline void setSpillOffFromFP(int StackOffset) {
assert(mustSpill && "This LR is not spilled");
From vadve at cs.uiuc.edu Thu Jul 10 14:46:06 2003
From: vadve at cs.uiuc.edu (Vikram Adve)
Date: Thu Jul 10 14:46:06 2003
Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineInstr.h
Message-ID: <200307101945.OAA10735@psmith.cs.uiuc.edu>
Changes in directory llvm/include/llvm/CodeGen:
MachineInstr.h updated: 1.105 -> 1.106
---
Log message:
Change interface to MachineInstr::substituteValue to specify more precisely
which args can be substituted: defsOnly, defsAndUses or usesOnly.
---
Diffs of the changes:
Index: llvm/include/llvm/CodeGen/MachineInstr.h
diff -u llvm/include/llvm/CodeGen/MachineInstr.h:1.105 llvm/include/llvm/CodeGen/MachineInstr.h:1.106
--- llvm/include/llvm/CodeGen/MachineInstr.h:1.105 Tue Jul 1 20:25:44 2003
+++ llvm/include/llvm/CodeGen/MachineInstr.h Thu Jul 10 14:45:07 2003
@@ -646,7 +646,8 @@
unsigned substituteValue(const Value* oldVal, Value* newVal,
- bool defsOnly = true);
+ bool defsOnly, bool notDefsAndUses,
+ bool& someArgsWereIgnored);
void setOperandHi32(unsigned i) { operands[i].markHi32(); }
void setOperandLo32(unsigned i) { operands[i].markLo32(); }
From vadve at cs.uiuc.edu Thu Jul 10 14:47:01 2003
From: vadve at cs.uiuc.edu (Vikram Adve)
Date: Thu Jul 10 14:47:01 2003
Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineInstrAnnot.h
Message-ID: <200307101946.OAA10759@psmith.cs.uiuc.edu>
Changes in directory llvm/include/llvm/CodeGen:
MachineInstrAnnot.h updated: 1.10 -> 1.11
---
Log message:
Values stored in CallArgsDescriptor cannot be const.
---
Diffs of the changes:
Index: llvm/include/llvm/CodeGen/MachineInstrAnnot.h
diff -u llvm/include/llvm/CodeGen/MachineInstrAnnot.h:1.10 llvm/include/llvm/CodeGen/MachineInstrAnnot.h:1.11
--- llvm/include/llvm/CodeGen/MachineInstrAnnot.h:1.10 Sat Jun 21 22:06:13 2003
+++ llvm/include/llvm/CodeGen/MachineInstrAnnot.h Thu Jul 10 14:45:59 2003
@@ -20,14 +20,14 @@
static const unsigned char FPArgReg = 0x2;
static const unsigned char StackSlot = 0x4;
- const Value* argVal; // this argument
- int argCopyReg; // register used for second copy of arg. when
+ Value* argVal; // this argument
+ int argCopyReg; // register used for second copy of arg. when
// multiple copies must be passed in registers
unsigned char passingMethod; // flags recording passing methods
public:
// Constructors
- CallArgInfo(const Value* _argVal)
+ CallArgInfo(Value* _argVal)
: argVal(_argVal), argCopyReg(TargetRegInfo::getInvalidRegNum()),
passingMethod(0x0) {}
@@ -36,14 +36,14 @@
passingMethod(obj.passingMethod) {}
// Accessor methods
- const Value* getArgVal() { return argVal; }
+ Value* getArgVal() { return argVal; }
int getArgCopy() { return argCopyReg; }
bool usesIntArgReg() { return (bool) (passingMethod & IntArgReg);}
bool usesFPArgReg() { return (bool) (passingMethod & FPArgReg); }
bool usesStackSlot() { return (bool) (passingMethod & StackSlot);}
// Modifier methods
- void replaceArgVal(const Value* newVal) { argVal = newVal; }
+ void replaceArgVal(Value* newVal) { argVal = newVal; }
void setUseIntArgReg() { passingMethod |= IntArgReg; }
void setUseFPArgReg() { passingMethod |= FPArgReg; }
void setUseStackSlot() { passingMethod |= StackSlot; }
@@ -54,14 +54,14 @@
class CallArgsDescriptor {
std::vector argInfoVec; // Descriptor for each argument
- const CallInst* callInstr; // The call instruction == result value
- const Value* funcPtr; // Pointer for indirect calls
+ CallInst* callInstr; // The call instruction == result value
+ Value* funcPtr; // Pointer for indirect calls
TmpInstruction* retAddrReg; // Tmp value for return address reg.
bool isVarArgs; // Is this a varargs call?
bool noPrototype; // Is this a call with no prototype?
public:
- CallArgsDescriptor(const CallInst* _callInstr, TmpInstruction* _retAddrReg,
+ CallArgsDescriptor(CallInst* _callInstr, TmpInstruction* _retAddrReg,
bool _isVarArgs, bool _noPrototype);
// Accessor methods to retrieve information about the call
@@ -69,9 +69,9 @@
unsigned int getNumArgs() const { return argInfoVec.size(); }
CallArgInfo& getArgInfo(unsigned int op) { assert(op < argInfoVec.size());
return argInfoVec[op]; }
- const CallInst* getCallInst() const { return callInstr; }
- const CallInst* getReturnValue() const;
- const Value* getIndirectFuncPtr() const { return funcPtr; }
+ CallInst* getCallInst() const { return callInstr; }
+ CallInst* getReturnValue() const;
+ Value* getIndirectFuncPtr() const { return funcPtr; }
TmpInstruction* getReturnAddrReg() const { return retAddrReg; }
bool isVarArgsFunc() const { return isVarArgs; }
bool hasNoPrototype() const { return noPrototype; }
From vadve at cs.uiuc.edu Thu Jul 10 14:47:05 2003
From: vadve at cs.uiuc.edu (Vikram Adve)
Date: Thu Jul 10 14:47:05 2003
Subject: [llvm-commits] CVS: llvm/lib/CodeGen/MachineInstrAnnot.cpp
Message-ID: <200307101946.OAA10773@psmith.cs.uiuc.edu>
Changes in directory llvm/lib/CodeGen:
MachineInstrAnnot.cpp updated: 1.7 -> 1.8
---
Log message:
Values stored in CallArgsDescriptor cannot be const.
---
Diffs of the changes:
Index: llvm/lib/CodeGen/MachineInstrAnnot.cpp
diff -u llvm/lib/CodeGen/MachineInstrAnnot.cpp:1.7 llvm/lib/CodeGen/MachineInstrAnnot.cpp:1.8
--- llvm/lib/CodeGen/MachineInstrAnnot.cpp:1.7 Wed Jan 15 13:47:12 2003
+++ llvm/lib/CodeGen/MachineInstrAnnot.cpp Thu Jul 10 14:46:15 2003
@@ -12,7 +12,7 @@
#include "llvm/Type.h"
-CallArgsDescriptor::CallArgsDescriptor(const CallInst* _callInstr,
+CallArgsDescriptor::CallArgsDescriptor(CallInst* _callInstr,
TmpInstruction* _retAddrReg,
bool _isVarArgs, bool _noPrototype)
: callInstr(_callInstr),
@@ -35,7 +35,7 @@
}
-const CallInst*
+CallInst*
CallArgsDescriptor::getReturnValue() const
{
return (callInstr->getType() == Type::VoidTy? NULL : callInstr);
From vadve at cs.uiuc.edu Thu Jul 10 14:48:01 2003
From: vadve at cs.uiuc.edu (Vikram Adve)
Date: Thu Jul 10 14:48:01 2003
Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/Sparc.burg.in
Message-ID: <200307101947.OAA10786@psmith.cs.uiuc.edu>
Changes in directory llvm/lib/Target/Sparc:
Sparc.burg.in updated: 1.5 -> 1.6
---
Log message:
Fold cast-to-bool into not. Later, this should also be folded into other
boolean operations: AND, OR, XOR.
---
Diffs of the changes:
Index: llvm/lib/Target/Sparc/Sparc.burg.in
diff -u llvm/lib/Target/Sparc/Sparc.burg.in:1.5 llvm/lib/Target/Sparc/Sparc.burg.in:1.6
--- llvm/lib/Target/Sparc/Sparc.burg.in:1.5 Sun May 25 10:59:47 2003
+++ llvm/lib/Target/Sparc/Sparc.burg.in Thu Jul 10 14:47:42 2003
@@ -138,6 +138,7 @@
*/
not: Not(reg,reg) = 21 (10);
tobool: ToBoolTy(reg) = 22 (10);
+not: Not(tobool, reg) = 322 (10); // fold cast-to-bool into not
toubyte: ToUByteTy(reg) = 23 (10);
tosbyte: ToSByteTy(reg) = 24 (10);
toushort: ToUShortTy(reg) = 25 (10);
From vadve at cs.uiuc.edu Thu Jul 10 14:49:01 2003
From: vadve at cs.uiuc.edu (Vikram Adve)
Date: Thu Jul 10 14:49:01 2003
Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/SparcInstrInfo.cpp
Message-ID: <200307101948.OAA10799@psmith.cs.uiuc.edu>
Changes in directory llvm/lib/Target/Sparc:
SparcInstrInfo.cpp updated: 1.48 -> 1.49
---
Log message:
Bug fix in creating constants: need 1U << 31, not 1 << 31.
---
Diffs of the changes:
Index: llvm/lib/Target/Sparc/SparcInstrInfo.cpp
diff -u llvm/lib/Target/Sparc/SparcInstrInfo.cpp:1.48 llvm/lib/Target/Sparc/SparcInstrInfo.cpp:1.49
--- llvm/lib/Target/Sparc/SparcInstrInfo.cpp:1.48 Mon Jun 30 16:58:49 2003
+++ llvm/lib/Target/Sparc/SparcInstrInfo.cpp Thu Jul 10 14:48:19 2003
@@ -264,7 +264,7 @@
static const uint64_t lo32 = (uint32_t) ~0;
if (C <= lo32) // High 32 bits are 0. Set low 32 bits.
CreateSETUWConst(target, (uint32_t) C, dest, mvec);
- else if ((C & ~lo32) == ~lo32 && (C & (1 << 31))) {
+ else if ((C & ~lo32) == ~lo32 && (C & (1U << 31))) {
// All high 33 (not 32) bits are 1s: sign-extension will take care
// of high 32 bits, so use the sequence for signed int
CreateSETSWConst(target, (int32_t) C, dest, mvec);
From vadve at cs.uiuc.edu Thu Jul 10 15:09:06 2003
From: vadve at cs.uiuc.edu (Vikram Adve)
Date: Thu Jul 10 15:09:06 2003
Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/SparcInstrSelection.cpp
Message-ID: <200307102008.PAA10828@psmith.cs.uiuc.edu>
Changes in directory llvm/lib/Target/Sparc:
SparcInstrSelection.cpp updated: 1.106 -> 1.107
---
Log message:
Several important bug fixes:
(1) Cannot use ANDN(ot), ORN, and XORN for boolean ops, only bitwise ops.
(2) Conditional move instructions must distinguish signed and unsigned
condition codes, e.g., MOVLE vs. MOVLEU.
(3) Conditional-move-on-register was using the cond-move-on-cc opcodes,
which produces a valid-looking instruction with bogus registers!
(4) Here's a really cute one: dividing-by-2^k for negative numbers needs to
add 2^k-1 before shifting, not add 1 after shifting. Sadly, these
are the same when k=0 so our poor test case worked fine.
(5) Casting between signed and unsigned values was not correct:
completely reimplemented.
(6) Zero-extension on unsigned values was bogus: I was only doing the
SRL and not the SLLX before it. Don't know WHAT I was thinking!
(7) And the most important class of changes: Sign-extensions on signed values.
Signed values are not sign-extended after ordinary operations,
so they must be sign-extended before the following cases:
-- passing to an external or unknown function
-- returning from a function
-- using as operand 2 of DIV or REM
-- using as either operand of condition-code setting operation
(currently only SUBCC), with smaller than 32-bit operands
Also, a couple of improvements:
(1) Fold cast-to-bool into Not(bool). Need to do this for And, Or, XOR also.
(2) Convert SetCC-Const into a conditional-move-on-register (case 41)
if the constant is 0. This was only being done for branch-on-SetCC-Const
when the branch is folded with the SetCC-Const.
---
Diffs of the changes:
Index: llvm/lib/Target/Sparc/SparcInstrSelection.cpp
diff -u llvm/lib/Target/Sparc/SparcInstrSelection.cpp:1.106 llvm/lib/Target/Sparc/SparcInstrSelection.cpp:1.107
--- llvm/lib/Target/Sparc/SparcInstrSelection.cpp:1.106 Sun Jul 6 15:13:59 2003
+++ llvm/lib/Target/Sparc/SparcInstrSelection.cpp Thu Jul 10 15:07:54 2003
@@ -25,6 +25,7 @@
#include "llvm/Intrinsics.h"
#include "Support/MathExtras.h"
#include
+#include
static inline void Add3OperandInstr(unsigned Opcode, InstructionNode* Node,
std::vector& mvec) {
@@ -429,13 +430,8 @@
}
-// Assumes that SUBcc v1, v2 -> v3 has been executed.
-// In most cases, we want to clear v3 and then follow it by instruction
-// MOVcc 1 -> v3.
-// Set mustClearReg=false if v3 need not be cleared before conditional move.
-// Set valueToMove=0 if we want to conditionally move 0 instead of 1
-// (i.e., we want to test inverse of a condition)
-// (The latter two cases do not seem to arise because SetNE needs nothing.)
+// ChooseMovpcciForSetCC -- Choose a conditional-move instruction
+// based on the type of SetCC operation.
//
// WARNING: since this function has only one caller, it always returns
// the opcode that expects an immediate and a register. If this function
@@ -444,25 +440,58 @@
//
// It will be necessary to expand convertOpcodeFromRegToImm() to handle the
// new cases of opcodes.
+//
static MachineOpCode
-ChooseMovpcciAfterSub(const InstructionNode* instrNode)
+ChooseMovpcciForSetCC(const InstructionNode* instrNode)
{
MachineOpCode opCode = V9::INVALID_OPCODE;
+
+ const Type* opType = instrNode->leftChild()->getValue()->getType();
+ assert(opType->isIntegral() || isa(opType));
+ bool noSign = opType->isUnsigned() || isa(opType);
switch(instrNode->getInstruction()->getOpcode())
{
- case Instruction::SetEQ: opCode = V9::MOVEi; break;
- case Instruction::SetLE: opCode = V9::MOVLEi; break;
- case Instruction::SetGE: opCode = V9::MOVGEi; break;
- case Instruction::SetLT: opCode = V9::MOVLi; break;
- case Instruction::SetGT: opCode = V9::MOVGi; break;
- case Instruction::SetNE: opCode = V9::MOVNEi; break;
+ case Instruction::SetEQ: opCode = V9::MOVEi; break;
+ case Instruction::SetLE: opCode = noSign? V9::MOVLEUi : V9::MOVLEi; break;
+ case Instruction::SetGE: opCode = noSign? V9::MOVCCi : V9::MOVGEi; break;
+ case Instruction::SetLT: opCode = noSign? V9::MOVCSi : V9::MOVLi; break;
+ case Instruction::SetGT: opCode = noSign? V9::MOVGUi : V9::MOVGi; break;
+ case Instruction::SetNE: opCode = V9::MOVNEi; break;
+ default: assert(0 && "Unrecognized LLVM instr!"); break;
+ }
+
+ return opCode;
+}
+
+
+// ChooseMovpregiForSetCC -- Choose a conditional-move-on-register-value
+// instruction based on the type of SetCC operation. These instructions
+// compare a register with 0 and perform the move is the comparison is true.
+//
+// WARNING: like the previous function, this function it always returns
+// the opcode that expects an immediate and a register. See above.
+//
+static MachineOpCode
+ChooseMovpregiForSetCC(const InstructionNode* instrNode)
+{
+ MachineOpCode opCode = V9::INVALID_OPCODE;
+
+ switch(instrNode->getInstruction()->getOpcode())
+ {
+ case Instruction::SetEQ: opCode = V9::MOVRZi; break;
+ case Instruction::SetLE: opCode = V9::MOVRLEZi; break;
+ case Instruction::SetGE: opCode = V9::MOVRGEZi; break;
+ case Instruction::SetLT: opCode = V9::MOVRLZi; break;
+ case Instruction::SetGT: opCode = V9::MOVRGZi; break;
+ case Instruction::SetNE: opCode = V9::MOVRNZi; break;
default: assert(0 && "Unrecognized VM instr!"); break;
}
return opCode;
}
+
static inline MachineOpCode
ChooseConvertToFloatInstr(OpLabel vopCode, const Type* opType)
{
@@ -963,27 +992,46 @@
Value* shiftOperand;
if (resultType->isSigned()) {
- // The result may be negative and we need to add one before shifting
- // a negative value. Use:
- // srl i0, 31, x0; add x0, i0, i1 (if i0 is <= 32 bits)
- // or
- // srlx i0, 63, x0; add x0, i0, i1 (if i0 is 64 bits)
- // to compute i1=i0+1 if i0 < 0 and i1=i0 otherwise.
+ // For N / 2^k, if the operand N is negative,
+ // we need to add (2^k - 1) before right-shifting by k, i.e.,
+ //
+ // (N / 2^k) = N >> k, if N >= 0;
+ // (N + 2^k - 1) >> k, if N < 0
+ //
+ // If N is <= 32 bits, use:
+ // sra N, 31, t1 // t1 = ~0, if N < 0, 0 else
+ // srl t1, 32-k, t2 // t2 = 2^k - 1, if N < 0, 0 else
+ // add t2, N, t3 // t3 = N + 2^k -1, if N < 0, N else
+ // sra t3, k, result // result = N / 2^k
//
- TmpInstruction *srlTmp, *addTmp;
+ // If N is 64 bits, use:
+ // srax N, k-1, t1 // t1 = sign bit in high k positions
+ // srlx t1, 64-k, t2 // t2 = 2^k - 1, if N < 0, 0 else
+ // add t2, N, t3 // t3 = N + 2^k -1, if N < 0, N else
+ // sra t3, k, result // result = N / 2^k
+ //
+ TmpInstruction *sraTmp, *srlTmp, *addTmp;
MachineCodeForInstruction& mcfi
= MachineCodeForInstruction::get(destVal);
- srlTmp = new TmpInstruction(mcfi, resultType, LHS, 0, "getSign");
+ sraTmp = new TmpInstruction(mcfi, resultType, LHS, 0, "getSign");
+ srlTmp = new TmpInstruction(mcfi, resultType, LHS, 0, "getPlus2km1");
addTmp = new TmpInstruction(mcfi, resultType, LHS, srlTmp,"incIfNeg");
+ // Create the SRA or SRAX instruction to get the sign bit
+ mvec.push_back(BuildMI((resultType==Type::LongTy) ?
+ V9::SRAXi6 : V9::SRAi5, 3)
+ .addReg(LHS)
+ .addSImm((resultType==Type::LongTy)? pow-1 : 31)
+ .addRegDef(sraTmp));
+
// Create the SRL or SRLX instruction to get the sign bit
mvec.push_back(BuildMI((resultType==Type::LongTy) ?
V9::SRLXi6 : V9::SRLi5, 3)
- .addReg(LHS)
- .addSImm((resultType==Type::LongTy)? 63 : 31)
+ .addReg(sraTmp)
+ .addSImm((resultType==Type::LongTy)? 64-pow : 32-pow)
.addRegDef(srlTmp));
- // Create the ADD instruction to add 1 for negative values
+ // Create the ADD instruction to add 2^pow-1 for negative values
mvec.push_back(BuildMI(V9::ADDr, 3).addReg(LHS).addReg(srlTmp)
.addRegDef(addTmp));
@@ -1441,6 +1489,7 @@
unsigned allocaSize = 0;
MachineInstr* M, *M2;
unsigned L;
+ bool foldCase = false;
mvec.clear();
@@ -1489,9 +1538,11 @@
BuildMI(V9::JMPLRETi, 3).addReg(returnAddrTmp).addSImm(8)
.addMReg(target.getRegInfo().getZeroRegNum(), MOTy::Def);
- // Insert a copy to copy the return value to the appropriate register
- // -- For FP values, create a FMOVS or FMOVD instruction
- // -- For non-FP values, create an add-with-0 instruction
+ // If ther is a value to return, we need to:
+ // (a) Sign-extend the value if it is smaller than 8 bytes (reg size)
+ // (b) Insert a copy to copy the return value to the appropriate reg.
+ // -- For FP values, create a FMOVS or FMOVD instruction
+ // -- For non-FP values, create an add-with-0 instruction
//
if (retVal != NULL) {
const UltraSparcRegInfo& regInfo =
@@ -1503,19 +1554,39 @@
: (unsigned) SparcIntRegClass::i0);
retRegNum = regInfo.getUnifiedRegNum(regClassID, retRegNum);
- // Create a virtual register to represent it and mark
- // this vreg as being an implicit operand of the ret MI
+ // () Insert sign-extension instructions for small signed values.
+ //
+ Value* retValToUse = retVal;
+ if (retType->isIntegral() && retType->isSigned()) {
+ unsigned retSize = target.getTargetData().getTypeSize(retType);
+ if (retSize <= 4) {
+ // create a temporary virtual reg. to hold the sign-extension
+ retValToUse = new TmpInstruction(mcfi, retVal);
+
+ // sign-extend retVal and put the result in the temporary reg.
+ target.getInstrInfo().CreateSignExtensionInstructions
+ (target, returnInstr->getParent()->getParent(),
+ retVal, retValToUse, 8*retSize, mvec, mcfi);
+ }
+ }
+
+ // (b) Now, insert a copy to to the appropriate register:
+ // -- For FP values, create a FMOVS or FMOVD instruction
+ // -- For non-FP values, create an add-with-0 instruction
+ //
+ // First, create a virtual register to represent the register and
+ // mark this vreg as being an implicit operand of the ret MI.
TmpInstruction* retVReg =
- new TmpInstruction(mcfi, retVal, NULL, "argReg");
-
+ new TmpInstruction(mcfi, retValToUse, NULL, "argReg");
+
retMI->addImplicitRef(retVReg);
if (retType->isFloatingPoint())
M = (BuildMI(retType==Type::FloatTy? V9::FMOVS : V9::FMOVD, 2)
- .addReg(retVal).addReg(retVReg, MOTy::Def));
+ .addReg(retValToUse).addReg(retVReg, MOTy::Def));
else
M = (BuildMI(ChooseAddInstructionByType(retType), 3)
- .addReg(retVal).addSImm((int64_t) 0)
+ .addReg(retValToUse).addSImm((int64_t) 0)
.addReg(retVReg, MOTy::Def));
// Mark the operand with the register it should be assigned
@@ -1667,8 +1738,26 @@
assert(0 && "VRegList should never be the topmost non-chain rule");
break;
- case 21: // bool: Not(bool,reg): Both these are implemented as:
- case 421: // reg: BNot(reg,reg): reg = reg XOR-NOT 0
+ case 21: // bool: Not(bool,reg): Compute with a conditional-move-on-reg
+ { // First find the unary operand. It may be left or right, usually right.
+ Instruction* notI = subtreeRoot->getInstruction();
+ Value* notArg = BinaryOperator::getNotArgument(
+ cast(subtreeRoot->getInstruction()));
+ unsigned ZeroReg = target.getRegInfo().getZeroRegNum();
+
+ // Unconditionally set register to 0
+ mvec.push_back(BuildMI(V9::SETHI, 2).addZImm(0).addRegDef(notI));
+
+ // Now conditionally move 1 into the register.
+ // Mark the register as a use (as well as a def) because the old
+ // value will be retained if the condition is false.
+ mvec.push_back(BuildMI(V9::MOVRZi, 3).addReg(notArg).addZImm(1)
+ .addReg(notI, MOTy::UseAndDef));
+
+ break;
+ }
+
+ case 421: // reg: BNot(reg,reg): Compute as reg = reg XOR-NOT 0
{ // First find the unary operand. It may be left or right, usually right.
Value* notArg = BinaryOperator::getNotArgument(
cast(subtreeRoot->getInstruction()));
@@ -1678,11 +1767,28 @@
break;
}
+ case 322: // reg: Not(tobool, reg):
+ // Fold CAST-TO-BOOL with NOT by inverting the sense of cast-to-bool
+ foldCase = true;
+ // Just fall through!
+
case 22: // reg: ToBoolTy(reg):
{
- const Type* opType = subtreeRoot->leftChild()->getValue()->getType();
- assert(opType->isIntegral() || isa(opType));
- forwardOperandNum = 0; // forward first operand to user
+ Instruction* castI = subtreeRoot->getInstruction();
+ Value* opVal = subtreeRoot->leftChild()->getValue();
+ assert(opVal->getType()->isIntegral() ||
+ isa(opVal->getType()));
+
+ // Unconditionally set register to 0
+ mvec.push_back(BuildMI(V9::SETHI, 2).addZImm(0).addRegDef(castI));
+
+ // Now conditionally move 1 into the register.
+ // Mark the register as a use (as well as a def) because the old
+ // value will be retained if the condition is false.
+ MachineOpCode opCode = foldCase? V9::MOVRZi : V9::MOVRNZi;
+ mvec.push_back(BuildMI(opCode, 3).addReg(opVal).addZImm(1)
+ .addReg(castI, MOTy::UseAndDef));
+
break;
}
@@ -1692,6 +1798,8 @@
case 26: // reg: ToShortTy(reg)
case 27: // reg: ToUIntTy(reg)
case 28: // reg: ToIntTy(reg)
+ case 29: // reg: ToULongTy(reg)
+ case 30: // reg: ToLongTy(reg)
{
//======================================================================
// Rules for integer conversions:
@@ -1713,64 +1821,87 @@
//
// Since we assume 2s complement representations, this implies:
//
- // -- if operand is smaller than destination, zero-extend or sign-extend
- // according to the signedness of the *operand*: source decides.
- // ==> we have to do nothing here!
- //
- // -- if operand is same size as or larger than destination, and the
- // destination is *unsigned*, zero-extend the operand: dest. decides
- //
- // -- if operand is same size as or larger than destination, and the
- // destination is *signed*, the choice is implementation defined:
- // we sign-extend the operand: i.e., again dest. decides.
- // Note: this matches both Sun's cc and gcc3.2.
+ // -- If operand is smaller than destination, zero-extend or sign-extend
+ // according to the signedness of the *operand*: source decides:
+ // (1) If operand is signed, sign-extend it.
+ // If dest is unsigned, zero-ext the result!
+ // (2) If operand is unsigned, our current invariant is that
+ // it's high bits are correct, so zero-extension is not needed.
+ //
+ // -- If operand is same size as or larger than destination,
+ // zero-extend or sign-extend according to the signedness of
+ // the *destination*: destination decides:
+ // (1) If destination is signed, sign-extend (truncating if needed)
+ // This choice is implementation defined. We sign-extend the
+ // operand, which matches both Sun's cc and gcc3.2.
+ // (2) If destination is unsigned, zero-extend (truncating if needed)
//======================================================================
Instruction* destI = subtreeRoot->getInstruction();
+ Function* currentFunc = destI->getParent()->getParent();
+ MachineCodeForInstruction& mcfi=MachineCodeForInstruction::get(destI);
+
Value* opVal = subtreeRoot->leftChild()->getValue();
const Type* opType = opVal->getType();
- if (opType->isIntegral() || isa(opType)) {
- unsigned opSize = target.getTargetData().getTypeSize(opType);
- unsigned destSize =
- target.getTargetData().getTypeSize(destI->getType());
- if (opSize >= destSize) {
- // Operand is same size as or larger than dest:
- // zero- or sign-extend, according to the signeddness of
- // the destination (see above).
- if (destI->getType()->isSigned())
- target.getInstrInfo().CreateSignExtensionInstructions(target,
- destI->getParent()->getParent(), opVal, destI, 8*destSize,
- mvec, MachineCodeForInstruction::get(destI));
- else
- target.getInstrInfo().CreateZeroExtensionInstructions(target,
- destI->getParent()->getParent(), opVal, destI, 8*destSize,
- mvec, MachineCodeForInstruction::get(destI));
- } else
- forwardOperandNum = 0; // forward first operand to user
+ const Type* destType = destI->getType();
+ unsigned opSize = target.getTargetData().getTypeSize(opType);
+ unsigned destSize = target.getTargetData().getTypeSize(destType);
+
+ bool isIntegral = opType->isIntegral() || isa(opType);
+
+ if (opType == Type::BoolTy ||
+ opType == destType ||
+ isIntegral && opSize == destSize && opSize == 8) {
+ // nothing to do in all these cases
+ forwardOperandNum = 0; // forward first operand to user
+
} else if (opType->isFloatingPoint()) {
- CreateCodeToConvertFloatToInt(target, opVal, destI, mvec,
- MachineCodeForInstruction::get(destI));
+
+ CreateCodeToConvertFloatToInt(target, opVal, destI, mvec, mcfi);
if (destI->getType()->isUnsigned())
maskUnsignedResult = true; // not handled by fp->int code
- } else
- assert(0 && "Unrecognized operand type for convert-to-unsigned");
- break;
- }
+ } else if (isIntegral) {
+
+ bool opSigned = opType->isSigned();
+ bool destSigned = destType->isSigned();
+ unsigned extSourceInBits = 8 * std::min(opSize, destSize);
+
+ assert(! (opSize == destSize && opSigned == destSigned) &&
+ "How can different int types have same size and signedness?");
+
+ bool signExtend = (opSize < destSize && opSigned ||
+ opSize >= destSize && destSigned);
+
+ bool signAndZeroExtend = (opSize < destSize && destSize < 8u &&
+ opSigned && !destSigned);
+ assert(!signAndZeroExtend || signExtend);
+
+ bool zeroExtendOnly = opSize >= destSize && !destSigned;
+ assert(!zeroExtendOnly || !signExtend);
+
+ if (signExtend) {
+ Value* signExtDest = (signAndZeroExtend
+ ? new TmpInstruction(mcfi, destType, opVal)
+ : destI);
+
+ target.getInstrInfo().CreateSignExtensionInstructions
+ (target, currentFunc,opVal,signExtDest,extSourceInBits,mvec,mcfi);
+
+ if (signAndZeroExtend)
+ target.getInstrInfo().CreateZeroExtensionInstructions
+ (target, currentFunc, signExtDest, destI, 8*destSize, mvec, mcfi);
+ }
+ else if (zeroExtendOnly) {
+ target.getInstrInfo().CreateZeroExtensionInstructions
+ (target, currentFunc, opVal, destI, extSourceInBits, mvec, mcfi);
+ }
+ else
+ forwardOperandNum = 0; // forward first operand to user
- case 29: // reg: ToULongTy(reg)
- case 30: // reg: ToLongTy(reg)
- {
- Value* opVal = subtreeRoot->leftChild()->getValue();
- const Type* opType = opVal->getType();
- if (opType->isIntegral() || isa(opType))
- forwardOperandNum = 0; // forward first operand to user
- else if (opType->isFloatingPoint()) {
- Instruction* destI = subtreeRoot->getInstruction();
- CreateCodeToConvertFloatToInt(target, opVal, destI, mvec,
- MachineCodeForInstruction::get(destI));
} else
- assert(0 && "Unrecognized operand type for convert-to-signed");
+ assert(0 && "Unrecognized operand type for convert-to-integer");
+
break;
}
@@ -1914,126 +2045,234 @@
// ELSE FALL THROUGH
case 36: // reg: Div(reg, reg)
+ {
maskUnsignedResult = true;
- Add3OperandInstr(ChooseDivInstruction(target, subtreeRoot),
- subtreeRoot, mvec);
+
+ // If second operand of divide is smaller than 64 bits, we have
+ // to make sure the unused top bits are correct because they affect
+ // the result. These bits are already correct for unsigned values.
+ // They may be incorrect for signed values, so sign extend to fill in.
+ Instruction* divI = subtreeRoot->getInstruction();
+ Value* divOp2 = subtreeRoot->rightChild()->getValue();
+ Value* divOpToUse = divOp2;
+ if (divOp2->getType()->isSigned()) {
+ unsigned opSize=target.getTargetData().getTypeSize(divOp2->getType());
+ if (opSize < 8) {
+ MachineCodeForInstruction& mcfi=MachineCodeForInstruction::get(divI);
+ divOpToUse = new TmpInstruction(mcfi, divOp2);
+ target.getInstrInfo().
+ CreateSignExtensionInstructions(target,
+ divI->getParent()->getParent(),
+ divOp2, divOpToUse,
+ 8*opSize, mvec, mcfi);
+ }
+ }
+
+ mvec.push_back(BuildMI(ChooseDivInstruction(target, subtreeRoot), 3)
+ .addReg(subtreeRoot->leftChild()->getValue())
+ .addReg(divOpToUse)
+ .addRegDef(divI));
+
break;
+ }
case 37: // reg: Rem(reg, reg)
case 237: // reg: Rem(reg, Constant)
{
maskUnsignedResult = true;
- Instruction* remInstr = subtreeRoot->getInstruction();
- MachineCodeForInstruction& mcfi=MachineCodeForInstruction::get(remInstr);
- TmpInstruction* quot = new TmpInstruction(mcfi,
- subtreeRoot->leftChild()->getValue(),
- subtreeRoot->rightChild()->getValue());
- TmpInstruction* prod = new TmpInstruction(mcfi,
- quot,
- subtreeRoot->rightChild()->getValue());
-
- M = BuildMI(ChooseDivInstruction(target, subtreeRoot), 3)
- .addReg(subtreeRoot->leftChild()->getValue())
- .addReg(subtreeRoot->rightChild()->getValue())
- .addRegDef(quot);
- mvec.push_back(M);
+ Instruction* remI = subtreeRoot->getInstruction();
+ Value* divOp1 = subtreeRoot->leftChild()->getValue();
+ Value* divOp2 = subtreeRoot->rightChild()->getValue();
+
+ MachineCodeForInstruction& mcfi = MachineCodeForInstruction::get(remI);
+
+ // If second operand of divide is smaller than 64 bits, we have
+ // to make sure the unused top bits are correct because they affect
+ // the result. These bits are already correct for unsigned values.
+ // They may be incorrect for signed values, so sign extend to fill in.
+ //
+ Value* divOpToUse = divOp2;
+ if (divOp2->getType()->isSigned()) {
+ unsigned opSize=target.getTargetData().getTypeSize(divOp2->getType());
+ if (opSize < 8) {
+ divOpToUse = new TmpInstruction(mcfi, divOp2);
+ target.getInstrInfo().
+ CreateSignExtensionInstructions(target,
+ remI->getParent()->getParent(),
+ divOp2, divOpToUse,
+ 8*opSize, mvec, mcfi);
+ }
+ }
+
+ // Now compute: result = rem V1, V2 as:
+ // result = V1 - (V1 / signExtend(V2)) * signExtend(V2)
+ //
+ TmpInstruction* quot = new TmpInstruction(mcfi, divOp1, divOpToUse);
+ TmpInstruction* prod = new TmpInstruction(mcfi, quot, divOpToUse);
+
+ mvec.push_back(BuildMI(ChooseDivInstruction(target, subtreeRoot), 3)
+ .addReg(divOp1).addReg(divOpToUse).addRegDef(quot));
- unsigned MulOpcode =
- ChooseMulInstructionByType(subtreeRoot->getInstruction()->getType());
- Value *MulRHS = subtreeRoot->rightChild()->getValue();
- M = BuildMI(MulOpcode, 3).addReg(quot).addReg(MulRHS).addReg(prod,
- MOTy::Def);
- mvec.push_back(M);
+ mvec.push_back(BuildMI(ChooseMulInstructionByType(remI->getType()), 3)
+ .addReg(quot).addReg(divOpToUse).addRegDef(prod));
+
+ mvec.push_back(BuildMI(ChooseSubInstructionByType(remI->getType()), 3)
+ .addReg(divOp1).addReg(prod).addRegDef(remI));
- unsigned Opcode = ChooseSubInstructionByType(
- subtreeRoot->getInstruction()->getType());
- M = BuildMI(Opcode, 3).addReg(subtreeRoot->leftChild()->getValue())
- .addReg(prod).addRegDef(subtreeRoot->getValue());
- mvec.push_back(M);
break;
}
case 38: // bool: And(bool, bool)
+ case 138: // bool: And(bool, not)
case 238: // bool: And(bool, boolconst)
case 338: // reg : BAnd(reg, reg)
case 538: // reg : BAnd(reg, Constant)
Add3OperandInstr(V9::ANDr, subtreeRoot, mvec);
break;
- case 138: // bool: And(bool, not)
case 438: // bool: BAnd(bool, bnot)
{ // Use the argument of NOT as the second argument!
// Mark the NOT node so that no code is generated for it.
+ // If the type is boolean, set 1 or 0 in the result register.
InstructionNode* notNode = (InstructionNode*) subtreeRoot->rightChild();
Value* notArg = BinaryOperator::getNotArgument(
cast(notNode->getInstruction()));
notNode->markFoldedIntoParent();
- Value *LHS = subtreeRoot->leftChild()->getValue();
- Value *Dest = subtreeRoot->getValue();
- mvec.push_back(BuildMI(V9::ANDNr, 3).addReg(LHS).addReg(notArg)
- .addReg(Dest, MOTy::Def));
+ Value *lhs = subtreeRoot->leftChild()->getValue();
+ Value *dest = subtreeRoot->getValue();
+ mvec.push_back(BuildMI(V9::ANDNr, 3).addReg(lhs).addReg(notArg)
+ .addReg(dest, MOTy::Def));
+
+ if (notArg->getType() == Type::BoolTy)
+ { // set 1 in result register if result of above is non-zero
+ mvec.push_back(BuildMI(V9::MOVRNZi, 3).addReg(dest).addZImm(1)
+ .addReg(dest, MOTy::UseAndDef));
+ }
+
break;
}
case 39: // bool: Or(bool, bool)
+ case 139: // bool: Or(bool, not)
case 239: // bool: Or(bool, boolconst)
case 339: // reg : BOr(reg, reg)
case 539: // reg : BOr(reg, Constant)
Add3OperandInstr(V9::ORr, subtreeRoot, mvec);
break;
- case 139: // bool: Or(bool, not)
case 439: // bool: BOr(bool, bnot)
{ // Use the argument of NOT as the second argument!
// Mark the NOT node so that no code is generated for it.
+ // If the type is boolean, set 1 or 0 in the result register.
InstructionNode* notNode = (InstructionNode*) subtreeRoot->rightChild();
Value* notArg = BinaryOperator::getNotArgument(
cast(notNode->getInstruction()));
notNode->markFoldedIntoParent();
- Value *LHS = subtreeRoot->leftChild()->getValue();
- Value *Dest = subtreeRoot->getValue();
- mvec.push_back(BuildMI(V9::ORNr, 3).addReg(LHS).addReg(notArg)
- .addReg(Dest, MOTy::Def));
+ Value *lhs = subtreeRoot->leftChild()->getValue();
+ Value *dest = subtreeRoot->getValue();
+
+ mvec.push_back(BuildMI(V9::ORNr, 3).addReg(lhs).addReg(notArg)
+ .addReg(dest, MOTy::Def));
+
+ if (notArg->getType() == Type::BoolTy)
+ { // set 1 in result register if result of above is non-zero
+ mvec.push_back(BuildMI(V9::MOVRNZi, 3).addReg(dest).addZImm(1)
+ .addReg(dest, MOTy::UseAndDef));
+ }
+
break;
}
case 40: // bool: Xor(bool, bool)
+ case 140: // bool: Xor(bool, not)
case 240: // bool: Xor(bool, boolconst)
case 340: // reg : BXor(reg, reg)
case 540: // reg : BXor(reg, Constant)
Add3OperandInstr(V9::XORr, subtreeRoot, mvec);
break;
- case 140: // bool: Xor(bool, not)
case 440: // bool: BXor(bool, bnot)
{ // Use the argument of NOT as the second argument!
// Mark the NOT node so that no code is generated for it.
+ // If the type is boolean, set 1 or 0 in the result register.
InstructionNode* notNode = (InstructionNode*) subtreeRoot->rightChild();
Value* notArg = BinaryOperator::getNotArgument(
cast(notNode->getInstruction()));
notNode->markFoldedIntoParent();
- Value *LHS = subtreeRoot->leftChild()->getValue();
- Value *Dest = subtreeRoot->getValue();
- mvec.push_back(BuildMI(V9::XNORr, 3).addReg(LHS).addReg(notArg)
- .addReg(Dest, MOTy::Def));
+ Value *lhs = subtreeRoot->leftChild()->getValue();
+ Value *dest = subtreeRoot->getValue();
+ mvec.push_back(BuildMI(V9::XNORr, 3).addReg(lhs).addReg(notArg)
+ .addReg(dest, MOTy::Def));
+
+ if (notArg->getType() == Type::BoolTy)
+ { // set 1 in result register if result of above is non-zero
+ mvec.push_back(BuildMI(V9::MOVRNZi, 3).addReg(dest).addZImm(1)
+ .addReg(dest, MOTy::UseAndDef));
+ }
break;
}
- case 41: // boolconst: SetCC(reg, Constant)
+ case 41: // setCCconst: SetCC(reg, Constant)
+ { // Comparison is with a constant:
//
- // If the SetCC was folded into the user (parent), it will be
- // caught above. All other cases are the same as case 42,
- // so just fall through.
+ // If the bool result must be computed into a register (see below),
+ // and the constant is int ZERO, we can use the MOVR[op] instructions
+ // and avoid the SUBcc instruction entirely.
+ // Otherwise this is just the same as case 42, so just fall through.
//
+ // The result of the SetCC must be computed and stored in a register if
+ // it is used outside the current basic block (so it must be computed
+ // as a boolreg) or it is used by anything other than a branch.
+ // We will use a conditional move to do this.
+ //
+ Instruction* setCCInstr = subtreeRoot->getInstruction();
+ bool computeBoolVal = (subtreeRoot->parent() == NULL ||
+ ! AllUsesAreBranches(setCCInstr));
+
+ if (computeBoolVal)
+ {
+ InstrTreeNode* constNode = subtreeRoot->rightChild();
+ assert(constNode &&
+ constNode->getNodeType() ==InstrTreeNode::NTConstNode);
+ Constant *constVal = cast(constNode->getValue());
+ bool isValidConst;
+
+ if ((constVal->getType()->isInteger()
+ || isa(constVal->getType()))
+ && GetConstantValueAsSignedInt(constVal, isValidConst) == 0
+ && isValidConst)
+ {
+ // That constant is an integer zero after all...
+ // Use a MOVR[op] to compute the boolean result
+ // Unconditionally set register to 0
+ mvec.push_back(BuildMI(V9::SETHI, 2).addZImm(0)
+ .addRegDef(setCCInstr));
+
+ // Now conditionally move 1 into the register.
+ // Mark the register as a use (as well as a def) because the old
+ // value will be retained if the condition is false.
+ MachineOpCode movOpCode = ChooseMovpregiForSetCC(subtreeRoot);
+ mvec.push_back(BuildMI(movOpCode, 3)
+ .addReg(subtreeRoot->leftChild()->getValue())
+ .addZImm(1).addReg(setCCInstr, MOTy::UseAndDef));
+
+ break;
+ }
+ }
+ // ELSE FALL THROUGH
+ }
+
case 42: // bool: SetCC(reg, reg):
{
// This generates a SUBCC instruction, putting the difference in a
// result reg. if needed, and/or setting a condition code if needed.
//
Instruction* setCCInstr = subtreeRoot->getInstruction();
- Value* leftVal = subtreeRoot->leftChild()->getValue();
- bool isFPCompare = leftVal->getType()->isFloatingPoint();
+ Value* leftVal = subtreeRoot->leftChild()->getValue();
+ Value* rightVal = subtreeRoot->rightChild()->getValue();
+ const Type* opType = leftVal->getType();
+ bool isFPCompare = opType->isFloatingPoint();
// If the boolean result of the SetCC is used outside the current basic
// block (so it must be computed as a boolreg) or is used by anything
@@ -2058,26 +2297,52 @@
setCCInstr->getParent()->getParent(),
leftVal->getType(),
MachineCodeForInstruction::get(setCCInstr));
+
+ // If the operands are signed values smaller than 4 bytes, then they
+ // must be sign-extended in order to do a valid 32-bit comparison
+ // and get the right result in the 32-bit CC register (%icc).
+ //
+ Value* leftOpToUse = leftVal;
+ Value* rightOpToUse = rightVal;
+ if (opType->isIntegral() && opType->isSigned()) {
+ unsigned opSize = target.getTargetData().getTypeSize(opType);
+ if (opSize < 4) {
+ MachineCodeForInstruction& mcfi =
+ MachineCodeForInstruction::get(setCCInstr);
+
+ // create temporary virtual regs. to hold the sign-extensions
+ leftOpToUse = new TmpInstruction(mcfi, leftVal);
+ rightOpToUse = new TmpInstruction(mcfi, rightVal);
+
+ // sign-extend each operand and put the result in the temporary reg.
+ target.getInstrInfo().CreateSignExtensionInstructions
+ (target, setCCInstr->getParent()->getParent(),
+ leftVal, leftOpToUse, 8*opSize, mvec, mcfi);
+ target.getInstrInfo().CreateSignExtensionInstructions
+ (target, setCCInstr->getParent()->getParent(),
+ rightVal, rightOpToUse, 8*opSize, mvec, mcfi);
+ }
+ }
+
if (! isFPCompare) {
// Integer condition: set CC and discard result.
- M = BuildMI(V9::SUBccr, 4)
- .addReg(subtreeRoot->leftChild()->getValue())
- .addReg(subtreeRoot->rightChild()->getValue())
- .addMReg(target.getRegInfo().getZeroRegNum(), MOTy::Def)
- .addCCReg(tmpForCC, MOTy::Def);
+ mvec.push_back(BuildMI(V9::SUBccr, 4)
+ .addReg(leftOpToUse)
+ .addReg(rightOpToUse)
+ .addMReg(target.getRegInfo().getZeroRegNum(),MOTy::Def)
+ .addCCReg(tmpForCC, MOTy::Def));
} else {
// FP condition: dest of FCMP should be some FCCn register
- M = BuildMI(ChooseFcmpInstruction(subtreeRoot), 3)
- .addCCReg(tmpForCC, MOTy::Def)
- .addReg(subtreeRoot->leftChild()->getValue())
- .addReg(subtreeRoot->rightChild()->getValue());
+ mvec.push_back(BuildMI(ChooseFcmpInstruction(subtreeRoot), 3)
+ .addCCReg(tmpForCC, MOTy::Def)
+ .addReg(leftOpToUse)
+ .addReg(rightOpToUse));
}
- mvec.push_back(M);
if (computeBoolVal) {
MachineOpCode movOpCode = (isFPCompare
? ChooseMovFpcciInstruction(subtreeRoot)
- : ChooseMovpcciAfterSub(subtreeRoot));
+ : ChooseMovpcciForSetCC(subtreeRoot));
// Unconditionally set register to 0
M = BuildMI(V9::SETHI, 2).addZImm(0).addRegDef(setCCInstr);
@@ -2172,8 +2437,8 @@
// This can also handle any intrinsics that are just function calls.
//
if (! specialIntrinsic) {
- MachineFunction& MF =
- MachineFunction::get(callInstr->getParent()->getParent());
+ Function* currentFunc = callInstr->getParent()->getParent();
+ MachineFunction& MF = MachineFunction::get(currentFunc);
MachineCodeForInstruction& mcfi =
MachineCodeForInstruction::get(callInstr);
const UltraSparcRegInfo& regInfo =
@@ -2211,19 +2476,45 @@
new CallArgsDescriptor(callInstr, retAddrReg,isVarArgs,noPrototype);
assert(callInstr->getOperand(0) == callee
&& "This is assumed in the loop below!");
-
+
+ // Insert sign-extension instructions for small signed values,
+ // if this is an unknown function (i.e., called via a funcptr)
+ // or an external one (i.e., which may not be compiled by llc).
+ //
+ if (calledFunc == NULL || calledFunc->isExternal()) {
+ for (unsigned i=1, N=callInstr->getNumOperands(); i < N; ++i) {
+ Value* argVal = callInstr->getOperand(i);
+ const Type* argType = argVal->getType();
+ if (argType->isIntegral() && argType->isSigned()) {
+ unsigned argSize = target.getTargetData().getTypeSize(argType);
+ if (argSize <= 4) {
+ // create a temporary virtual reg. to hold the sign-extension
+ TmpInstruction* argExtend = new TmpInstruction(mcfi, argVal);
+
+ // sign-extend argVal and put the result in the temporary reg.
+ target.getInstrInfo().CreateSignExtensionInstructions
+ (target, currentFunc, argVal, argExtend,
+ 8*argSize, mvec, mcfi);
+
+ // replace argVal with argExtend in CallArgsDescriptor
+ argDesc->getArgInfo(i-1).replaceArgVal(argExtend);
+ }
+ }
+ }
+ }
+
// Insert copy instructions to get all the arguments into
// all the places that they need to be.
//
for (unsigned i=1, N=callInstr->getNumOperands(); i < N; ++i) {
int argNo = i-1;
- Value* argVal = callInstr->getOperand(i);
+ CallArgInfo& argInfo = argDesc->getArgInfo(argNo);
+ Value* argVal = argInfo.getArgVal(); // don't use callInstr arg here
const Type* argType = argVal->getType();
unsigned regType = regInfo.getRegType(argType);
unsigned argSize = target.getTargetData().getTypeSize(argType);
int regNumForArg = TargetRegInfo::getInvalidRegNum();
unsigned regClassIDOfArgReg;
- CallArgInfo& argInfo = argDesc->getArgInfo(argNo);
// Check for FP arguments to varargs functions.
// Any such argument in the first $K$ args must be passed in an
@@ -2346,7 +2637,7 @@
new TmpInstruction(mcfi, argVal, NULL, "argReg");
callMI->addImplicitRef(argVReg);
-
+
// Generate the reg-to-reg copy into the outgoing arg reg.
// -- For FP values, create a FMOVS or FMOVD instruction
// -- For non-FP values, create an add-with-0 instruction
@@ -2357,7 +2648,7 @@
M = (BuildMI(ChooseAddInstructionByType(argType), 3)
.addReg(argVal).addSImm((int64_t) 0)
.addReg(argVReg, MOTy::Def));
-
+
// Mark the operand with the register it should be assigned
M->SetRegForOperand(M->getNumOperands()-1, regNumForArg);
callMI->SetRegForImplicitRef(callMI->getNumImplicitRefs()-1,
@@ -2505,20 +2796,43 @@
if (dest->getType()->isUnsigned()) {
unsigned destSize=target.getTargetData().getTypeSize(dest->getType());
if (destSize <= 4) {
- // Mask high bits. Use a TmpInstruction to represent the
+ // Mask high 64 - N bits, where N = 4*destSize.
+
+ // Use a TmpInstruction to represent the
// intermediate result before masking. Since those instructions
// have already been generated, go back and substitute tmpI
// for dest in the result position of each one of them.
- TmpInstruction *tmpI =
- new TmpInstruction(MachineCodeForInstruction::get(dest),
- dest->getType(), dest, NULL, "maskHi");
+ //
+ MachineCodeForInstruction& mcfi = MachineCodeForInstruction::get(dest);
+ TmpInstruction *tmpI = new TmpInstruction(mcfi, dest->getType(),
+ dest, NULL, "maskHi");
+ Value* srlArgToUse = tmpI;
+
+ unsigned numSubst = 0;
+ for (unsigned i=0, N=mvec.size(); i < N; ++i) {
+ bool someArgsWereIgnored = false;
+ numSubst += mvec[i]->substituteValue(dest, tmpI, /*defsOnly*/ true,
+ /*defsAndUses*/ false,
+ someArgsWereIgnored);
+ assert(!someArgsWereIgnored &&
+ "Operand `dest' exists but not replaced: probably bogus!");
+ }
+ assert(numSubst > 0 && "Operand `dest' not replaced: probably bogus!");
+
+ // Left shift 32-N if size (N) is less than 32 bits.
+ // Use another tmp. virtual registe to represent this result.
+ if (destSize < 4) {
+ srlArgToUse = new TmpInstruction(mcfi, dest->getType(),
+ tmpI, NULL, "maskHi2");
+ mvec.push_back(BuildMI(V9::SLLXi6, 3).addReg(tmpI)
+ .addZImm(8*(4-destSize))
+ .addReg(srlArgToUse, MOTy::Def));
+ }
- for (unsigned i=0, N=mvec.size(); i < N; ++i)
- mvec[i]->substituteValue(dest, tmpI);
+ // Logical right shift 32-N to get zero extension in top 64-N bits.
+ mvec.push_back(BuildMI(V9::SRLi5, 3).addReg(srlArgToUse)
+ .addZImm(8*(4-destSize)).addReg(dest, MOTy::Def));
- M = BuildMI(V9::SRLi5, 3).addReg(tmpI).addZImm(8*(4-destSize))
- .addReg(dest, MOTy::Def);
- mvec.push_back(M);
} else if (destSize < 8) {
assert(0 && "Unsupported type size: 32 < size < 64 bits");
}
From brukman at cs.uiuc.edu Thu Jul 10 16:39:01 2003
From: brukman at cs.uiuc.edu (Misha Brukman)
Date: Thu Jul 10 16:39:01 2003
Subject: [llvm-commits] CVS: llvm/lib/Support/CommandLine.cpp
Message-ID: <200307102138.QAA02584@zion.cs.uiuc.edu>
Changes in directory llvm/lib/Support:
CommandLine.cpp updated: 1.32 -> 1.33
---
Log message:
Fixed grammatical error.
---
Diffs of the changes:
Index: llvm/lib/Support/CommandLine.cpp
diff -u llvm/lib/Support/CommandLine.cpp:1.32 llvm/lib/Support/CommandLine.cpp:1.33
--- llvm/lib/Support/CommandLine.cpp:1.32 Thu Jul 10 12:05:26 2003
+++ llvm/lib/Support/CommandLine.cpp Thu Jul 10 16:38:28 2003
@@ -216,7 +216,7 @@
// Check to see if this is a positional argument. This argument is
// considered to be positional if it doesn't start with '-', if it is "-"
- // itself, or if we have see "--" already.
+ // itself, or if we have seen "--" already.
//
if (argv[i][0] != '-' || argv[i][1] == 0 || DashDashFound) {
// Positional argument!
From ashukla at cs.uiuc.edu Thu Jul 10 16:57:01 2003
From: ashukla at cs.uiuc.edu (Anand Shukla)
Date: Thu Jul 10 16:57:01 2003
Subject: [llvm-commits] CVS: llvm/lib/Reoptimizer/LightWtProfiling/Instrument/InstLoops.cpp
Message-ID: <200307102156.QAA07418@niobe.cs.uiuc.edu>
Changes in directory llvm/lib/Reoptimizer/LightWtProfiling/Instrument:
InstLoops.cpp updated: 1.3 -> 1.4
---
Log message:
Added functionality to instrmentation pass
---
Diffs of the changes:
Index: llvm/lib/Reoptimizer/LightWtProfiling/Instrument/InstLoops.cpp
diff -u llvm/lib/Reoptimizer/LightWtProfiling/Instrument/InstLoops.cpp:1.3 llvm/lib/Reoptimizer/LightWtProfiling/Instrument/InstLoops.cpp:1.4
--- llvm/lib/Reoptimizer/LightWtProfiling/Instrument/InstLoops.cpp:1.3 Wed Apr 23 11:37:36 2003
+++ llvm/lib/Reoptimizer/LightWtProfiling/Instrument/InstLoops.cpp Thu Jul 10 16:55:57 2003
@@ -5,6 +5,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/Reoptimizer/InstLoops.h"
+#include "llvm/Analysis/Dominators.h"
#include "llvm/Support/CFG.h"
#include "llvm/Constants.h"
#include "llvm/iMemory.h"
@@ -27,11 +28,26 @@
BLACK
};
-struct InstLoops : public FunctionPass {
- bool runOnFunction(Function &F);
-};
-
-static RegisterOpt X("instloops", "Instrument backedges for profiling");
+namespace{
+ struct InstLoops : public FunctionPass {
+ virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+ AU.addRequired();
+ }
+ private:
+ DominatorSet *DS;
+ void getBackEdgesVisit(BasicBlock *u,
+ std::map &color,
+ std::map &d,
+ int &time, Value *threshold,
+ std::map &be);
+ void removeRedundant(std::map &be);
+ void getBackEdges(Function &F, Value *threshold);
+ public:
+ bool runOnFunction(Function &F);
+ };
+
+ RegisterOpt X("instloops", "Instrument backedges for profiling");
+}
// createInstLoopsPass - Create a new pass to add path profiling
//
@@ -42,10 +58,11 @@
//helper function to get back edges: it is called by
//the "getBackEdges" function below
-void getBackEdgesVisit(BasicBlock *u,
+void InstLoops::getBackEdgesVisit(BasicBlock *u,
std::map &color,
std::map &d,
- int &time, Value *threshold) {
+ int &time, Value *threshold,
+ std::map &be) {
color[u]=GREY;
time++;
@@ -57,98 +74,44 @@
BasicBlock *BB = *vl;
if(color[BB]!=GREY && color[BB]!=BLACK){
- getBackEdgesVisit(BB, color, d, time, threshold);
+ getBackEdgesVisit(BB, color, d, time, threshold, be);
}
//now checking for d and f vals
- if(color[BB]==GREY){
+ else if(color[BB]==GREY){
//so v is ancestor of u if time of u > time of v
if(d[u] >= d[BB]){
- //insert a new basic block: modify terminator accordingly!
- BasicBlock *newBB = new BasicBlock("", u->getParent());
- BranchInst *ti = cast(u->getTerminator());
- unsigned char index = 1;
- if(ti->getSuccessor(0) == BB){
- index = 0;
- }
- assert(ti->getNumSuccessors() > index && "Not enough successors!");
- ti->setSuccessor(index, newBB);
-
- //insert global variable of type int
- Constant *initializer = Constant::getNullValue(Type::IntTy);
- GlobalVariable *countVar = new GlobalVariable(Type::IntTy, false, true,
- initializer,
- "loopCounter",
- u->getParent()->getParent());
-
- //load the variable
- Instruction *ldInst = new LoadInst(countVar,"");
-
- //increment
- Instruction *addIn =
- BinaryOperator::create(Instruction::Add, ldInst,
- ConstantSInt::get(Type::IntTy,1), "");
-
- //store
- Instruction *stInst = new StoreInst(addIn, countVar);
-
-
- Instruction *etr = new LoadInst(threshold, "threshold");
- Instruction *cmpInst = new SetCondInst(Instruction::SetLE, etr,
- addIn, "");
-
- BasicBlock *callTrigger = new BasicBlock("", u->getParent());
- //branch to calltrigger, or *vl
- Instruction *newBr = new BranchInst(callTrigger, BB, cmpInst);
-
- BasicBlock::InstListType < = newBB->getInstList();
-
- lt.push_back(ldInst);
- lt.push_back(addIn);
- lt.push_back(stInst);
- lt.push_back(etr);
- lt.push_back(cmpInst);
- lt.push_back(newBr);
-
- //Now add instructions to the triggerCall BB
- //now create a call function
- //call llvm_first_trigger(int *x);
- std::vector inCountArgs;
- inCountArgs.push_back(PointerType::get(Type::IntTy));
-
- const FunctionType *cFty = FunctionType::get(Type::VoidTy, inCountArgs,
- false);
- Function *inCountMth =
- u->getParent()->getParent()->getOrInsertFunction("llvm_first_trigger", cFty);
-
- assert(inCountMth && "Initialize method could not be inserted!");
-
- std::vector iniArgs;
- iniArgs.push_back(countVar);
- Instruction *call = new CallInst(inCountMth, iniArgs, "");
- callTrigger->getInstList().push_back(call);
- callTrigger->getInstList().push_back(new BranchInst(BB));
-
- //now iterate over *vl, and set its Phi nodes right
- for(BasicBlock::iterator BB2Inst = BB->begin(), BBend = BB->end();
- BB2Inst != BBend; ++BB2Inst){
-
- if (PHINode *phiInst = dyn_cast(BB2Inst)){
- int bbIndex = phiInst->getBasicBlockIndex(u);
- if(bbIndex>=0){
- phiInst->setIncomingBlock(bbIndex, newBB);
-
- Value *val = phiInst->getIncomingValue((unsigned int)bbIndex);
- phiInst->addIncoming(val, callTrigger);
- }
- }
- }
+ //u->BB is a backedge
+ be[u] = BB;
}
}
}
color[u]=BLACK;//done with visiting the node and its neighbors
}
+//look at all BEs, and remove all BEs that are dominated by other BE's in the
+//set
+void InstLoops::removeRedundant(std::map &be){
+ std::vector toDelete;
+ for(std::map::iterator MI = be.begin(),
+ ME = be.end(); MI != ME; ++MI){
+ //std::cerr<first->getName()<<"\t->\t"<second->getName()<<"\n";
+ //std::cerr<first;
+ //std::cerr<second;
+ for(std::map::iterator MMI = be.begin(),
+ MME = be.end(); MMI != MME; ++MMI){
+ if(DS->properlyDominates(MI->first, MMI->first)){
+ toDelete.push_back(MMI->first);
+ //std::cerr<first->getName()<<"\t Dominates\t"<first->getName();
+ }
+ }
+ }
+
+ for(std::vector::iterator VI = toDelete.begin(),
+ VE = toDelete.end(); VI != VE; ++VI){
+ be.erase(*VI);
+ }
+}
//getting the backedges in a graph
//Its a variation of DFS to get the backedges in the graph
@@ -161,11 +124,57 @@
//have been visited
//So we have a back edge when we meet a successor of
//a node with smaller time, and GREY color
-void getBackEdges(Function &F, Value *threshold){
+void InstLoops::getBackEdges(Function &F, Value *threshold){
std::map color;
std::map d;
+ std::map be;
int time=0;
- getBackEdgesVisit(F.begin(), color, d, time, threshold);
+ getBackEdgesVisit(F.begin(), color, d, time, threshold, be);
+
+ removeRedundant(be);
+
+ for(std::map::iterator MI = be.begin(),
+ ME = be.end(); MI != ME; ++MI){
+ BasicBlock *u = MI->first;
+ BasicBlock *BB = MI->second;
+ //std::cerr<<"Edge from: "<getName()<<"->"<getName()<<"\n";
+ //insert a new basic block: modify terminator accordingly!
+ BasicBlock *newBB = new BasicBlock("", u->getParent());
+ BranchInst *ti = cast(u->getTerminator());
+ unsigned char index = 1;
+ if(ti->getSuccessor(0) == BB){
+ index = 0;
+ }
+ assert(ti->getNumSuccessors() > index && "Not enough successors!");
+ ti->setSuccessor(index, newBB);
+
+ BasicBlock::InstListType < = newBB->getInstList();
+
+ std::vector inCountArgs;
+ const FunctionType *cFty = FunctionType::get(Type::VoidTy, inCountArgs,
+ false);
+ Function *inCountMth =
+ u->getParent()->getParent()->getOrInsertFunction("llvm_first_trigger",
+ cFty);
+
+ assert(inCountMth && "Initial method could not be inserted!");
+
+ Instruction *call = new CallInst(inCountMth, "");
+ lt.push_back(call);
+ lt.push_back(new BranchInst(BB));
+
+ //now iterate over *vl, and set its Phi nodes right
+ for(BasicBlock::iterator BB2Inst = BB->begin(), BBend = BB->end();
+ BB2Inst != BBend; ++BB2Inst){
+
+ if (PHINode *phiInst = dyn_cast(BB2Inst)){
+ int bbIndex = phiInst->getBasicBlockIndex(u);
+ if(bbIndex>=0){
+ phiInst->setIncomingBlock(bbIndex, newBB);
+ }
+ }
+ }
+ }
}
//Per function pass for inserting counters and call function
@@ -173,11 +182,18 @@
static GlobalVariable *threshold = NULL;
static bool insertedThreshold = false;
-
- if(!insertedThreshold){
- threshold = new GlobalVariable(Type::IntTy, false, false, 0,
- "reopt_threshold");
+ DS = &getAnalysis();
+
+ if(F.isExternal()) {
+ return false;
+ }
+
+ if(!insertedThreshold){
+ threshold = new GlobalVariable(Type::IntTy, false,
+ GlobalValue::ExternalLinkage, 0,
+ "reopt_threshold");
+
F.getParent()->getGlobalList().push_back(threshold);
insertedThreshold = true;
}
@@ -199,11 +215,7 @@
}
assert(threshold && "GlobalVariable threshold not defined!");
-
- if(F.isExternal()) {
- return false;
- }
-
+
getBackEdges(F, threshold);
return true;
From criswell at cs.uiuc.edu Thu Jul 10 17:27:01 2003
From: criswell at cs.uiuc.edu (John Criswell)
Date: Thu Jul 10 17:27:01 2003
Subject: [llvm-commits] CVS: llvm/Makefile.common
Message-ID: <200307102226.RAA14464@trinity.cs.uiuc.edu>
Changes in directory llvm:
Makefile.common updated: 1.96 -> 1.96.2.1
---
Log message:
Modified the rules for building shared objects such that they are built
directly with GCC.
Dynamic objects built with libtool do not call the constructors of global
objects like they should, causing them to be unusable with programs like opt.
---
Diffs of the changes:
Index: llvm/Makefile.common
diff -u llvm/Makefile.common:1.96 llvm/Makefile.common:1.96.2.1
--- llvm/Makefile.common:1.96 Tue Jul 1 09:52:28 2003
+++ llvm/Makefile.common Thu Jul 10 17:26:17 2003
@@ -395,6 +395,11 @@
ObjectsP := $(addprefix $(BUILD_OBJ_DIR)/Profile/,$(Objs))
ObjectsG := $(addprefix $(BUILD_OBJ_DIR)/Debug/,$(Objs))
+RealObjs := $(sort $(patsubst Debug/%.o, %.o, $(addsuffix .o,$(notdir $(basename $(Source))))))
+RealObjectsO := $(addprefix $(BUILD_OBJ_DIR)/Release/,$(RealObjs))
+RealObjectsP := $(addprefix $(BUILD_OBJ_DIR)/Profile/,$(RealObjs))
+RealObjectsG := $(addprefix $(BUILD_OBJ_DIR)/Debug/,$(RealObjs))
+
#---------------------------------------------------------
# Handle the DIRS and PARALLEL_DIRS options
#---------------------------------------------------------
@@ -489,20 +494,17 @@
#
# Rules for building dynamically linked libraries.
#
-$(LIBNAME_O): $(ObjectsO) $(LibSubDirs) $(DESTLIBRELEASE)/.dir
+$(LIBNAME_O): $(RealObjectsO) $(LibSubDirs) $(DESTLIBRELEASE)/.dir
@echo ======= Linking $(LIBRARYNAME) dynamic release library =======
- $(VERB) $(Link) -o $*.la $(ObjectsO) $(LibSubDirs) $(LibLinkOpts);
- $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $*.la $(DESTLIBCURRENT);
+ $(VERB) $(CXX) -G -o $@ $(RealObjectsO) $(LibSubDirs) $(LibLinkOpts);
$(LIBNAME_P): $(ObjectsP) $(LibSubDirs) $(DESTLIBPROFILE)/.dir
@echo ======= Linking $(LIBRARYNAME) dynamic profile library =======
- $(VERB) $(Link) -o $*.la $(ObjectsP) $(LibSubDirs) $(LibLinkOpts);
- $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $*.la $(DESTLIBCURRENT);
+ $(VERB) $(CXX) -G -o $@ $(RealObjectsP) $(LibSubDirs) $(LibLinkOpts);
$(LIBNAME_G): $(ObjectsG) $(LibSubDirs) $(DESTLIBDEBUG)/.dir
@echo ======= Linking $(LIBRARYNAME) dynamic debug library =======
- $(VERB) $(Link) -o $*.la $(ObjectsG) $(LibSubDirs) $(LibLinkOpts);
- $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $*.la $(DESTLIBCURRENT);
+ $(VERB) $(CXX) -G -o $@ $(RealObjectsG) $(LibSubDirs) $(LibLinkOpts);
#
# Rules for building static archive libraries.
From brukman at cs.uiuc.edu Thu Jul 10 17:35:01 2003
From: brukman at cs.uiuc.edu (Misha Brukman)
Date: Thu Jul 10 17:35:01 2003
Subject: [llvm-commits] CVS: llvm/test/Programs/SingleSource/Shootout/random.c
Message-ID: <200307102234.RAA07134@zion.cs.uiuc.edu>
Changes in directory llvm/test/Programs/SingleSource/Shootout:
random.c updated: 1.2 -> 1.3
---
Log message:
Converted tabs to spaces, lined things up better.
---
Diffs of the changes:
Index: llvm/test/Programs/SingleSource/Shootout/random.c
diff -u llvm/test/Programs/SingleSource/Shootout/random.c:1.2 llvm/test/Programs/SingleSource/Shootout/random.c:1.3
--- llvm/test/Programs/SingleSource/Shootout/random.c:1.2 Sun Aug 25 11:48:03 2002
+++ llvm/test/Programs/SingleSource/Shootout/random.c Thu Jul 10 17:34:14 2003
@@ -1,5 +1,5 @@
/* -*- mode: c -*-
- * $Id: random.c,v 1.2 2002/08/25 16:48:03 vadve Exp $
+ * $Id: random.c,v 1.3 2003/07/10 22:34:14 brukman Exp $
* http://www.bagley.org/~doug/shootout/
*/
@@ -14,18 +14,18 @@
#define IC 29573
inline double gen_random(double max) {
- static long last = 42;
+ static long last = 42;
- last = (last * IA + IC) % IM;
- return( max * last / IM );
+ last = (last * IA + IC) % IM;
+ return( max * last / IM );
}
int main(int argc, char *argv[]) {
- int N = ((argc == 2) ? atoi(argv[1]) : 1) - 1;
+ int N = ((argc == 2) ? atoi(argv[1]) : 1) - 1;
- while (N--) {
- gen_random(100.0);
- }
- printf("%.9f\n", gen_random(100.0));
- return(0);
+ while (N--) {
+ gen_random(100.0);
+ }
+ printf("%.9f\n", gen_random(100.0));
+ return(0);
}
From criswell at cs.uiuc.edu Thu Jul 10 17:41:01 2003
From: criswell at cs.uiuc.edu (John Criswell)
Date: Thu Jul 10 17:41:01 2003
Subject: [llvm-commits] CVS: llvm/Makefile.common
Message-ID: <200307102240.RAA15033@trinity.cs.uiuc.edu>
Changes in directory llvm:
Makefile.common updated: 1.96.2.1 -> 1.96.2.2
---
Log message:
Changed -G to -shared to be compatible with other platforms.
---
Diffs of the changes:
Index: llvm/Makefile.common
diff -u llvm/Makefile.common:1.96.2.1 llvm/Makefile.common:1.96.2.2
--- llvm/Makefile.common:1.96.2.1 Thu Jul 10 17:26:17 2003
+++ llvm/Makefile.common Thu Jul 10 17:40:38 2003
@@ -496,15 +496,15 @@
#
$(LIBNAME_O): $(RealObjectsO) $(LibSubDirs) $(DESTLIBRELEASE)/.dir
@echo ======= Linking $(LIBRARYNAME) dynamic release library =======
- $(VERB) $(CXX) -G -o $@ $(RealObjectsO) $(LibSubDirs) $(LibLinkOpts);
+ $(VERB) $(CXX) -shared -o $@ $(RealObjectsO) $(LibSubDirs) $(LibLinkOpts);
$(LIBNAME_P): $(ObjectsP) $(LibSubDirs) $(DESTLIBPROFILE)/.dir
@echo ======= Linking $(LIBRARYNAME) dynamic profile library =======
- $(VERB) $(CXX) -G -o $@ $(RealObjectsP) $(LibSubDirs) $(LibLinkOpts);
+ $(VERB) $(CXX) -shared -o $@ $(RealObjectsP) $(LibSubDirs) $(LibLinkOpts);
$(LIBNAME_G): $(ObjectsG) $(LibSubDirs) $(DESTLIBDEBUG)/.dir
@echo ======= Linking $(LIBRARYNAME) dynamic debug library =======
- $(VERB) $(CXX) -G -o $@ $(RealObjectsG) $(LibSubDirs) $(LibLinkOpts);
+ $(VERB) $(CXX) -shared -o $@ $(RealObjectsG) $(LibSubDirs) $(LibLinkOpts);
#
# Rules for building static archive libraries.
From criswell at cs.uiuc.edu Thu Jul 10 17:57:01 2003
From: criswell at cs.uiuc.edu (John Criswell)
Date: Thu Jul 10 17:57:01 2003
Subject: [llvm-commits] CVS: llvm/Makefile.common
Message-ID: <200307102256.RAA16227@trinity.cs.uiuc.edu>
Changes in directory llvm:
Makefile.common updated: 1.96.2.2 -> 1.96.2.3
---
Log message:
Fixed it to work on both Sparc and Linux.
---
Diffs of the changes:
Index: llvm/Makefile.common
diff -u llvm/Makefile.common:1.96.2.2 llvm/Makefile.common:1.96.2.3
--- llvm/Makefile.common:1.96.2.2 Thu Jul 10 17:40:38 2003
+++ llvm/Makefile.common Thu Jul 10 17:56:09 2003
@@ -491,20 +491,26 @@
# Rules for building libraries
#--------------------------------------------------------------------
+ifeq ($(OS),SunOS)
+Share=-G
+else
+Share=-shared
+endif
+
#
# Rules for building dynamically linked libraries.
#
$(LIBNAME_O): $(RealObjectsO) $(LibSubDirs) $(DESTLIBRELEASE)/.dir
@echo ======= Linking $(LIBRARYNAME) dynamic release library =======
- $(VERB) $(CXX) -shared -o $@ $(RealObjectsO) $(LibSubDirs) $(LibLinkOpts);
+ $(VERB) $(CXX) $(Share) -o $@ $(RealObjectsO) $(LibSubDirs) $(LibLinkOpts);
$(LIBNAME_P): $(ObjectsP) $(LibSubDirs) $(DESTLIBPROFILE)/.dir
@echo ======= Linking $(LIBRARYNAME) dynamic profile library =======
- $(VERB) $(CXX) -shared -o $@ $(RealObjectsP) $(LibSubDirs) $(LibLinkOpts);
+ $(VERB) $(CXX) $(Share) -o $@ $(RealObjectsP) $(LibSubDirs) $(LibLinkOpts);
$(LIBNAME_G): $(ObjectsG) $(LibSubDirs) $(DESTLIBDEBUG)/.dir
@echo ======= Linking $(LIBRARYNAME) dynamic debug library =======
- $(VERB) $(CXX) -shared -o $@ $(RealObjectsG) $(LibSubDirs) $(LibLinkOpts);
+ $(VERB) $(CXX) $(Share) -o $@ $(RealObjectsG) $(LibSubDirs) $(LibLinkOpts);
#
# Rules for building static archive libraries.
From brukman at cs.uiuc.edu Thu Jul 10 19:07:01 2003
From: brukman at cs.uiuc.edu (Misha Brukman)
Date: Thu Jul 10 19:07:01 2003
Subject: [llvm-commits] CVS: llvm/test/Programs/SingleSource/Shootout/lists.c
Message-ID: <200307110006.TAA08067@zion.cs.uiuc.edu>
Changes in directory llvm/test/Programs/SingleSource/Shootout:
lists.c updated: 1.4 -> 1.5
---
Log message:
Gave the file a more consistent indentation scheme.
---
Diffs of the changes:
Index: llvm/test/Programs/SingleSource/Shootout/lists.c
diff -u llvm/test/Programs/SingleSource/Shootout/lists.c:1.4 llvm/test/Programs/SingleSource/Shootout/lists.c:1.5
--- llvm/test/Programs/SingleSource/Shootout/lists.c:1.4 Fri Dec 13 05:00:38 2002
+++ llvm/test/Programs/SingleSource/Shootout/lists.c Thu Jul 10 19:06:29 2003
@@ -1,5 +1,5 @@
/* -*- mode: c -*-
- * $Id: lists.c,v 1.4 2002/12/13 11:00:38 lattner Exp $
+ * $Id: lists.c,v 1.5 2003/07/11 00:06:29 brukman Exp $
* http://www.bagley.org/~doug/shootout/
*/
@@ -11,11 +11,11 @@
#define inline static
/* a simple Double Linked List
-// the head node is special, it's val is length of list*/
+ the head node is special, it's val is length of list */
typedef struct DLL {
- int val;
- struct DLL *next; /* points to next or head (if at tail) */
- struct DLL *prev; /* points to prev or tail (if at head) */
+ int val;
+ struct DLL *next; /* points to next or head (if at tail) */
+ struct DLL *prev; /* points to prev or tail (if at head) */
} DLL;
inline int list_length(DLL *head) { return(head->val); }
@@ -24,203 +24,203 @@
inline DLL *list_last(DLL *head) { return(head->prev); }
void list_push_tail(DLL *head, DLL *item) {
- DLL *tail = head->prev;
- tail->next = item;
- item->next = head;
- head->prev = item;
- item->prev = tail;
- head->val++;
+ DLL *tail = head->prev;
+ tail->next = item;
+ item->next = head;
+ head->prev = item;
+ item->prev = tail;
+ head->val++;
}
DLL *list_pop_tail(DLL *head) {
- DLL *prev, *tail;
- if (list_empty(head)) return(NULL);
- tail = head->prev;
- prev = tail->prev;
- prev->next = head;
- head->prev = prev;
- head->val--;
- return(tail);
+ DLL *prev, *tail;
+ if (list_empty(head)) return(NULL);
+ tail = head->prev;
+ prev = tail->prev;
+ prev->next = head;
+ head->prev = prev;
+ head->val--;
+ return(tail);
}
void list_push_head(DLL *head, DLL *item) {
- DLL *next = head->next;
- head->next = item;
- next->prev = item;
- item->next = next;
- item->prev = head;
- head->val++;
+ DLL *next = head->next;
+ head->next = item;
+ next->prev = item;
+ item->next = next;
+ item->prev = head;
+ head->val++;
}
DLL *list_pop_head(DLL *head) {
- DLL *next;
- if (list_empty(head)) return(NULL);
- next = head->next;
- head->next = next->next;
- next->next->prev = head;
- head->val--;
- return(next);
+ DLL *next;
+ if (list_empty(head)) return(NULL);
+ next = head->next;
+ head->next = next->next;
+ next->next->prev = head;
+ head->val--;
+ return(next);
}
int list_equal(DLL *x, DLL *y) {
- DLL *xp, *yp;
- /* first val's checked will be list lengths*/
- for (xp=x, yp=y; xp->next != x; xp=xp->next, yp=yp->next) {
- if (xp->val != yp->val) return(0);
- }
+ DLL *xp, *yp;
+ /* first val's checked will be list lengths */
+ for (xp=x, yp=y; xp->next != x; xp=xp->next, yp=yp->next) {
if (xp->val != yp->val) return(0);
- return(yp->next == y);
+ }
+ if (xp->val != yp->val) return(0);
+ return(yp->next == y);
}
void list_print(char *msg, DLL *x) {
- DLL *xp, *first = x->next;
- int i = 0;
- puts(msg);
- printf("length: %d\n", list_length(x));
- for (xp=x->next; xp->next != first; xp=xp->next) {
- printf("i:%3d v:%3d n:%3d p:%3d\n", ++i,
- xp->val, xp->next->val, xp->prev->val);
- }
- printf("[last entry points to list head]\n");
- printf("[val of next of tail is: %d]\n", xp->next->val);
+ DLL *xp, *first = x->next;
+ int i = 0;
+ puts(msg);
+ printf("length: %d\n", list_length(x));
+ for (xp=x->next; xp->next != first; xp=xp->next) {
+ printf("i:%3d v:%3d n:%3d p:%3d\n", ++i,
+ xp->val, xp->next->val, xp->prev->val);
+ }
+ printf("[last entry points to list head]\n");
+ printf("[val of next of tail is: %d]\n", xp->next->val);
}
DLL *list_new() {
- DLL *l = (DLL *)malloc(sizeof(DLL));
- l->next = l;
- l->prev = l;
- l->val = 0;
- return(l);
+ DLL *l = (DLL *)malloc(sizeof(DLL));
+ l->next = l;
+ l->prev = l;
+ l->val = 0;
+ return(l);
}
/* inclusive sequence 'from' <-> 'to' */
DLL *list_sequence(int from, int to) {
- int size, tmp, i, j;
- DLL *l;
- if (from > to) {
- tmp = from; from = to; to = tmp;
- }
- size = to - from + 1;
- l = (DLL *)malloc((size+1) * sizeof(DLL));
- from--;
- for (i=0, j=1; i to) {
+ tmp = from; from = to; to = tmp;
+ }
+ size = to - from + 1;
+ l = (DLL *)malloc((size+1) * sizeof(DLL));
+ from--;
+ for (i=0, j=1; inext) {
- l[i].next = &l[j];
- l[j].prev = &l[i];
- l[i].val = xp->val;
- }
- l[0].prev = &l[size];
- l[size].next = &l[0];
- l[size].val = list_last(x)->val;
- return(l);
+ int i, j, size = list_length(x);
+ DLL *xp, *l = (DLL *)malloc((size+1) * sizeof(DLL));
+ for (i=0, j=1, xp=x; inext) {
+ l[i].next = &l[j];
+ l[j].prev = &l[i];
+ l[i].val = xp->val;
+ }
+ l[0].prev = &l[size];
+ l[size].next = &l[0];
+ l[size].val = list_last(x)->val;
+ return(l);
}
void list_reverse (DLL *head) {
- DLL *tmp, *p = head;
- do {
- tmp = p->next;
- p->next = p->prev;
- p->prev = tmp;
- p = tmp;
- } while (p != head);
+ DLL *tmp, *p = head;
+ do {
+ tmp = p->next;
+ p->next = p->prev;
+ p->prev = tmp;
+ p = tmp;
+ } while (p != head);
}
int test_lists() {
- int len = 0;
- /* create a list of integers (li1) from 1 to SIZE*/
- DLL *li1 = list_sequence(1, SIZE);
- /* copy the list to li2*/
- DLL *li2 = list_copy(li1);
- /* remove each individual item from left side of li2 and
- // append to right side of li3 (preserving order)*/
- DLL *li3 = list_new();
- /* compare li2 and li1 for equality*/
- if (!list_equal(li2, li1)) {
- printf("li2 and li1 are not equal\n");
- exit(1);
- }
- while (!list_empty(li2)) {
- list_push_tail(li3, list_pop_head(li2));
- }
- /* li2 must now be empty*/
- if (!list_empty(li2)) {
- printf("li2 should be empty now\n");
- exit(1);
- }
- /* remove each individual item from right side of li3 and
- // append to right side of li2 (reversing list)*/
- while (!list_empty(li3)) {
- list_push_tail(li2, list_pop_tail(li3));
- }
- /* li3 must now be empty */
- if (!list_empty(li3)) {
- printf("li3 should be empty now\n");
- exit(1);
- }
- /* reverse li1 in place */
- list_reverse(li1);
- /* check that li1's first item is now SIZE */
- if (list_first(li1)->val != SIZE) {
- printf("li1 first value wrong, wanted %d, got %d\n",
- SIZE, list_first(li1)->val);
- exit(1);
- }
- /* check that li1's last item is now 1 */
- if (list_last(li1)->val != 1) {
- printf("last value wrong, wanted %d, got %d\n",
- SIZE, list_last(li1)->val);
- exit(1);
- }
- /* check that li2's first item is now SIZE */
- if (list_first(li2)->val != SIZE) {
- printf("li2 first value wrong, wanted %d, got %d\n",
- SIZE, list_first(li2)->val);
- exit(1);
- }
- /* check that li2's last item is now 1 */
- if (list_last(li2)->val != 1) {
- printf("last value wrong, wanted %d, got %d\n",
- SIZE, list_last(li2)->val);
- exit(1);
- }
- /* check that li1's length is still SIZE */
- if (list_length(li1) != SIZE) {
- printf("li1 size wrong, wanted %d, got %d\n",
- SIZE, list_length(li1));
- exit(1);
- }
- /* compare li1 and li2 for equality */
- if (!list_equal(li1, li2)) {
- printf("li1 and li2 are not equal\n");
- exit(1);
- }
- len = list_length(li1);
- free(li1);
- free(li2);
- free(li3);
- /* return the length of the list */
- return(len);
+ int len = 0;
+ /* create a list of integers (li1) from 1 to SIZE */
+ DLL *li1 = list_sequence(1, SIZE);
+ /* copy the list to li2*/
+ DLL *li2 = list_copy(li1);
+ /* remove each individual item from left side of li2 and
+ append to right side of li3 (preserving order) */
+ DLL *li3 = list_new();
+ /* compare li2 and li1 for equality */
+ if (!list_equal(li2, li1)) {
+ printf("li2 and li1 are not equal\n");
+ exit(1);
+ }
+ while (!list_empty(li2)) {
+ list_push_tail(li3, list_pop_head(li2));
+ }
+ /* li2 must now be empty */
+ if (!list_empty(li2)) {
+ printf("li2 should be empty now\n");
+ exit(1);
+ }
+ /* remove each individual item from right side of li3 and
+ append to right side of li2 (reversing list) */
+ while (!list_empty(li3)) {
+ list_push_tail(li2, list_pop_tail(li3));
+ }
+ /* li3 must now be empty */
+ if (!list_empty(li3)) {
+ printf("li3 should be empty now\n");
+ exit(1);
+ }
+ /* reverse li1 in place */
+ list_reverse(li1);
+ /* check that li1's first item is now SIZE */
+ if (list_first(li1)->val != SIZE) {
+ printf("li1 first value wrong, wanted %d, got %d\n",
+ SIZE, list_first(li1)->val);
+ exit(1);
+ }
+ /* check that li1's last item is now 1 */
+ if (list_last(li1)->val != 1) {
+ printf("last value wrong, wanted %d, got %d\n",
+ SIZE, list_last(li1)->val);
+ exit(1);
+ }
+ /* check that li2's first item is now SIZE */
+ if (list_first(li2)->val != SIZE) {
+ printf("li2 first value wrong, wanted %d, got %d\n",
+ SIZE, list_first(li2)->val);
+ exit(1);
+ }
+ /* check that li2's last item is now 1 */
+ if (list_last(li2)->val != 1) {
+ printf("last value wrong, wanted %d, got %d\n",
+ SIZE, list_last(li2)->val);
+ exit(1);
+ }
+ /* check that li1's length is still SIZE */
+ if (list_length(li1) != SIZE) {
+ printf("li1 size wrong, wanted %d, got %d\n",
+ SIZE, list_length(li1));
+ exit(1);
+ }
+ /* compare li1 and li2 for equality */
+ if (!list_equal(li1, li2)) {
+ printf("li1 and li2 are not equal\n");
+ exit(1);
+ }
+ len = list_length(li1);
+ free(li1);
+ free(li2);
+ free(li3);
+ /* return the length of the list */
+ return(len);
}
int main(int argc, char *argv[]) {
- int n = ((argc == 2) ? atoi(argv[1]) : 1);
- int result = 0;
- while(n--) result = test_lists();
- printf("%d\n", result);
- return 0;
+ int n = ((argc == 2) ? atoi(argv[1]) : 1);
+ int result = 0;
+ while(n--) result = test_lists();
+ printf("%d\n", result);
+ return 0;
}
From brukman at cs.uiuc.edu Fri Jul 11 12:01:01 2003
From: brukman at cs.uiuc.edu (Misha Brukman)
Date: Fri Jul 11 12:01:01 2003
Subject: [llvm-commits] CVS: llvm/test/Programs/Makefile.programs
Message-ID: <200307111700.MAA11636@zion.cs.uiuc.edu>
Changes in directory llvm/test/Programs:
Makefile.programs updated: 1.67 -> 1.68
---
Log message:
If we are using the tracing mechanism, and the program crashes or we choose to
abort it earlier, keep the output file so we at least have something to compare.
---
Diffs of the changes:
Index: llvm/test/Programs/Makefile.programs
diff -u llvm/test/Programs/Makefile.programs:1.67 llvm/test/Programs/Makefile.programs:1.68
--- llvm/test/Programs/Makefile.programs:1.67 Thu Jul 10 14:29:01 2003
+++ llvm/test/Programs/Makefile.programs Fri Jul 11 12:00:07 2003
@@ -135,6 +135,8 @@
## -- disable output diffs
## -- generate llc output if not disabled
## -- generate cbe output if not disabled
+ ## -- Make the trace output files precious if tracing is enabled because
+ ## we often don't want to generate the complete trace file!
DISABLE_DIFFS = 1
OPTPASSES += $(TRACEFLAGS)
@@ -145,6 +147,11 @@
ifndef DISABLE_CBE
all:: $(CBEOUTPUT)
endif
+ifndef DISABLE_JIT
+all:: $(JITOUTPUT)
+endif
+
+.PRECIOUS: $(LLIOUTPUT) $(JITOUTPUT) $(LLCOUTPUT) $(CBEOUTPUT)
endif
ifndef DISABLE_LLC
From gaeke at cs.uiuc.edu Fri Jul 11 13:19:01 2003
From: gaeke at cs.uiuc.edu (Brian Gaeke)
Date: Fri Jul 11 13:19:01 2003
Subject: [llvm-commits] CVS: llvm/lib/Target/X86/Printer.cpp X86InstrInfo.def
Message-ID: <200307111818.NAA00981@zion.cs.uiuc.edu>
Changes in directory llvm/lib/Target/X86:
Printer.cpp updated: 1.42 -> 1.43
X86InstrInfo.def updated: 1.61 -> 1.62
---
Log message:
Fix some serious floating-point bugs (fixes test cases such as Oscar,
Fhourstones, McCat-vor, and many others...)
Printer.cpp: Print implicit uses for AddRegFrm instructions. Break gas
bug workarounds up into separate stanzas of code for each bug. Add new
workarounds for fild and fistp.
X86InstrInfo.def: Add O_ST0 implicit uses for more FP instrs where they
obviously apply. Also add PrintImplUses flags for FP instrs where they
are necessary for gas to understand the output.
---
Diffs of the changes:
Index: llvm/lib/Target/X86/Printer.cpp
diff -u llvm/lib/Target/X86/Printer.cpp:1.42 llvm/lib/Target/X86/Printer.cpp:1.43
--- llvm/lib/Target/X86/Printer.cpp:1.42 Mon Jul 7 13:34:20 2003
+++ llvm/lib/Target/X86/Printer.cpp Fri Jul 11 13:18:35 2003
@@ -665,6 +665,11 @@
O << ", ";
printOp(O, MI->getOperand(1), RI);
}
+ if (Desc.TSFlags & X86II::PrintImplUses) {
+ for (const unsigned *p = Desc.ImplicitUses; *p; ++p) {
+ O << ", " << RI.get(*p).Name;
+ }
+ }
O << "\n";
return;
}
@@ -819,7 +824,10 @@
isMem(MI, 0) && "Bad MRMSxM format!");
assert((MI->getNumOperands() != 5 || MI->getOperand(4).isImmediate()) &&
"Bad MRMSxM format!");
- // Work around GNU assembler bugs in FSTP and FLD.
+ // Bug: The 80-bit FP store-pop instruction "fstp XWORD PTR [...]"
+ // is misassembled by gas in intel_syntax mode as its 32-bit
+ // equivalent "fstp DWORD PTR [...]". Workaround: Output the raw
+ // opcode bytes instead of the instruction.
if (MI->getOpCode() == X86::FSTPr80) {
if ((MI->getOperand(0).getReg() == X86::ESP)
&& (MI->getOperand(1).getImmedValue() == 1)) {
@@ -834,7 +842,12 @@
<< std::dec << "\t# ";
}
}
- } else if (MI->getOpCode() == X86::FLDr80) {
+ }
+ // Bug: The 80-bit FP load instruction "fld XWORD PTR [...]" is
+ // misassembled by gas in intel_syntax mode as its 32-bit
+ // equivalent "fld DWORD PTR [...]". Workaround: Output the raw
+ // opcode bytes instead of the instruction.
+ if (MI->getOpCode() == X86::FLDr80) {
if ((MI->getOperand(0).getReg() == X86::ESP)
&& (MI->getOperand(1).getImmedValue() == 1)) {
int DispVal = MI->getOperand(3).getImmedValue();
@@ -849,6 +862,42 @@
}
}
}
+ // Bug: gas intel_syntax mode treats "fild QWORD PTR [...]" as an
+ // invalid opcode, saying "64 bit operations are only supported in
+ // 64 bit modes." libopcodes disassembles it as "fild DWORD PTR
+ // [...]", which is wrong. Workaround: Output the raw opcode bytes
+ // instead of the instruction.
+ if (MI->getOpCode() == X86::FILDr64) {
+ if ((MI->getOperand(0).getReg() == X86::ESP)
+ && (MI->getOperand(1).getImmedValue() == 1)) {
+ int DispVal = MI->getOperand(3).getImmedValue();
+ if ((DispVal < -128) || (DispVal > 127)) { // 4 byte disp.
+ unsigned int val = (unsigned int) DispVal;
+ O << ".byte 0xdf, 0xac, 0x24\n\t";
+ O << ".long 0x" << std::hex << (unsigned) val << std::dec << "\t# ";
+ } else { // 1 byte disp.
+ unsigned char val = (unsigned char) DispVal;
+ O << ".byte 0xdf, 0x6c, 0x24, 0x" << std::hex << (unsigned) val
+ << std::dec << "\t# ";
+ }
+ }
+ }
+ // Bug: gas intel_syntax mode treats "fistp QWORD PTR [...]" as
+ // an invalid opcode, saying "64 bit operations are only
+ // supported in 64 bit modes." libopcodes disassembles it as
+ // "fistpll DWORD PTR [...]", which is wrong. Workaround: Output
+ // "fistpll DWORD PTR " instead, which is what libopcodes is
+ // expecting to see.
+ if (MI->getOpCode() == X86::FISTPr64) {
+ O << "fistpll DWORD PTR ";
+ printMemReference(O, MI, 0, RI);
+ if (MI->getNumOperands() == 5) {
+ O << ", ";
+ printOp(O, MI->getOperand(4), RI);
+ }
+ O << "\t# ";
+ }
+
O << TII.getName(MI->getOpCode()) << " ";
O << sizePtr(Desc) << " ";
printMemReference(O, MI, 0, RI);
Index: llvm/lib/Target/X86/X86InstrInfo.def
diff -u llvm/lib/Target/X86/X86InstrInfo.def:1.61 llvm/lib/Target/X86/X86InstrInfo.def:1.62
--- llvm/lib/Target/X86/X86InstrInfo.def:1.61 Thu Jun 26 19:00:46 2003
+++ llvm/lib/Target/X86/X86InstrInfo.def Fri Jul 11 13:18:35 2003
@@ -318,14 +318,14 @@
I(FSTPr32 , "fstp", 0xD9, 0, X86II::Void | X86II::ArgF32 | X86II::MRMS3m , NoIR, NoIR) // store float, pop
I(FSTPr64 , "fstp", 0xDD, 0, X86II::Void | X86II::ArgF64 | X86II::MRMS3m , NoIR, NoIR) // store double, pop
I(FSTPr80 , "fstp", 0xDB, 0, X86II::Void | X86II::ArgF80 | X86II::MRMS7m | X86II::OneArgFP , NoIR, NoIR) // store extended, pop
-I(FSTrr , "fst" , 0xD0, 0, X86II::DD | X86II::Void | X86II::ArgF80 | X86II::AddRegFrm , NoIR, NoIR) // ST(i) = ST(0)
-I(FSTPrr , "fstp" , 0xD8, 0, X86II::DD | X86II::Void | X86II::ArgF80 | X86II::AddRegFrm , NoIR, NoIR) // ST(i) = ST(0), pop
+I(FSTrr , "fst" , 0xD0, 0, X86II::DD | X86II::Void | X86II::ArgF80 | X86II::AddRegFrm , O_ST0, NoIR) // ST(i) = ST(0)
+I(FSTPrr , "fstp" , 0xD8, 0, X86II::DD | X86II::Void | X86II::ArgF80 | X86II::AddRegFrm , O_ST0, NoIR) // ST(i) = ST(0), pop
I(FISTr16 , "fist", 0xDF, 0, X86II::Void | X86II::Arg16 | X86II::MRMS2m | X86II::OneArgFP , NoIR, NoIR) // store signed short
I(FISTr32 , "fist", 0xDB, 0, X86II::Void | X86II::Arg32 | X86II::MRMS2m | X86II::OneArgFP , NoIR, NoIR) // store signed int
I(FISTPr16 , "fistp", 0xDF, 0, X86II::Void | X86II::Arg16 | X86II::MRMS3m , NoIR, NoIR) // store short, pop
I(FISTPr32 , "fistp", 0xDB, 0, X86II::Void | X86II::Arg32 | X86II::MRMS3m , NoIR, NoIR) // store int, pop
-I(FISTPr64 , "fistp", 0xDF, 0, X86II::Void | X86II::Arg64 | X86II::MRMS7m | X86II::OneArgFP , NoIR, NoIR) // store long, pop
+I(FISTPr64 , "fistpll", 0xDF, 0, X86II::Void | X86II::Arg64 | X86II::MRMS7m | X86II::OneArgFP , NoIR, NoIR) // store long, pop
I(FXCH , "fxch" , 0xC8, 0, X86II::D9 | X86II::Void | X86II::ArgF80 | X86II::AddRegFrm , O_ST0, O_ST0) // fxch ST(i), ST(0)
@@ -335,34 +335,34 @@
I(FLD1 , "fld1" , 0xE8, 0, X86II::D9 | X86II::ArgF80 | X86II::RawFrm | X86II::ZeroArgFP, NoIR, NoIR) // load +1.0
// Binary arithmetic operations...
-I(FADDST0r , "fadd", 0xC0, 0, X86II::D8 | X86II::ArgF80 | X86II::AddRegFrm , NoIR, NoIR) // ST(0) = ST(0) + ST(i)
-I(FADDrST0 , "fadd", 0xC0, 0, X86II::DC | X86II::ArgF80 | X86II::AddRegFrm , NoIR, NoIR) // ST(i) = ST(i) + ST(0)
-I(FADDPrST0 , "faddp", 0xC0, 0, X86II::DE | X86II::ArgF80 | X86II::AddRegFrm , NoIR, NoIR) // ST(i) = ST(i) + ST(0), pop
-
-I(FSUBRST0r , "fsubr" , 0xE8, 0, X86II::D8 | X86II::ArgF80 | X86II::AddRegFrm , NoIR, NoIR) // ST(0) = ST(i) - ST(0)
-I(FSUBrST0 , "fsub" , 0xE8, 0, X86II::DC | X86II::ArgF80 | X86II::AddRegFrm , NoIR, NoIR) // ST(i) = ST(i) - ST(0)
-I(FSUBPrST0 , "fsubp" , 0xE8, 0, X86II::DE | X86II::ArgF80 | X86II::AddRegFrm , NoIR, NoIR) // ST(i) = ST(i) - ST(0), pop
-
-I(FSUBST0r , "fsub" , 0xE0, 0, X86II::D8 | X86II::ArgF80 | X86II::AddRegFrm , NoIR, NoIR) // ST(0) = ST(0) - ST(i)
-I(FSUBRrST0 , "fsubr" , 0xE0, 0, X86II::DC | X86II::ArgF80 | X86II::AddRegFrm , NoIR, NoIR) // ST(i) = ST(0) - ST(i)
-I(FSUBRPrST0 , "fsubrp", 0xE0, 0, X86II::DE | X86II::ArgF80 | X86II::AddRegFrm , NoIR, NoIR) // ST(i) = ST(0) - ST(i), pop
-
-I(FMULST0r , "fmul", 0xC8, 0, X86II::D8 | X86II::ArgF80 | X86II::AddRegFrm , NoIR, NoIR) // ST(0) = ST(0) * ST(i)
-I(FMULrST0 , "fmul", 0xC8, 0, X86II::DC | X86II::ArgF80 | X86II::AddRegFrm , NoIR, NoIR) // ST(i) = ST(i) * ST(0)
-I(FMULPrST0 , "fmulp", 0xC8, 0, X86II::DE | X86II::ArgF80 | X86II::AddRegFrm , NoIR, NoIR) // ST(i) = ST(i) * ST(0), pop
-
-I(FDIVRST0r , "fdivr" , 0xF8, 0, X86II::D8 | X86II::ArgF80 | X86II::AddRegFrm , NoIR, NoIR) // ST(0) = ST(i) / ST(0)
-I(FDIVrST0 , "fdiv" , 0xF8, 0, X86II::DC | X86II::ArgF80 | X86II::AddRegFrm , NoIR, NoIR) // ST(i) = ST(i) / ST(0)
-I(FDIVPrST0 , "fdivp" , 0xF8, 0, X86II::DE | X86II::ArgF80 | X86II::AddRegFrm , NoIR, NoIR) // ST(i) = ST(i) / ST(0), pop
-
-I(FDIVST0r , "fdiv" , 0xF0, 0, X86II::D8 | X86II::ArgF80 | X86II::AddRegFrm , NoIR, NoIR) // ST(0) = ST(0) / ST(i)
-I(FDIVRrST0 , "fdivr" , 0xF0, 0, X86II::DC | X86II::ArgF80 | X86II::AddRegFrm , NoIR, NoIR) // ST(i) = ST(0) / ST(i)
-I(FDIVRPrST0 , "fdivrp", 0xF0, 0, X86II::DE | X86II::ArgF80 | X86II::AddRegFrm , NoIR, NoIR) // ST(i) = ST(0) / ST(i), pop
+I(FADDST0r , "fadd", 0xC0, 0, X86II::D8 | X86II::ArgF80 | X86II::AddRegFrm , O_ST0, O_ST0) // ST(0) = ST(0) + ST(i)
+I(FADDrST0 , "fadd", 0xC0, 0, X86II::DC | X86II::ArgF80 | X86II::AddRegFrm | X86II::PrintImplUses, O_ST0, NoIR) // ST(i) = ST(i) + ST(0)
+I(FADDPrST0 , "faddp", 0xC0, 0, X86II::DE | X86II::ArgF80 | X86II::AddRegFrm , O_ST0, NoIR) // ST(i) = ST(i) + ST(0), pop
+
+I(FSUBRST0r , "fsubr" , 0xE8, 0, X86II::D8 | X86II::ArgF80 | X86II::AddRegFrm , O_ST0, O_ST0) // ST(0) = ST(i) - ST(0)
+I(FSUBrST0 , "fsub" , 0xE8, 0, X86II::DC | X86II::ArgF80 | X86II::AddRegFrm | X86II::PrintImplUses, O_ST0, NoIR) // ST(i) = ST(i) - ST(0)
+I(FSUBPrST0 , "fsubp" , 0xE8, 0, X86II::DE | X86II::ArgF80 | X86II::AddRegFrm , O_ST0, NoIR) // ST(i) = ST(i) - ST(0), pop
+
+I(FSUBST0r , "fsub" , 0xE0, 0, X86II::D8 | X86II::ArgF80 | X86II::AddRegFrm , O_ST0, O_ST0) // ST(0) = ST(0) - ST(i)
+I(FSUBRrST0 , "fsubr" , 0xE0, 0, X86II::DC | X86II::ArgF80 | X86II::AddRegFrm | X86II::PrintImplUses, O_ST0, NoIR) // ST(i) = ST(0) - ST(i)
+I(FSUBRPrST0 , "fsubrp", 0xE0, 0, X86II::DE | X86II::ArgF80 | X86II::AddRegFrm , O_ST0, NoIR) // ST(i) = ST(0) - ST(i), pop
+
+I(FMULST0r , "fmul", 0xC8, 0, X86II::D8 | X86II::ArgF80 | X86II::AddRegFrm , O_ST0, O_ST0) // ST(0) = ST(0) * ST(i)
+I(FMULrST0 , "fmul", 0xC8, 0, X86II::DC | X86II::ArgF80 | X86II::AddRegFrm | X86II::PrintImplUses, O_ST0, NoIR) // ST(i) = ST(i) * ST(0)
+I(FMULPrST0 , "fmulp", 0xC8, 0, X86II::DE | X86II::ArgF80 | X86II::AddRegFrm , O_ST0, NoIR) // ST(i) = ST(i) * ST(0), pop
+
+I(FDIVRST0r , "fdivr" , 0xF8, 0, X86II::D8 | X86II::ArgF80 | X86II::AddRegFrm , O_ST0, O_ST0) // ST(0) = ST(i) / ST(0)
+I(FDIVrST0 , "fdiv" , 0xF8, 0, X86II::DC | X86II::ArgF80 | X86II::AddRegFrm | X86II::PrintImplUses, O_ST0, NoIR) // ST(i) = ST(i) / ST(0)
+I(FDIVPrST0 , "fdivp" , 0xF8, 0, X86II::DE | X86II::ArgF80 | X86II::AddRegFrm , O_ST0, NoIR) // ST(i) = ST(i) / ST(0), pop
+
+I(FDIVST0r , "fdiv" , 0xF0, 0, X86II::D8 | X86II::ArgF80 | X86II::AddRegFrm , O_ST0, O_ST0) // ST(0) = ST(0) / ST(i)
+I(FDIVRrST0 , "fdivr" , 0xF0, 0, X86II::DC | X86II::ArgF80 | X86II::AddRegFrm | X86II::PrintImplUses, O_ST0, NoIR) // ST(i) = ST(0) / ST(i)
+I(FDIVRPrST0 , "fdivrp", 0xF0, 0, X86II::DE | X86II::ArgF80 | X86II::AddRegFrm , O_ST0, NoIR) // ST(i) = ST(0) / ST(i), pop
// Floating point compares
-I(FUCOMr , "fucom" , 0xE0, 0, X86II::DD | X86II::Void | X86II::ArgF80 | X86II::AddRegFrm , NoIR, NoIR) // FPSW = compare ST(0) with ST(i)
-I(FUCOMPr , "fucomp" , 0xE8, 0, X86II::DD | X86II::Void | X86II::ArgF80 | X86II::AddRegFrm , NoIR, NoIR) // compare, pop
-I(FUCOMPPr , "fucompp" , 0xE9, 0, X86II::DA | X86II::Void | X86II::RawFrm , NoIR, NoIR) // compare ST(0) with ST(1), pop, pop
+I(FUCOMr , "fucom" , 0xE0, 0, X86II::DD | X86II::Void | X86II::ArgF80 | X86II::AddRegFrm , O_ST0, NoIR) // FPSW = compare ST(0) with ST(i)
+I(FUCOMPr , "fucomp" , 0xE8, 0, X86II::DD | X86II::Void | X86II::ArgF80 | X86II::AddRegFrm , O_ST0, NoIR) // compare, pop
+I(FUCOMPPr , "fucompp" , 0xE9, 0, X86II::DA | X86II::Void | X86II::RawFrm , O_ST0, NoIR) // compare ST(0) with ST(1), pop, pop
// Floating point flag ops
I(FNSTSWr8 , "fnstsw" , 0xE0, 0, X86II::DF | X86II::Void | X86II::RawFrm , NoIR, O_AX) // AX = fp flags
From gaeke at cs.uiuc.edu Fri Jul 11 15:44:00 2003
From: gaeke at cs.uiuc.edu (Brian Gaeke)
Date: Fri Jul 11 15:44:00 2003
Subject: [llvm-commits] CVS: llvm/test/Programs/MultiSource/Ptrdist-ks/Makefile
Message-ID: <200307112043.PAA16274@neo.cs.uiuc.edu>
Changes in directory llvm/test/Programs/MultiSource/Ptrdist-ks:
Makefile updated: 1.2 -> 1.3
---
Log message:
This one wasn't really failing; it just takes a loooong time.
---
Diffs of the changes:
Index: llvm/test/Programs/MultiSource/Ptrdist-ks/Makefile
diff -u llvm/test/Programs/MultiSource/Ptrdist-ks/Makefile:1.2 llvm/test/Programs/MultiSource/Ptrdist-ks/Makefile:1.3
--- llvm/test/Programs/MultiSource/Ptrdist-ks/Makefile:1.2 Mon Jun 16 10:51:34 2003
+++ llvm/test/Programs/MultiSource/Ptrdist-ks/Makefile Fri Jul 11 15:43:21 2003
@@ -2,6 +2,7 @@
PROG=ks
#OBJS = KS-1.o KS-2.o
RUN_OPTIONS += KL-4.in
+RUNTIMELIMIT = 120
include ../Makefile.multisrc
From gaeke at cs.uiuc.edu Fri Jul 11 15:54:01 2003
From: gaeke at cs.uiuc.edu (Brian Gaeke)
Date: Fri Jul 11 15:54:01 2003
Subject: [llvm-commits] CVS: llvm/test/Programs/MultiSource/McCat-09-vor/vor.in-tiny
Message-ID: <200307112053.PAA16505@neo.cs.uiuc.edu>
Changes in directory llvm/test/Programs/MultiSource/McCat-09-vor:
vor.in-tiny added (r1.1)
---
Log message:
A tiny input file for vor.
---
Diffs of the changes:
Index: llvm/test/Programs/MultiSource/McCat-09-vor/vor.in-tiny
diff -c /dev/null llvm/test/Programs/MultiSource/McCat-09-vor/vor.in-tiny:1.1
*** /dev/null Fri Jul 11 15:52:59 2003
--- llvm/test/Programs/MultiSource/McCat-09-vor/vor.in-tiny Fri Jul 11 15:52:46 2003
***************
*** 0 ****
--- 1,13 ----
+ 12
+ 45 -1062
+ -627 113
+ 1466 -1075
+ 662 -896
+ -17 -1229
+ -1363 -361
+ -730 -432
+ 1584 115
+ 870 479
+ 875 918
+ 1058 -1140
+ 411 -607
From vadve at cs.uiuc.edu Fri Jul 11 16:58:01 2003
From: vadve at cs.uiuc.edu (Vikram Adve)
Date: Fri Jul 11 16:58:01 2003
Subject: [llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/TraceValues.cpp
Message-ID: <200307112157.QAA15336@psmith.cs.uiuc.edu>
Changes in directory llvm/lib/Transforms/Instrumentation:
TraceValues.cpp updated: 1.57 -> 1.58
---
Log message:
Trace loads and stores as they happen (stores were being
remembered in valuesStoredInFunction, but never traced at function return,
and that's too late to be finding the error anyway).
Stores trace both the value and the address being stored to,
but after some experience I think only values should be traced.
The pointer hash table just fills up far too quickly if every
store address were traced.
---
Diffs of the changes:
Index: llvm/lib/Transforms/Instrumentation/TraceValues.cpp
diff -u llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.57 llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.58
--- llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.57 Wed Jun 4 23:48:18 2003
+++ llvm/lib/Transforms/Instrumentation/TraceValues.cpp Fri Jul 11 16:57:43 2003
@@ -164,7 +164,9 @@
//
// Check if this instruction has any uses outside its basic block,
-// or if it used by either a Call or Return instruction.
+// or if it used by either a Call or Return instruction (ditto).
+// (Values stored to memory within this BB are live at end of BB but are
+// traced at the store instruction, not where they are computed.)
//
static inline bool LiveAtBBExit(const Instruction* I) {
const BasicBlock *BB = I->getParent();
@@ -188,10 +190,16 @@
}
+// Trace a value computed by an instruction if it is non-void, it is computed
+// by a real computation, not just a copy (see TraceThisOpCode), and
+// -- it is a load instruction: we want to check values read from memory
+// -- or it is live at exit from the basic block (i.e., ignore local temps)
+//
static bool ShouldTraceValue(const Instruction *I) {
return
- I->getType() != Type::VoidTy && LiveAtBBExit(I) &&
- TraceThisOpCode(I->getOpcode());
+ I->getType() != Type::VoidTy &&
+ TraceThisOpCode(I->getOpcode()) &&
+ (isa(I) || LiveAtBBExit(I));
}
static string getPrintfCodeFor(const Value *V) {
@@ -331,14 +339,13 @@
//
for (BasicBlock::iterator II = BB->begin(); &*II != InsertPos; ++II) {
if (StoreInst *SI = dyn_cast(II)) {
- assert(valuesStoredInFunction &&
- "Should not be printing a store instruction at function exit");
- LoadInst *LI = new LoadInst(SI->getPointerOperand(), "reload." +
- SI->getPointerOperand()->getName(),
- InsertPos);
- valuesStoredInFunction->push_back(LI);
+ // Trace the stored value and address
+ InsertVerbosePrintInst(SI->getOperand(0), BB, InsertPos,
+ " (store value) ", Printf, HashPtrToSeqNum);
+ InsertVerbosePrintInst(SI->getOperand(1), BB, InsertPos,
+ " (store addr ) ", Printf, HashPtrToSeqNum);
}
- if (ShouldTraceValue(II))
+ else if (ShouldTraceValue(II))
InsertVerbosePrintInst(II, BB, InsertPos, " ", Printf, HashPtrToSeqNum);
}
}
From gaeke at cs.uiuc.edu Fri Jul 11 16:58:06 2003
From: gaeke at cs.uiuc.edu (Brian Gaeke)
Date: Fri Jul 11 16:58:06 2003
Subject: [llvm-commits] CVS: llvm/lib/Target/X86/Printer.cpp
Message-ID: <200307112157.QAA21130@neo.cs.uiuc.edu>
Changes in directory llvm/lib/Target/X86:
Printer.cpp updated: 1.43 -> 1.44
---
Log message:
If we have a constant pointer reference to a function, we were printing
out the entire llvm disassembly for the function at global constant-output
time, which caused the assembler to barf in 164.gzip. This fixes that
particular problem (though 164.gzip has other problems with X86 llc.)
---
Diffs of the changes:
Index: llvm/lib/Target/X86/Printer.cpp
diff -u llvm/lib/Target/X86/Printer.cpp:1.43 llvm/lib/Target/X86/Printer.cpp:1.44
--- llvm/lib/Target/X86/Printer.cpp:1.43 Fri Jul 11 13:18:35 2003
+++ llvm/lib/Target/X86/Printer.cpp Fri Jul 11 16:57:01 2003
@@ -943,6 +943,17 @@
return false; // success
}
+static const Function *isConstantFunctionPointerRef (const Constant *C) {
+ const ConstantPointerRef *R = dyn_cast(C);
+ if (R) {
+ const Function *F = dyn_cast(R->getValue());
+ if (F) {
+ return F;
+ }
+ }
+ return NULL;
+}
+
bool Printer::doFinalization(Module &M)
{
// Print out module-level global variables here.
@@ -956,7 +967,17 @@
O << "\t.size " << name << ","
<< (unsigned)TD->getTypeSize(I->getType()) << "\n";
O << "\t.align " << (unsigned)TD->getTypeAlignment(C->getType()) << "\n";
- O << name << ":\t\t\t\t\t#" << *C << "\n";
+ O << name << ":\t\t\t\t\t#";
+ // If this is a constant function pointer, we only print out the
+ // name of the function in the comment (because printing the
+ // function means calling AsmWriter to print the whole LLVM
+ // assembly, which would corrupt the X86 assembly output.)
+ // Otherwise we print out the whole llvm value as a comment.
+ if (const Function *F = isConstantFunctionPointerRef (C)) {
+ O << " %" << F->getName() << "()\n";
+ } else {
+ O << *C << "\n";
+ }
printConstantValueOnly (C);
} else {
O << "\t.globl " << name << "\n";
From vadve at cs.uiuc.edu Fri Jul 11 17:03:00 2003
From: vadve at cs.uiuc.edu (Vikram Adve)
Date: Fri Jul 11 17:03:00 2003
Subject: [llvm-commits] CVS: llvm/test/Libraries/libinstr/tracelib.c
Message-ID: <200307112202.RAA15361@psmith.cs.uiuc.edu>
Changes in directory llvm/test/Libraries/libinstr:
tracelib.c updated: 1.5 -> 1.6
---
Log message:
Use uint32_t for table index and size: table will never be > 4GB.
Also, make Pointer type depend on architecture.
---
Diffs of the changes:
Index: llvm/test/Libraries/libinstr/tracelib.c
diff -u llvm/test/Libraries/libinstr/tracelib.c:1.5 llvm/test/Libraries/libinstr/tracelib.c:1.6
--- llvm/test/Libraries/libinstr/tracelib.c:1.5 Tue Jul 8 13:42:44 2003
+++ llvm/test/Libraries/libinstr/tracelib.c Fri Jul 11 17:02:28 2003
@@ -20,25 +20,29 @@
/* use #defines until we have inlining */
-typedef int64_t Generic;
-typedef uint64_t Index;
-typedef uint64_t Pointer;
+#ifndef sun
+typedef uint32_t Pointer; /* int representation of a pointer */
+#else
+typedef uint64_t Pointer; /* int representation of a pointer */
+#endif
+typedef uint32_t Index; /* type of index/size for hash table */
+typedef uint32_t Generic; /* type of values stored in table */
/* Index IntegerHashFunc(const Generic value, const Index size) */
#define IntegerHashFunc(value, size) \
- (((value << 3) ^ (value >> 3)) % size)
+ ( ((((Index) value) << 3) ^ (((Index) value) >> 3)) % size )
/* Index IntegerRehashFunc(const Generic oldHashValue, const Index size) */
#define IntegerRehashFunc(oldHashValue, size) \
- ((oldHashValue+16) % size) /* 16 is relatively prime to a Mersenne prime! */
+ ((Index) ((oldHashValue+16) % size)) /* 16 is relatively prime to a Mersenne prime! */
/* Index PointerHashFunc(const void* value, const Index size) */
#define PointerHashFunc(value, size) \
- IntegerHashFunc((Pointer) value, size)
+ IntegerHashFunc((Index) value, size)
/* Index PointerRehashFunc(const void* value, const Index size) */
#define PointerRehashFunc(value, size) \
- IntegerRehashFunc((Pointer) value, size)
+ IntegerRehashFunc((Index) value, size)
/*===---------------------------------------------------------------------=====
@@ -375,7 +379,7 @@
/* print sequence numbers out again to compare with (-r) and w/o release */
for (i=argc-1; i >= 0; --i)
for (j=0; argv[i][j]; ++j)
- printf("Sequence number for argc[%d][%d] (%c) = Hash(%p) = %d\n",
+ printf("Sequence number for argc[%d][%d] (%c) = %d\n",
i, j, argv[i][j], argv[i]+j, HashPointerToSeqNum(argv[i]+j));
return 0;