[llvm-commits] CVS: llvm/test/Regression/CodeGen/Alpha/jmp_table.ll

2006-09-25 Thread Andrew Lenharth


Changes in directory llvm/test/Regression/CodeGen/Alpha:

jmp_table.ll updated: 1.1 -> 1.2
---
Log message:

Fix

---
Diffs of the changes:  (+2 -2)

 jmp_table.ll |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm/test/Regression/CodeGen/Alpha/jmp_table.ll
diff -u llvm/test/Regression/CodeGen/Alpha/jmp_table.ll:1.1 
llvm/test/Regression/CodeGen/Alpha/jmp_table.ll:1.2
--- llvm/test/Regression/CodeGen/Alpha/jmp_table.ll:1.1 Sun Sep 24 14:42:02 2006
+++ llvm/test/Regression/CodeGen/Alpha/jmp_table.ll Mon Sep 25 09:04:53 2006
@@ -1,6 +1,6 @@
 ; try to check that we have the most important instructions, which shouldn't 
appear otherwise
-; RUN: llvm-as < %s | llc -march=alpha | grep 'jmp'
-; RUN: llvm-as < %s | llc -march=alpha | grep 'gprel32'
+; RUN: llvm-as < %s | llc -march=alpha | grep 'jmp' &&
+; RUN: llvm-as < %s | llc -march=alpha | grep 'gprel32' &&
 ; RUN: llvm-as < %s | llc -march=alpha | grep 'ldl'
 
 target endian = little



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

2006-09-25 Thread Jim Laskey


Changes in directory llvm/lib/CodeGen/SelectionDAG:

DAGCombiner.cpp updated: 1.197 -> 1.198
---
Log message:

Core antialiasing for load and store.

---
Diffs of the changes:  (+282 -53)

 DAGCombiner.cpp |  335 +++-
 1 files changed, 282 insertions(+), 53 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.197 
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.198
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.197 Thu Sep 21 14:04:05 2006
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp   Mon Sep 25 11:29:54 2006
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 using namespace llvm;
 
 namespace {
@@ -132,7 +133,8 @@
   // Replace the old value with the new one.
   ++NodesCombined;
   DEBUG(std::cerr << "\nReplacing "; TLO.Old.Val->dump();
-std::cerr << "\nWith: "; TLO.New.Val->dump(&DAG));
+std::cerr << "\nWith: "; TLO.New.Val->dump(&DAG);
+std::cerr << '\n');
 
   std::vector NowDead;
   DAG.ReplaceAllUsesOfValueWith(TLO.Old, TLO.New, NowDead);
@@ -237,7 +239,31 @@
 SDOperand BuildSDIV(SDNode *N);
 SDOperand BuildUDIV(SDNode *N);
 SDNode *MatchRotate(SDOperand LHS, SDOperand RHS);
-bool isNotAlias(SDOperand Ptr1, SDOperand Ptr2);
+
+/// FindBaseOffset - Return true if we can determine base and offset
+/// information from a given pointer operand.  Provides base and offset as 
a
+/// result.
+static bool FindBaseOffset(SDOperand Ptr,
+   SDOperand &Object, int64_t &Offset);
+
+/// isAlias - Return true if there is the possibility that the two 
addresses
+/// overlap.
+static bool isAlias(SDOperand Ptr1, int64_t Size1, SDOperand SrcValue1,
+SDOperand Ptr2, int64_t Size2, SDOperand SrcValue2);
+
+/// FindAliasInfo - Extracts the relevant alias information from the memory
+/// node.
+static void FindAliasInfo(SDNode *N,
+   SDOperand &Ptr, int64_t &Size, SDOperand &SrcValue);
+
+/// hasChain - Return true if Op has a chain.  Provides chain if present.
+///
+static bool hasChain(SDOperand Op, SDOperand &Chain);
+ 
+/// FindBetterChain - Walk up chain skipping non-aliasing memory nodes,
+/// looking for a better chain.
+SDOperand FindBetterChain(SDNode *N, SDOperand Chain);
+
 public:
 DAGCombiner(SelectionDAG &D)
   : DAG(D), TLI(D.getTargetLoweringInfo()), AfterLegalize(false) {}
@@ -507,9 +533,6 @@
 }
 
 SDOperand DAGCombiner::visitTokenFactor(SDNode *N) {
-  SmallVector Ops;
-  bool Changed = false;
-
   // If the token factor has two operands and one is the entry token, replace
   // the token factor with the other operand.
   if (N->getNumOperands() == 2) {
@@ -520,23 +543,69 @@
   return N->getOperand(0);
   }
   
-  // fold (tokenfactor (tokenfactor)) -> tokenfactor
-  for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) {
+  SmallVector TFs;   // Set of token factor nodes.
+  SmallVector Ops;  // Ops for replacing token factor.
+
+  // Add this ndoe to the token factor set.
+  TFs.push_back(N);
+
+  // Separate token factors from other operands.
+  for (unsigned i = 0, ie = N->getNumOperands(); i != ie; ++i) {
 SDOperand Op = N->getOperand(i);
-if (Op.getOpcode() == ISD::TokenFactor && Op.hasOneUse()) {
-  AddToWorkList(Op.Val);  // Remove dead node.
-  Changed = true;
-  for (unsigned j = 0, e = Op.getNumOperands(); j != e; ++j)
-Ops.push_back(Op.getOperand(j));
-} else if (i == 0 || N->getOperand(i) != N->getOperand(i-1)) {
+if (Op.getOpcode() == ISD::TokenFactor)
+  TFs.push_back(Op.Val);
+else if (Op.getOpcode() != ISD::EntryToken)
   Ops.push_back(Op);
-} else {
-  // Deleted an operand that was the same as the last one.
-  Changed = true;
+  }
+  
+  // If there are token factor operands.
+  if (TFs.size() > 1) {
+bool Changed = false; // If we should replace this token factor.
+
+// For each token factor.
+for (unsigned j = 1, je = TFs.size(); j != je; ++j) {
+  SDNode *TF = TFs[j];
+  bool CanMerge = true; // Can we merge this token factor.
+  
+  if (CombinerAA) {
+if (!TF->hasOneUse()) {
+  // Check to see if all users point to members of the token factor 
set.
+  for (SDNode::use_iterator UI = TF->use_begin(), UE = TF->use_end();
+   CanMerge && UI != UE; ++UI) {
+SDNode *User = *UI;
+CanMerge = User->getOpcode() == ISD::TokenFactor &&
+   std::find(TFs.begin(), TFs.end(), User) != TFs.end();
+  }
+}
+  } else {
+CanMerge = TF->hasOneUse();
+  }
+  
+  // If it's valid to merge.
+  if (CanMerge) {
+// Remove dead token factor node.
+AddToWorkList(TF); 
+
+   

[llvm-commits] CVS: llvm/lib/Target/README.txt

2006-09-25 Thread Chris Lattner


Changes in directory llvm/lib/Target:

README.txt updated: 1.40 -> 1.41
---
Log message:

more notes


---
Diffs of the changes:  (+22 -0)

 README.txt |   22 ++
 1 files changed, 22 insertions(+)


Index: llvm/lib/Target/README.txt
diff -u llvm/lib/Target/README.txt:1.40 llvm/lib/Target/README.txt:1.41
--- llvm/lib/Target/README.txt:1.40 Tue Sep 19 01:19:03 2006
+++ llvm/lib/Target/README.txt  Mon Sep 25 12:12:14 2006
@@ -264,3 +264,25 @@
 alas...
 
 //===-===//
+
+This isn't recognized as bswap by instcombine:
+
+unsigned int swap_32(unsigned int v) {
+  v = ((v & 0x00ff00ffU) << 8)  | ((v & 0xff00ff00U) >> 8);
+  v = ((v & 0xU) << 16) | ((v & 0xU) >> 16);
+  return v;
+}
+
+//===-===//
+
+These should turn into single 16-bit (unaligned?) loads on little/big endian
+processors.
+
+unsigned short read_16_le(const unsigned char *adr) {
+  return adr[0] | (adr[1] << 8);
+}
+unsigned short read_16_be(const unsigned char *adr) {
+  return (adr[0] << 8) | adr[1];
+}
+
+//===-===//



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm-gcc/gcc/llvm-out.c

2006-09-25 Thread John Criswell


Changes in directory llvm-gcc/gcc:

llvm-out.c updated: 1.10 -> 1.11
---
Log message:

Fix for PR#922.
Do not re-assign the input locations when expanding statements; the
original GCC code does not do this, and removing this statement generates
correct filename output for LLVM debugging intrinsics.


---
Diffs of the changes:  (+0 -1)

 llvm-out.c |1 -
 1 files changed, 1 deletion(-)


Index: llvm-gcc/gcc/llvm-out.c
diff -u llvm-gcc/gcc/llvm-out.c:1.10 llvm-gcc/gcc/llvm-out.c:1.11
--- llvm-gcc/gcc/llvm-out.c:1.10Wed Dec  1 01:09:25 2004
+++ llvm-gcc/gcc/llvm-out.c Mon Sep 25 13:11:43 2006
@@ -136,7 +136,6 @@
   assert(nested_p == 0 && "Does not handle nested functions yet!");
 
   current_function_decl = fndecl;
-  input_location = DECL_SOURCE_LOCATION (fndecl);
 
   /* Warn if this value is an aggregate type,
  regardless of which calling convention we are using for it.  */



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/test/Regression/CFrontend/2006-09-25-DebugFilename.c.tr 2006-09-25-DebugFilename.h

2006-09-25 Thread John Criswell


Changes in directory llvm/test/Regression/CFrontend:

2006-09-25-DebugFilename.c.tr added (r1.1)
2006-09-25-DebugFilename.h added (r1.1)
---
Log message:

Regression test for PR#922.


---
Diffs of the changes:  (+11 -0)

 2006-09-25-DebugFilename.c.tr |5 +
 2006-09-25-DebugFilename.h|6 ++
 2 files changed, 11 insertions(+)


Index: llvm/test/Regression/CFrontend/2006-09-25-DebugFilename.c.tr
diff -c /dev/null 
llvm/test/Regression/CFrontend/2006-09-25-DebugFilename.c.tr:1.1
*** /dev/null   Mon Sep 25 14:12:11 2006
--- llvm/test/Regression/CFrontend/2006-09-25-DebugFilename.c.trMon Sep 
25 14:12:01 2006
***
*** 0 
--- 1,5 
+ // RUN: %llvmgcc -xc %s -S -o /dev/null 2>&1 | grep fluffy | grep 
'2006-09-25-DebugFilename.c.tr'
+ #include "2006-09-25-DebugFilename.h"
+ int func1() { return hfunc1(); }
+ int func2() { fluffy; return hfunc1(); }
+ 


Index: llvm/test/Regression/CFrontend/2006-09-25-DebugFilename.h
diff -c /dev/null llvm/test/Regression/CFrontend/2006-09-25-DebugFilename.h:1.1
*** /dev/null   Mon Sep 25 14:12:27 2006
--- llvm/test/Regression/CFrontend/2006-09-25-DebugFilename.h   Mon Sep 25 
14:12:01 2006
***
*** 0 
--- 1,6 
+ extern int exfunc(int a);
+ 
+ static inline int hfunc1()
+ {
+   return exfunc(1);
+ }



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

2006-09-25 Thread Jim Laskey


Changes in directory llvm/lib/CodeGen/SelectionDAG:

DAGCombiner.cpp updated: 1.198 -> 1.199
---
Log message:

Fix chain dropping in load and drop unused stores in ret blocks.

---
Diffs of the changes:  (+14 -7)

 DAGCombiner.cpp |   21 ++---
 1 files changed, 14 insertions(+), 7 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.198 
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.199
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.198 Mon Sep 25 11:29:54 2006
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp   Mon Sep 25 14:32:58 2006
@@ -2650,13 +2650,13 @@
   SDOperand ReplLoad = DAG.getLoad(N->getValueType(0), BetterChain, Ptr,
SrcValue);
 
-  // Replace uses with token.
-  CombineTo(N, ReplLoad.getValue(0), ReplLoad.getValue(1));
-  
-  // Old chain needs to be cleaned up.
-  AddToWorkList(Chain.Val);
-  
-  // Don't recombine on token.
+  // Create token factor to keep chain around.
+  SDOperand Token = DAG.getNode(ISD::TokenFactor, MVT::Other,
+Chain, ReplLoad.getValue(1));
+
+  // Replace uses with load and token factor.
+  CombineTo(N, ReplLoad.getValue(0), Token);
+
   return SDOperand(N, 0);
 }
   }
@@ -2712,6 +2712,13 @@
   }
   
   if (CombinerAA) { 
+// If the store ptr is a frame index and the frame index has a use of one
+// and this is a return block, then the store is redundant.
+if (Ptr.hasOneUse() && isa(Ptr) &&
+DAG.getRoot().getOpcode() == ISD::RET) {
+  return Chain;
+}
+
 // Walk up chain skipping non-aliasing memory nodes.
 SDOperand BetterChain = FindBetterChain(N, Chain);
 



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

2006-09-25 Thread Jim Laskey


Changes in directory llvm/lib/CodeGen/SelectionDAG:

DAGCombiner.cpp updated: 1.199 -> 1.200
---
Log message:

Accidental enable of bad code

---
Diffs of the changes:  (+1 -1)

 DAGCombiner.cpp |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.199 
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.200
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.199 Mon Sep 25 14:32:58 2006
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp   Mon Sep 25 16:11:32 2006
@@ -2706,7 +2706,7 @@
   // If this is a store of a bit convert, store the input value.
   // FIXME: This needs to know that the resultant store does not need a 
   // higher alignment than the original.
-  if (Value.getOpcode() == ISD::BIT_CONVERT) {
+  if (0 && Value.getOpcode() == ISD::BIT_CONVERT) {
 return DAG.getNode(ISD::STORE, MVT::Other, Chain, Value.getOperand(0),
Ptr, SrcValue);
   }



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm-test/Makefile.tests

2006-09-25 Thread Chris Lattner


Changes in directory llvm-test:

Makefile.tests updated: 1.8 -> 1.9
---
Log message:

Make llvm-test results more closely match the performance a person would get
by running llvm-gcc -O4.  In particular, do not run the compile-time optimizer
both within llvm-gcc and as a separate gccas invocation.


---
Diffs of the changes:  (+4 -4)

 Makefile.tests |8 
 1 files changed, 4 insertions(+), 4 deletions(-)


Index: llvm-test/Makefile.tests
diff -u llvm-test/Makefile.tests:1.8 llvm-test/Makefile.tests:1.9
--- llvm-test/Makefile.tests:1.8Tue Jun  6 19:05:16 2006
+++ llvm-test/Makefile.testsMon Sep 25 17:22:49 2006
@@ -50,19 +50,19 @@
 
 # Compile from X.c to Output/X.ll
 Output/%.ll: %.c $(LCC1) Output/.dir $(INCLUDES)
-   -$(LLVMGCC) $(CPPFLAGS) $(LCCFLAGS) $(TARGET_FLAGS) -S $< -o $@ 
-emit-llvm
+   -$(LLVMGCC) $(CPPFLAGS) $(LCCFLAGS) $(TARGET_FLAGS) -O0 -S $< -o $@ 
-emit-llvm
 
 # Compile from X.cpp to Output/X.ll
 Output/%.ll: %.cpp $(LCC1XX) Output/.dir $(INCLUDES)
-   -$(LLVMGXX) $(CPPFLAGS) $(LCXXFLAGS) $(TARGET_FLAGS) -S $< -o $@ 
-emit-llvm
+   -$(LLVMGXX) $(CPPFLAGS) $(LCXXFLAGS) $(TARGET_FLAGS) -O0 -S $< -o $@ 
-emit-llvm
 
 # Compile from X.cc to Output/X.ll
 Output/%.ll: %.cc $(LCC1XX) Output/.dir $(INCLUDES)
-   -$(LLVMGXX) $(CPPFLAGS) $(LCXXFLAGS) $(TARGET_FLAGS) -S $< -o $@ 
-emit-llvm
+   -$(LLVMGXX) $(CPPFLAGS) $(LCXXFLAGS) $(TARGET_FLAGS) -O0 -S $< -o $@ 
-emit-llvm
 
 # Compile from X.C to Output/X.ll
 Output/%.ll: %.C $(LCC1XX) Output/.dir $(INCLUDES)
-   -$(LLVMGXX) $(CPPFLAGS) $(LCXXFLAGS) $(TARGET_FLAGS) -S $< -o $@ 
-emit-llvm
+   -$(LLVMGXX) $(CPPFLAGS) $(LCXXFLAGS) $(TARGET_FLAGS) -O0 -S $< -o $@ 
-emit-llvm
 
 # LLVM Assemble from Output/X.ll to Output/X.bc.  Output/X.ll must have come
 # from GCC output, so use GCCAS.



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/include/llvm/Target/TargetAsmInfo.h

2006-09-25 Thread Chris Lattner


Changes in directory llvm/include/llvm/Target:

TargetAsmInfo.h updated: 1.3 -> 1.4
---
Log message:

order this properly to avoid warnings in TargetAsmInfo.cpp.  Add a comment
in a format that matches every other ivars in this class.



---
Diffs of the changes:  (+4 -1)

 TargetAsmInfo.h |5 -
 1 files changed, 4 insertions(+), 1 deletion(-)


Index: llvm/include/llvm/Target/TargetAsmInfo.h
diff -u llvm/include/llvm/Target/TargetAsmInfo.h:1.3 
llvm/include/llvm/Target/TargetAsmInfo.h:1.4
--- llvm/include/llvm/Target/TargetAsmInfo.h:1.3Sun Sep 24 14:43:29 2006
+++ llvm/include/llvm/Target/TargetAsmInfo.hMon Sep 25 17:38:36 2006
@@ -108,7 +108,6 @@
 const char *Data16bitsDirective;  // Defaults to "\t.short\t"
 const char *Data32bitsDirective;  // Defaults to "\t.long\t"
 const char *Data64bitsDirective;  // Defaults to "\t.quad\t"
-const char *JumpTableDirective;   // if used, the jump table reloc flag
 
 //===--- Alignment Information 
===//
 
@@ -156,6 +155,10 @@
 /// is PIC.
 const char *JumpTableTextSection; // Defaults to "\t.text\n"
 
+/// JumpTableDirective - if non-null, the directive to emit before a jump
+/// table.
+const char *JumpTableDirective;
+
 /// StaticCtorsSection - This is the directive that is emitted to switch to
 /// a section to emit the static constructor list.
 /// Defaults to "\t.section .ctors,\"aw\",@progbits".



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/include/llvm/CodeGen/AsmPrinter.h

2006-09-25 Thread Chris Lattner


Changes in directory llvm/include/llvm/CodeGen:

AsmPrinter.h updated: 1.48 -> 1.49
---
Log message:

Add support for targets that want to do something with the llvm.used list,
because they have an aggressive linker that does dead code stripping.


---
Diffs of the changes:  (+1 -0)

 AsmPrinter.h |1 +
 1 files changed, 1 insertion(+)


Index: llvm/include/llvm/CodeGen/AsmPrinter.h
diff -u llvm/include/llvm/CodeGen/AsmPrinter.h:1.48 
llvm/include/llvm/CodeGen/AsmPrinter.h:1.49
--- llvm/include/llvm/CodeGen/AsmPrinter.h:1.48 Tue Sep 12 15:59:22 2006
+++ llvm/include/llvm/CodeGen/AsmPrinter.h  Mon Sep 25 22:38:18 2006
@@ -197,6 +197,7 @@
 void printDataDirective(const Type *type);
 
   private:
+void EmitLLVMUsedList(Constant *List);
 void EmitXXStructorList(Constant *List);
 void EmitConstantPool(unsigned Alignment, const char *Section,
 std::vector > 
&CP);



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/include/llvm/Target/TargetAsmInfo.h

2006-09-25 Thread Chris Lattner


Changes in directory llvm/include/llvm/Target:

TargetAsmInfo.h updated: 1.4 -> 1.5
---
Log message:

Add support for targets that want to do something with the llvm.used list,
because they have an aggressive linker that does dead code stripping.


---
Diffs of the changes:  (+8 -0)

 TargetAsmInfo.h |8 
 1 files changed, 8 insertions(+)


Index: llvm/include/llvm/Target/TargetAsmInfo.h
diff -u llvm/include/llvm/Target/TargetAsmInfo.h:1.4 
llvm/include/llvm/Target/TargetAsmInfo.h:1.5
--- llvm/include/llvm/Target/TargetAsmInfo.h:1.4Mon Sep 25 17:38:36 2006
+++ llvm/include/llvm/Target/TargetAsmInfo.hMon Sep 25 22:38:18 2006
@@ -199,6 +199,11 @@
 /// directives, this is true for most ELF targets.
 bool HasDotTypeDotSizeDirective;  // Defaults to true.
 
+/// UsedDirective - This directive, if non-null, is used to declare a 
global
+/// as being used somehow that the assembler can't see.  This prevents dead
+/// code elimination on some targets.
+const char *UsedDirective;// Defaults to null.
+
 //===--- Dwarf Emission Directives ---===//
 
 /// HasLEB128 - True if target asm supports leb128 directives.
@@ -387,6 +392,9 @@
 bool hasDotTypeDotSizeDirective() const {
   return HasDotTypeDotSizeDirective;
 }
+const char *getUsedDirective() const {
+  return UsedDirective;
+}
 bool hasLEB128() const {
   return HasLEB128;
 }



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp

2006-09-25 Thread Chris Lattner


Changes in directory llvm/lib/CodeGen:

AsmPrinter.cpp updated: 1.98 -> 1.99
---
Log message:

Add support for targets that want to do something with the llvm.used list,
because they have an aggressive linker that does dead code stripping.


---
Diffs of the changes:  (+21 -2)

 AsmPrinter.cpp |   23 +--
 1 files changed, 21 insertions(+), 2 deletions(-)


Index: llvm/lib/CodeGen/AsmPrinter.cpp
diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.98 
llvm/lib/CodeGen/AsmPrinter.cpp:1.99
--- llvm/lib/CodeGen/AsmPrinter.cpp:1.98Sun Sep 24 14:44:59 2006
+++ llvm/lib/CodeGen/AsmPrinter.cpp Mon Sep 25 22:38:18 2006
@@ -253,8 +253,11 @@
 
   assert(GV->hasInitializer() && "Not a special LLVM global!");
   
-  if (GV->getName() == "llvm.used")
-return true;  // No need to emit this at all.
+  if (GV->getName() == "llvm.used") {
+if (TAI->getUsedDirective() != 0)// No need to emit this at all.
+  EmitLLVMUsedList(GV->getInitializer());
+return true;
+  }
 
   if (GV->getName() == "llvm.global_ctors" && GV->use_empty()) {
 SwitchToDataSection(TAI->getStaticCtorsSection(), 0);
@@ -273,6 +276,22 @@
   return false;
 }
 
+/// EmitLLVMUsedList - For targets that define a TAI::UsedDirective, mark each
+/// global in the specified llvm.used list as being used with this directive.
+void AsmPrinter::EmitLLVMUsedList(Constant *List) {
+  const char *Directive = TAI->getUsedDirective();
+
+  // Should be an array of 'sbyte*'.
+  ConstantArray *InitList = dyn_cast(List);
+  if (InitList == 0) return;
+  
+  for (unsigned i = 0, e = InitList->getNumOperands(); i != e; ++i) {
+O << Directive;
+EmitConstantValueOnly(InitList->getOperand(i));
+O << "\n";
+  }
+}
+
 /// EmitXXStructorList - Emit the ctor or dtor list.  This just prints out the 
 /// function pointers, ignoring the init priority.
 void AsmPrinter::EmitXXStructorList(Constant *List) {



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp

2006-09-25 Thread Chris Lattner


Changes in directory llvm/lib/Target/PowerPC:

PPCTargetAsmInfo.cpp updated: 1.2 -> 1.3
---
Log message:

Compile:
int x __attribute__((used));

to:

.data
.comm _x,4  ; 'x'
.no_dead_strip  _x

on both x86 and ppc darwin targets.



---
Diffs of the changes:  (+1 -0)

 PPCTargetAsmInfo.cpp |1 +
 1 files changed, 1 insertion(+)


Index: llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
diff -u llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.2 
llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.3
--- llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.2Fri Sep  8 08:06:56 2006
+++ llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cppMon Sep 25 22:39:53 2006
@@ -32,6 +32,7 @@
   LCOMMDirective = "\t.lcomm\t";
   StaticCtorsSection = ".mod_init_func";
   StaticDtorsSection = ".mod_term_func";
+  UsedDirective = "\t.no_dead_strip\t";
   InlineAsmStart = "# InlineAsm Start";
   InlineAsmEnd = "# InlineAsm End";
   



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Target/X86/X86TargetAsmInfo.cpp

2006-09-25 Thread Chris Lattner


Changes in directory llvm/lib/Target/X86:

X86TargetAsmInfo.cpp updated: 1.2 -> 1.3
---
Log message:

Compile:
int x __attribute__((used));

to:

.data
.comm _x,4  ; 'x'
.no_dead_strip  _x

on both x86 and ppc darwin targets.



---
Diffs of the changes:  (+1 -0)

 X86TargetAsmInfo.cpp |1 +
 1 files changed, 1 insertion(+)


Index: llvm/lib/Target/X86/X86TargetAsmInfo.cpp
diff -u llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.2 
llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.3
--- llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.2Fri Sep  8 01:48:29 2006
+++ llvm/lib/Target/X86/X86TargetAsmInfo.cppMon Sep 25 22:39:53 2006
@@ -44,6 +44,7 @@
 InlineAsmStart = "# InlineAsm Start";
 InlineAsmEnd = "# InlineAsm End";
 SetDirective = "\t.set";
+UsedDirective = "\t.no_dead_strip\t";
 
 NeedsSet = true;
 DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug";



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Target/TargetAsmInfo.cpp

2006-09-25 Thread Chris Lattner


Changes in directory llvm/lib/Target:

TargetAsmInfo.cpp updated: 1.3 -> 1.4
---
Log message:

Add support for targets that want to do something with the llvm.used list,
because they have an aggressive linker that does dead code stripping.


---
Diffs of the changes:  (+1 -0)

 TargetAsmInfo.cpp |1 +
 1 files changed, 1 insertion(+)


Index: llvm/lib/Target/TargetAsmInfo.cpp
diff -u llvm/lib/Target/TargetAsmInfo.cpp:1.3 
llvm/lib/Target/TargetAsmInfo.cpp:1.4
--- llvm/lib/Target/TargetAsmInfo.cpp:1.3   Sun Sep 24 14:45:58 2006
+++ llvm/lib/Target/TargetAsmInfo.cpp   Mon Sep 25 22:38:18 2006
@@ -58,6 +58,7 @@
   COMMDirective("\t.comm\t"),
   COMMDirectiveTakesAlignment(true),
   HasDotTypeDotSizeDirective(true),
+  UsedDirective(0),
   HasLEB128(false),
   HasDotLoc(false),
   HasDotFile(false),



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/CodeGen/MachineBasicBlock.cpp

2006-09-25 Thread Chris Lattner


Changes in directory llvm/lib/CodeGen:

MachineBasicBlock.cpp updated: 1.28 -> 1.29
---
Log message:

print the preds of each MBB


---
Diffs of the changes:  (+8 -0)

 MachineBasicBlock.cpp |8 
 1 files changed, 8 insertions(+)


Index: llvm/lib/CodeGen/MachineBasicBlock.cpp
diff -u llvm/lib/CodeGen/MachineBasicBlock.cpp:1.28 
llvm/lib/CodeGen/MachineBasicBlock.cpp:1.29
--- llvm/lib/CodeGen/MachineBasicBlock.cpp:1.28 Fri May 12 01:33:48 2006
+++ llvm/lib/CodeGen/MachineBasicBlock.cpp  Mon Sep 25 22:41:59 2006
@@ -97,6 +97,14 @@
   if (LBB)
 OS << "\n" << LBB->getName() << " (" << (const void*)this
<< ", LLVM BB @" << (const void*) LBB << "):\n";
+  // Print the preds of this block according to the CFG.
+  if (!pred_empty()) {
+OS << "Predecessors according to CFG:";
+for (const_pred_iterator PI = pred_begin(), E = pred_end(); PI != E; ++PI)
+  OS << " " << *PI;
+OS << "\n";
+  }
+  
   for (const_iterator I = begin(); I != end(); ++I) {
 OS << "\t";
 I->print(OS, &getParent()->getTarget());



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/darwin-no-dead-strip.ll

2006-09-25 Thread Chris Lattner


Changes in directory llvm/test/Regression/CodeGen/X86:

darwin-no-dead-strip.ll added (r1.1)
---
Log message:

test that the no_dead_strip directive is emitted on darwin-x86


---
Diffs of the changes:  (+7 -0)

 darwin-no-dead-strip.ll |7 +++
 1 files changed, 7 insertions(+)


Index: llvm/test/Regression/CodeGen/X86/darwin-no-dead-strip.ll
diff -c /dev/null llvm/test/Regression/CodeGen/X86/darwin-no-dead-strip.ll:1.1
*** /dev/null   Mon Sep 25 22:44:30 2006
--- llvm/test/Regression/CodeGen/X86/darwin-no-dead-strip.llMon Sep 25 
22:44:20 2006
***
*** 0 
--- 1,7 
+ ; RUN: llvm-as < %s | llc | grep no_dead_strip
+ 
+ target endian = little
+ target pointersize = 32
+ target triple = "i686-apple-darwin8.7.2"
+ %x = weak global int 0  ;  [#uses=1]
+ %llvm.used = appending global [1 x sbyte*] [ sbyte* cast (int* %x to sbyte*) ]



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp X86AsmPrinter.cpp X86AsmPrinter.h X86ISelLowering.cpp X86IntelAsmPrinter.cpp X86MachineFunctionInfo.h

2006-09-25 Thread Chris Lattner


Changes in directory llvm/lib/Target/X86:

X86ATTAsmPrinter.cpp updated: 1.64 -> 1.65
X86AsmPrinter.cpp updated: 1.199 -> 1.200
X86AsmPrinter.h updated: 1.32 -> 1.33
X86ISelLowering.cpp updated: 1.263 -> 1.264
X86IntelAsmPrinter.cpp updated: 1.57 -> 1.58
X86MachineFunctionInfo.h updated: 1.3 -> 1.4
---
Log message:

Various random and minor code cleanups.


---
Diffs of the changes:  (+39 -56)

 X86ATTAsmPrinter.cpp |7 ++--
 X86AsmPrinter.cpp|   67 ++-
 X86AsmPrinter.h  |7 ++--
 X86ISelLowering.cpp  |5 +--
 X86IntelAsmPrinter.cpp   |7 ++--
 X86MachineFunctionInfo.h |2 -
 6 files changed, 39 insertions(+), 56 deletions(-)


Index: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.64 
llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.65
--- llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.64   Wed Sep 20 17:03:51 2006
+++ llvm/lib/Target/X86/X86ATTAsmPrinter.cppMon Sep 25 22:57:53 2006
@@ -48,9 +48,8 @@
 
   // Populate function information map.  Actually, We don't want to populate
   // non-stdcall or non-fastcall functions' information right now.
-  if (CC == CallingConv::X86_StdCall || CC == CallingConv::X86_FastCall) {
-FunctionInfoMap[F] = *(MF.getInfo());
-  }
+  if (CC == CallingConv::X86_StdCall || CC == CallingConv::X86_FastCall)
+FunctionInfoMap[F] = *MF.getInfo();
 
   X86SharedAsmPrinter::decorateName(CurrentFnName, F);
 
@@ -200,7 +199,7 @@
 bool isExt = (GV->isExternal() || GV->hasWeakLinkage() ||
   GV->hasLinkOnceLinkage());
 
-X86SharedAsmPrinter::decorateName(Name, (Function*)GV);
+X86SharedAsmPrinter::decorateName(Name, GV);
 
 if (X86PICStyle == PICStyle::Stub &&
 TM.getRelocationModel() != Reloc::Static) {


Index: llvm/lib/Target/X86/X86AsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.199 
llvm/lib/Target/X86/X86AsmPrinter.cpp:1.200
--- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.199 Wed Sep 20 17:03:51 2006
+++ llvm/lib/Target/X86/X86AsmPrinter.cpp   Mon Sep 25 22:57:53 2006
@@ -33,88 +33,75 @@
 Statistic<> llvm::EmittedInsts("asm-printer",
"Number of machine instrs printed");
 
-static X86FunctionInfo calculateFunctionInfo(const Function* F,
- const TargetData* TD) 
-{
+static X86FunctionInfo calculateFunctionInfo(const Function *F,
+ const TargetData *TD) {
   X86FunctionInfo Info;
-  uint64_t size = 0;
+  uint64_t Size = 0;
   
   switch (F->getCallingConv()) {
-   case CallingConv::X86_StdCall:
+  case CallingConv::X86_StdCall:
 Info.setDecorationStyle(StdCall);
 break;
-   case CallingConv::X86_FastCall:
+  case CallingConv::X86_FastCall:
 Info.setDecorationStyle(FastCall);
 break;
-   default:
+  default:
 return Info;
   }
 
-  for (Function::const_arg_iterator AI = F->arg_begin(),
-AE = F->arg_end();
-   AI != AE;
-   ++AI) {
-size += TD->getTypeSize(AI->getType());
-  }
+  for (Function::const_arg_iterator AI = F->arg_begin(), AE = F->arg_end();
+   AI != AE; ++AI)
+Size += TD->getTypeSize(AI->getType());
 
   // We're not supporting to huge arguments :)
-  Info.setBytesToPopOnReturn((unsigned int)size);
-
+  Info.setBytesToPopOnReturn((unsigned int)Size);
   return Info;
 }
 
 
-// Query FunctionInfoMap and use this information for various name decoration
-void X86SharedAsmPrinter::decorateName(std::string& Name, const GlobalValue* 
GV)
-{
-  const X86FunctionInfo* Info;
-  const Function* F;
-  
-  if ((F = dyn_cast(GV)) == NULL) {
-return;
-  }
-
-  unsigned CC = F->getCallingConv();
+/// decorateName - Query FunctionInfoMap and use this information for various
+/// name decoration.
+void X86SharedAsmPrinter::decorateName(std::string &Name,
+   const GlobalValue *GV) {
+  const Function *F = dyn_cast(GV);
+  if (!F) return;
 
   // We don't want to decorate non-stdcall or non-fastcall functions right now
-  if (CC != CallingConv::X86_StdCall && CC != CallingConv::X86_FastCall) {
+  unsigned CC = F->getCallingConv();
+  if (CC != CallingConv::X86_StdCall && CC != CallingConv::X86_FastCall)
 return;
-  }
 
   FMFInfoMap::const_iterator info_item = FunctionInfoMap.find(F);
 
+  const X86FunctionInfo *Info;
   if (info_item == FunctionInfoMap.end()) {
 // Calculate apropriate function info and populate map
 FunctionInfoMap[F] = calculateFunctionInfo(F, TM.getTargetData());
 Info = &FunctionInfoMap[F];
   } else {
-Info = &(info_item->second);
+Info = &info_item->second;
   }
 
   switch (Info->getDecorationStyle()) {
-   case None:
+  case None:
 break;
-   case StdCall:
-if (!F->isVarArg()) {
-  // Variadic functions do not receive @0 suffix
+  case StdCall:
+if (!F->isVarArg()) // Variadic fu