[llvm-commits] CVS: llvm/test/CodeGen/Alpha/2006-07-03-ASMFormalLowering.ll

2007-04-28 Thread Chris Lattner


Changes in directory llvm/test/CodeGen/Alpha:

2006-07-03-ASMFormalLowering.ll updated: 1.4 - 1.5
---
Log message:

update syntax


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

 2006-07-03-ASMFormalLowering.ll |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm/test/CodeGen/Alpha/2006-07-03-ASMFormalLowering.ll
diff -u llvm/test/CodeGen/Alpha/2006-07-03-ASMFormalLowering.ll:1.4 
llvm/test/CodeGen/Alpha/2006-07-03-ASMFormalLowering.ll:1.5
--- llvm/test/CodeGen/Alpha/2006-07-03-ASMFormalLowering.ll:1.4 Fri Dec  1 
22:23:08 2006
+++ llvm/test/CodeGen/Alpha/2006-07-03-ASMFormalLowering.ll Sat Apr 28 
01:00:10 2007
@@ -9,12 +9,12 @@
 int %_ZN9__gnu_cxx18__exchange_and_addEPVii(int* %__mem, int %__val) {
 entry:
 %__tmp = alloca int, align 4; int* [#uses=1]
-%tmp3 = call int asm sideeffect \0A$$Lxadd_0:\0A\09ldl_l  
$0,$3\0A\09addl   $0,$4,$1\0A\09stl_c  $1,$2\0A\09beq$1,$$Lxadd_0\0A\09mb, 
=r,==r,==m,m,r( int* %__tmp, int* %__mem, int* %__mem, int %__val ) 
 ; int [#uses=1]
+%tmp3 = call int asm sideeffect \0A$$Lxadd_0:\0A\09ldl_l  
$0,$3\0A\09addl   $0,$4,$1\0A\09stl_c  $1,$2\0A\09beq$1,$$Lxadd_0\0A\09mb, 
=r,=*r,=*m,m,r( int* %__tmp, int* %__mem, int* %__mem, int %__val ) 
 ; int [#uses=1]
 ret int %tmp3
 }
 
 void %_ZN9__gnu_cxx12__atomic_addEPVii(int* %__mem, int %__val) {
 entry:
-%tmp2 = call int asm sideeffect \0A$$Ladd_1:\0A\09ldl_l  
$0,$2\0A\09addl   $0,$3,$0\0A\09stl_c  $0,$1\0A\09beq$0,$$Ladd_1\0A\09mb, 
=r,==m,m,r( int* %__mem, int* %__mem, int %__val )  ; int 
[#uses=0]
+%tmp2 = call int asm sideeffect \0A$$Ladd_1:\0A\09ldl_l  
$0,$2\0A\09addl   $0,$3,$0\0A\09stl_c  $0,$1\0A\09beq$0,$$Ladd_1\0A\09mb, 
=r,=*m,m,r( int* %__mem, int* %__mem, int %__val )  ; int 
[#uses=0]
 ret void
 }



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


[llvm-commits] CVS: llvm/test/CodeGen/Generic/2006-12-16-InlineAsmCrash.ll

2007-04-28 Thread Chris Lattner


Changes in directory llvm/test/CodeGen/Generic:

2006-12-16-InlineAsmCrash.ll updated: 1.2 - 1.3
---
Log message:

update syntax


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

 2006-12-16-InlineAsmCrash.ll |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/test/CodeGen/Generic/2006-12-16-InlineAsmCrash.ll
diff -u llvm/test/CodeGen/Generic/2006-12-16-InlineAsmCrash.ll:1.2 
llvm/test/CodeGen/Generic/2006-12-16-InlineAsmCrash.ll:1.3
--- llvm/test/CodeGen/Generic/2006-12-16-InlineAsmCrash.ll:1.2  Fri Dec 29 
14:01:32 2006
+++ llvm/test/CodeGen/Generic/2006-12-16-InlineAsmCrash.ll  Sat Apr 28 
01:01:16 2007
@@ -27,7 +27,7 @@
%tmp62 = load %struct.QImageWriterPrivate** null; 
%struct.QImageWriterPrivate* [#uses=1]
%tmp = getelementptr %struct.QImageWriterPrivate* %tmp62, int 0, uint 9 
; %struct.QString* [#uses=1]
%tmp75 = call %struct.QString* %_ZN7QStringaSERKS_( %struct.QString* 
%tmp, %struct.QString* null )  ; %struct.QString* [#uses=0]
-   call void asm sideeffect lock\0Adecl $0\0Asetne 1, ==m( int* null )
+   call void asm sideeffect lock\0Adecl $0\0Asetne 1, =*m( int* null )
ret bool false
 }
 



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


[llvm-commits] CVS: llvm/test/Feature/aliases.ll

2007-04-28 Thread Chris Lattner


Changes in directory llvm/test/Feature:

aliases.ll updated: 1.1 - 1.2
---
Log message:

not fully implemented yet.


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

 aliases.ll |2 ++
 1 files changed, 2 insertions(+)


Index: llvm/test/Feature/aliases.ll
diff -u llvm/test/Feature/aliases.ll:1.1 llvm/test/Feature/aliases.ll:1.2
--- llvm/test/Feature/aliases.ll:1.1Wed Apr 25 09:27:10 2007
+++ llvm/test/Feature/aliases.llSat Apr 28 01:02:13 2007
@@ -2,6 +2,8 @@
 ; RUN: llvm-as %t1.ll -o - | llvm-dis  %t2.ll
 ; RUN: diff %t1.ll %t2.ll
 
+; XFAIL: *
+
 @bar = external global i32
 @foo1 = alias i32* @bar
 @foo2 = alias i32* @bar



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


[llvm-commits] CVS: llvm/test/Transforms/Inline/2007-04-15-InlineEH.ll

2007-04-28 Thread Chris Lattner


Changes in directory llvm/test/Transforms/Inline:

2007-04-15-InlineEH.ll updated: 1.1 - 1.2
---
Log message:

update syntax


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

 2007-04-15-InlineEH.ll |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/test/Transforms/Inline/2007-04-15-InlineEH.ll
diff -u llvm/test/Transforms/Inline/2007-04-15-InlineEH.ll:1.1 
llvm/test/Transforms/Inline/2007-04-15-InlineEH.ll:1.2
--- llvm/test/Transforms/Inline/2007-04-15-InlineEH.ll:1.1  Sun Apr 15 
16:37:53 2007
+++ llvm/test/Transforms/Inline/2007-04-15-InlineEH.ll  Sat Apr 28 01:03:12 2007
@@ -8,7 +8,7 @@
 
 define void @bc__support__high_resolution_time__clock() {
 entry:
-   call void asm rdtsc\0A\09movl %eax, $0\0A\09movl %edx, $1, 
==imr,==imr,~{dirflag},~{fpsr},~{flags},~{dx},~{ax}( i32* null, i32* null )
+   call void asm rdtsc\0A\09movl %eax, $0\0A\09movl %edx, $1, 
=*imr,=*imr,~{dirflag},~{fpsr},~{flags},~{dx},~{ax}( i32* null, i32* null )
unreachable
 }
 



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


[llvm-commits] CVS: llvm/test/CodeGen/Generic/2007-04-27-InlineAsm-X-Dest.ll

2007-04-28 Thread Chris Lattner


Changes in directory llvm/test/CodeGen/Generic:

2007-04-27-InlineAsm-X-Dest.ll added (r1.1)
---
Log message:

new testcase


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

 2007-04-27-InlineAsm-X-Dest.ll |8 
 1 files changed, 8 insertions(+)


Index: llvm/test/CodeGen/Generic/2007-04-27-InlineAsm-X-Dest.ll
diff -c /dev/null llvm/test/CodeGen/Generic/2007-04-27-InlineAsm-X-Dest.ll:1.1
*** /dev/null   Sat Apr 28 01:06:09 2007
--- llvm/test/CodeGen/Generic/2007-04-27-InlineAsm-X-Dest.llSat Apr 28 
01:05:59 2007
***
*** 0 
--- 1,8 
+ ; RUN: llvm-as  %s | llc
+ 
+ ; Test that we can have an X output constraint.
+ 
+ define void @test(i16 * %t) {
+ call void asm sideeffect fwait, 
=*X,~{dirflag},~{fpsr},~{flags},~{memory}( i16* %t )
+ ret void
+ }



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


[llvm-commits] CVS: llvm/test/CodeGen/Generic/2007-04-27-InlineAsm-X-Dest.ll

2007-04-28 Thread Chris Lattner


Changes in directory llvm/test/CodeGen/Generic:

2007-04-27-InlineAsm-X-Dest.ll updated: 1.1 - 1.2
---
Log message:

ensure the operand prints.


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

 2007-04-27-InlineAsm-X-Dest.ll |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/test/CodeGen/Generic/2007-04-27-InlineAsm-X-Dest.ll
diff -u llvm/test/CodeGen/Generic/2007-04-27-InlineAsm-X-Dest.ll:1.1 
llvm/test/CodeGen/Generic/2007-04-27-InlineAsm-X-Dest.ll:1.2
--- llvm/test/CodeGen/Generic/2007-04-27-InlineAsm-X-Dest.ll:1.1Sat Apr 
28 01:05:59 2007
+++ llvm/test/CodeGen/Generic/2007-04-27-InlineAsm-X-Dest.llSat Apr 28 
01:07:55 2007
@@ -3,6 +3,6 @@
 ; Test that we can have an X output constraint.
 
 define void @test(i16 * %t) {
-call void asm sideeffect fwait, 
=*X,~{dirflag},~{fpsr},~{flags},~{memory}( i16* %t )
+call void asm sideeffect foo $0, 
=*X,~{dirflag},~{fpsr},~{flags},~{memory}( i16* %t )
 ret void
 }



___
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/SelectionDAGISel.cpp

2007-04-28 Thread Chris Lattner


Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGISel.cpp updated: 1.432 - 1.433
---
Log message:

Fix CodeGen/Generic/2007-04-27-LargeMemObject.ll and
CodeGen/Generic/2007-04-27-InlineAsm-X-Dest.ll


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

 SelectionDAGISel.cpp |   14 ++
 1 files changed, 10 insertions(+), 4 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.432 
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.433
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.432Fri Apr 27 
23:05:59 2007
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp  Sat Apr 28 01:08:13 2007
@@ -3210,16 +3210,22 @@
 switch (Constraints[i].Type) {
 case InlineAsm::isOutput:
   if (!Constraints[i].isIndirect) {
+// The return value of the call is this value.
 assert(I.getType() != Type::VoidTy  Bad inline asm!);
 OpVT = TLI.getValueType(I.getType());
   } else {
 const Type *OpTy = I.getOperand(OpNum)-getType();
-OpVT = TLI.getValueType(castPointerType(OpTy)-getElementType());
+OpVT = 
TLI.getValueType(castPointerType(OpTy)-getElementType(),true);
 OpNum++;  // Consumes a call operand.
   }
   break;
 case InlineAsm::isInput:
-  OpVT = TLI.getValueType(I.getOperand(OpNum)-getType());
+  if (!Constraints[i].isIndirect) {
+OpVT = TLI.getValueType(I.getOperand(OpNum)-getType());
+  } else {
+const Type *OpTy = I.getOperand(OpNum)-getType();
+OpVT = 
TLI.getValueType(castPointerType(OpTy)-getElementType(),true);
+  }
   OpNum++;  // Consumes a call operand.
   break;
 case InlineAsm::isClobber:
@@ -3275,8 +3281,8 @@
   if (ConstraintCode.size() == 1)   // not a physreg name.
 CTy = TLI.getConstraintType(ConstraintCode);
   
-  if (CTy == TargetLowering::C_Memory) {
-// Memory output.
+  if (CTy != TargetLowering::C_RegisterClass) {
+// Memory output, or 'other' output (e.g. 'X' constraint).
 SDOperand InOperandVal = getValue(I.getOperand(OpNum));
 
 // Check that the operand (the address to store to) isn't a float.



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


[llvm-commits] CVS: llvm/test/CodeGen/X86/2007-04-27-InlineAsm-IntMemInput.ll

2007-04-28 Thread Chris Lattner


Changes in directory llvm/test/CodeGen/X86:

2007-04-27-InlineAsm-IntMemInput.ll added (r1.1)
---
Log message:

new testcase for PR1356: http://llvm.org/PR1356 


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

 2007-04-27-InlineAsm-IntMemInput.ll |   12 
 1 files changed, 12 insertions(+)


Index: llvm/test/CodeGen/X86/2007-04-27-InlineAsm-IntMemInput.ll
diff -c /dev/null llvm/test/CodeGen/X86/2007-04-27-InlineAsm-IntMemInput.ll:1.1
*** /dev/null   Sat Apr 28 01:41:23 2007
--- llvm/test/CodeGen/X86/2007-04-27-InlineAsm-IntMemInput.ll   Sat Apr 28 
01:41:13 2007
***
*** 0 
--- 1,12 
+ ; RUN: llvm-as  %s | llc | not grep {bsrl.*10}
+ ; PR1356
+ 
+ target datalayout = 
e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64
+ target triple = i686-apple-darwin8
+ 
+ define i32 @main() {
+ entry:
+ %tmp4 = tail call i32 asm bsrl  $1, $0, 
=r,ro,~{dirflag},~{fpsr},~{flags},~{cc}( i32 10 )   ; i32 [#uses=1]
+ ret i32 %tmp4
+ }
+ 



___
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/LegalizeDAG.cpp SelectionDAGISel.cpp

2007-04-28 Thread Chris Lattner


Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.490 - 1.491
SelectionDAGISel.cpp updated: 1.433 - 1.434
---
Log message:

memory inputs to an inline asm are required to have an address available.
If the operand is not already an indirect operand, spill it to a constant
pool entry or a stack slot.

This fixes PR1356: http://llvm.org/PR1356  and 
CodeGen/X86/2007-04-27-InlineAsm-IntMemInput.ll


---
Diffs of the changes:  (+34 -20)

 LegalizeDAG.cpp  |4 ++--
 SelectionDAGISel.cpp |   50 --
 2 files changed, 34 insertions(+), 20 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.490 
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.491
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.490 Fri Apr 27 12:12:52 2007
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp   Sat Apr 28 01:42:38 2007
@@ -3123,11 +3123,11 @@
 // slots and always reusing the same one.  We currently always create
 // new ones, as reuse may inhibit scheduling.
 const Type *Ty = MVT::getTypeForValueType(ExtraVT);
-unsigned TySize = (unsigned)TLI.getTargetData()-getTypeSize(Ty);
+uint64_t TySize = TLI.getTargetData()-getTypeSize(Ty);
 unsigned Align  = TLI.getTargetData()-getPrefTypeAlignment(Ty);
 MachineFunction MF = DAG.getMachineFunction();
 int SSFI =
-  MF.getFrameInfo()-CreateStackObject((unsigned)TySize, Align);
+  MF.getFrameInfo()-CreateStackObject(TySize, Align);
 SDOperand StackSlot = DAG.getFrameIndex(SSFI, TLI.getPointerTy());
 Result = DAG.getTruncStore(DAG.getEntryNode(), Node-getOperand(0),
StackSlot, NULL, 0, ExtraVT);


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.433 
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.434
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.433Sat Apr 28 
01:08:13 2007
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp  Sat Apr 28 01:42:38 2007
@@ -3397,6 +3397,9 @@
 CTy = TLI.getConstraintType(ConstraintCode);
 
   if (CTy == TargetLowering::C_Other) {
+assert(!Constraints[i].isIndirect  
+   Don't know how to handle indirect other inputs yet!);
+
 InOperandVal = TLI.isOperandValidForConstraint(InOperandVal,
ConstraintCode[0], DAG);
 if (!InOperandVal.Val) {
@@ -3411,26 +3414,35 @@
 AsmNodeOperands.push_back(InOperandVal);
 break;
   } else if (CTy == TargetLowering::C_Memory) {
-// Memory input.
-
-// If the operand is a float, spill to a constant pool entry to get its
-// address.
-if (ConstantFP *Val = dyn_castConstantFP(I.getOperand(OpNum-1)))
-  InOperandVal = DAG.getConstantPool(Val, TLI.getPointerTy());
-
-if (!MVT::isInteger(InOperandVal.getValueType())) {
-  cerr  Match failed, cannot handle this yet!\n;
-  InOperandVal.Val-dump();
-  exit(1);
+// Memory input.  Memory operands really want the address of the value,
+// so we want an indirect input.  If we don't have an indirect input,
+// spill the value somewhere if we can, otherwise spill it to a stack
+// slot.
+if (!Constraints[i].isIndirect) {
+  // If the operand is a float, integer, or vector constant, spill to a
+  // constant pool entry to get its address.
+  Value *OpVal = I.getOperand(OpNum-1);
+  if (isaConstantFP(OpVal) || isaConstantInt(OpVal) ||
+  isaConstantVector(OpVal)) {
+InOperandVal = DAG.getConstantPool(castConstant(OpVal),
+   TLI.getPointerTy());
+  } else {
+// Otherwise, create a stack slot and emit a store to it before the
+// asm.
+const Type *Ty = OpVal-getType();
+uint64_t TySize = TLI.getTargetData()-getTypeSize(Ty);
+unsigned Align  = TLI.getTargetData()-getPrefTypeAlignment(Ty);
+MachineFunction MF = DAG.getMachineFunction();
+int SSFI = MF.getFrameInfo()-CreateStackObject(TySize, Align);
+SDOperand StackSlot = DAG.getFrameIndex(SSFI, TLI.getPointerTy());
+Chain = DAG.getStore(Chain, InOperandVal, StackSlot, NULL, 0);
+InOperandVal = StackSlot;
+  }
 }
 
-// Extend/truncate to the right pointer type if needed.
-MVT::ValueType PtrType = TLI.getPointerTy();
-if (InOperandVal.getValueType()  PtrType)
-  InOperandVal = DAG.getNode(ISD::ZERO_EXTEND, PtrType, InOperandVal);
-else if (InOperandVal.getValueType()  PtrType)
-  InOperandVal = DAG.getNode(ISD::TRUNCATE, 

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

2007-04-28 Thread Anton Korobeynikov


Changes in directory llvm/lib/CodeGen:

AsmPrinter.cpp updated: 1.157 - 1.158
---
Log message:

Implement review feedback. Aliasees can be either GlobalValue's or 
bitcasts of them.


---
Diffs of the changes:  (+17 -6)

 AsmPrinter.cpp |   23 +--
 1 files changed, 17 insertions(+), 6 deletions(-)


Index: llvm/lib/CodeGen/AsmPrinter.cpp
diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.157 
llvm/lib/CodeGen/AsmPrinter.cpp:1.158
--- llvm/lib/CodeGen/AsmPrinter.cpp:1.157   Wed Apr 25 09:27:10 2007
+++ llvm/lib/CodeGen/AsmPrinter.cpp Sat Apr 28 08:44:59 2007
@@ -123,18 +123,29 @@
   }
 
   if (TAI-getSetDirective()) {
-if (M.alias_size())
+if (!M.alias_empty())
   SwitchToTextSection(TAI-getTextSection());
 
 O  \n;
 for (Module::const_alias_iterator I = M.alias_begin(), E = M.alias_end();
  I!=E; ++I) {
-  const GlobalValue *Aliasee = I-getAliasee();
-  assert(Aliasee  Aliasee cannot be null!);
-  std::string Target   = Mang-getValueName(Aliasee);
-  std::string Name = Mang-getValueName(I);
+  const Constant *Aliasee = dyn_cast_or_nullConstant(I-getAliasee());
+  assert(Aliasee  Aliasee cannot be null);
 
-  // Aliases with external weak linkage was emitted already
+  std::string Name = Mang-getValueName(I);
+  std::string Target;
+  
+  if (const GlobalValue *GV = dyn_castGlobalValue(Aliasee))
+Target = Mang-getValueName(GV);
+  else {
+const ConstantExpr *CE = 0;
+if ((CE = dyn_castConstantExpr(Aliasee)) 
+(CE-getOpcode() == Instruction::BitCast))
+  Target = Mang-getValueName(CE-getOperand(0));
+else
+  assert(0  Unsupported aliasee);
+  }
+  
   if (I-hasExternalLinkage())
 O  \t.globl\t  Name  \n;
   else if (I-hasWeakLinkage())



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


[llvm-commits] CVS: llvm/include/llvm/Function.h GlobalAlias.h GlobalValue.h GlobalVariable.h

2007-04-28 Thread Anton Korobeynikov


Changes in directory llvm/include/llvm:

Function.h updated: 1.82 - 1.83
GlobalAlias.h updated: 1.1 - 1.2
GlobalValue.h updated: 1.39 - 1.40
GlobalVariable.h updated: 1.45 - 1.46
---
Log message:

Implement review feedback. Aliasees can be either GlobalValue's or 
bitcasts of them.


---
Diffs of the changes:  (+32 -37)

 Function.h   |   18 +-
 GlobalAlias.h|   37 +
 GlobalValue.h|   10 --
 GlobalVariable.h |4 ++--
 4 files changed, 32 insertions(+), 37 deletions(-)


Index: llvm/include/llvm/Function.h
diff -u llvm/include/llvm/Function.h:1.82 llvm/include/llvm/Function.h:1.83
--- llvm/include/llvm/Function.h:1.82   Wed Apr 25 09:27:10 2007
+++ llvm/include/llvm/Function.hSat Apr 28 08:44:59 2007
@@ -81,6 +81,15 @@
   void setNext(Function *N) { Next = N; }
   void setPrev(Function *N) { Prev = N; }
 
+  // getNext/Prev - Return the next or previous function in the list.  These
+  // methods should never be used directly, and are only used to implement the
+  // function list as part of the module.
+  //
+  Function *getNext() { return Next; }
+  const Function *getNext() const { return Next; }
+  Function *getPrev() { return Prev; }
+  const Function *getPrev() const { return Prev; }
+
 public:
   /// Function ctor - If the (optional) Module argument is specified, the
   /// function is automatically inserted into the end of the function list for
@@ -243,15 +252,6 @@
 Function *Obj = 0;
 return unsigned(reinterpret_castuintptr_t(Obj-ArgumentList));
   }
-private:
-  // getNext/Prev - Return the next or previous function in the list.  These
-  // methods should never be used directly, and are only used to implement the
-  // function list as part of the module.
-  //
-  Function *getNext() { return Next; }
-  const Function *getNext() const { return Next; }
-  Function *getPrev() { return Prev; }
-  const Function *getPrev() const { return Prev; }
 };
 
 inline ValueSymbolTable *


Index: llvm/include/llvm/GlobalAlias.h
diff -u llvm/include/llvm/GlobalAlias.h:1.1 llvm/include/llvm/GlobalAlias.h:1.2
--- llvm/include/llvm/GlobalAlias.h:1.1 Wed Apr 25 11:42:39 2007
+++ llvm/include/llvm/GlobalAlias.h Sat Apr 28 08:44:59 2007
@@ -1,4 +1,4 @@
-//===__-- llvm/GlobalAlias.h - GlobalAlias class *- C++ 
-*-===//
+//=== llvm/GlobalAlias.h - GlobalAlias class *- C++ 
-*-===//
 //
 // The LLVM Compiler Infrastructure
 //
@@ -8,7 +8,7 @@
 
//===--===//
 //
 // This file contains the declaration of the GlobalAlias class, which
-// represents a single function or variable alias in the VM.
+// represents a single function or variable alias in the IR.
 //
 
//===--===//
 
@@ -36,13 +36,18 @@
   void setNext(GlobalAlias *N) { Next = N; }
   void setPrev(GlobalAlias *N) { Prev = N; }
 
-  const GlobalValue* Aliasee;
-  std::string Target;
+  // getNext/Prev - Return the next or previous alias in the list.
+GlobalAlias *getNext()   { return Next; }
+  const GlobalAlias *getNext() const { return Next; }
+GlobalAlias *getPrev()   { return Prev; }
+  const GlobalAlias *getPrev() const { return Prev; }
+
+  Use Aliasee;
 public:
   /// GlobalAlias ctor - If a parent module is specified, the alias is
-  /// automatically inserted into the end of the specified modules alias list.
+  /// automatically inserted into the end of the specified module's alias list.
   GlobalAlias(const Type *Ty, LinkageTypes Linkage, const std::string Name = 
,
-  const GlobalValue* Aliasee = 0, Module *Parent = 0);
+  Constant* Aliasee = 0, Module *Parent = 0);
 
   /// isDeclaration - Is this global variable lacking an initializer?  If so, 
   /// the global variable is defined in some other translation unit, and is 
thus
@@ -52,30 +57,30 @@
   /// removeFromParent - This method unlinks 'this' from the containing module,
   /// but does not delete it.
   ///
-  virtual void removeFromParent();
+  void removeFromParent();
 
   /// eraseFromParent - This method unlinks 'this' from the containing module
   /// and deletes it.
   ///
-  virtual void eraseFromParent();
+  void eraseFromParent();
 
   virtual void print(std::ostream OS) const;
   void print(std::ostream *OS) const { if (OS) print(*OS); }
 
-  void setAliasee(const GlobalValue* GV);
-  const GlobalValue* getAliasee() const { return Aliasee; }
+  /// set/getAliasee - These methods retrive and set alias target.
+  void setAliasee(Constant* GV);
+  const Constant* getAliasee() const {
+return cast_or_nullConstant(getOperand(0));
+  }
+  Constant* getAliasee() {
+return cast_or_nullConstant(getOperand(0));
+  }
 
   // Methods for support type inquiry through isa, cast, and dyn_cast:
   static inline bool 

[llvm-commits] CVS: llvm/lib/Transforms/IPO/GlobalDCE.cpp

2007-04-28 Thread Anton Korobeynikov


Changes in directory llvm/lib/Transforms/IPO:

GlobalDCE.cpp updated: 1.43 - 1.44
---
Log message:

Implement review feedback. Aliasees can be either GlobalValue's or 
bitcasts of them.


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

 GlobalDCE.cpp |8 ++--
 1 files changed, 2 insertions(+), 6 deletions(-)


Index: llvm/lib/Transforms/IPO/GlobalDCE.cpp
diff -u llvm/lib/Transforms/IPO/GlobalDCE.cpp:1.43 
llvm/lib/Transforms/IPO/GlobalDCE.cpp:1.44
--- llvm/lib/Transforms/IPO/GlobalDCE.cpp:1.43  Wed Apr 25 09:27:10 2007
+++ llvm/lib/Transforms/IPO/GlobalDCE.cpp   Sat Apr 28 08:44:59 2007
@@ -75,9 +75,8 @@
 
   for (Module::alias_iterator I = M.alias_begin(), E = M.alias_end();
I != E; ++I) {
-Changed |= RemoveUnusedGlobalValue(*I);
 // Aliases are always needed even if they are not used.
-GlobalIsNeeded(I);
+MarkUsedGlobalsAsNeeded(castConstant(I-getAliasee()));
   }
 
   // Now that all globals which are needed are in the AliveGlobals set, we loop
@@ -143,10 +142,7 @@
 // referenced by the initializer to the alive set.
 if (GV-hasInitializer())
   MarkUsedGlobalsAsNeeded(GV-getInitializer());
-  } else if (GlobalAlias *GA = dyn_castGlobalAlias(G)) {
-// If this is a global alias we also need it's aliasee
-GlobalIsNeeded(const_castGlobalValue*(GA-getAliasee()));
-  } else {
+  } else if (!isaGlobalAlias(G)) {
 // Otherwise this must be a function object.  We have to scan the body of
 // the function looking for constants and global values which are used as
 // operands.  Any operands of these types must be processed to ensure that



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


[llvm-commits] CVS: llvm/docs/BytecodeFormat.html LangRef.html

2007-04-28 Thread Anton Korobeynikov


Changes in directory llvm/docs:

BytecodeFormat.html updated: 1.70 - 1.71
LangRef.html updated: 1.238 - 1.239
---
Log message:

Implement review feedback. Aliasees can be either GlobalValue's or 
bitcasts of them.


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

 BytecodeFormat.html |   16 
 LangRef.html|5 +++--
 2 files changed, 11 insertions(+), 10 deletions(-)


Index: llvm/docs/BytecodeFormat.html
diff -u llvm/docs/BytecodeFormat.html:1.70 llvm/docs/BytecodeFormat.html:1.71
--- llvm/docs/BytecodeFormat.html:1.70  Wed Apr 25 09:27:10 2007
+++ llvm/docs/BytecodeFormat.html   Sat Apr 28 08:44:59 2007
@@ -1212,14 +1212,18 @@
   linkage, 2 - Weak linkage./td
 /tr
 tr
-  tda href=#bitbit(2-31)/a/td
+  tda href=#bitbit(2)/a/td
+  td class=td_left0 - Aliasee is global value. 1 - Aliasee is constant
+  expression (bitcast of global value)/td
+/tr
+tr
+  tda href=#bitbit(3-31)/a/td
   td class=td_leftType slot number of type for the alias itself./td
 /tr
   /tbody
 /table
 
-  pThe next two a href=#uint32_vbruint32_vbr's/a describes the
-  aliasee. /p
+  pThe next a href=#uint32_vbruint32_vbr/a describes the aliasee. /p
 
 table
   tbody
@@ -1229,10 +1233,6 @@
 /tr
 tr
   tda href=#uint32_vbruint32_vbr/a/td
-  td class=td_leftType slot number of type for the aliasee./td
-/tr
-tr
-  tda href=#uint32_vbruint32_vbr/a/td
   td class=td_leftSlot number of the aliasee./td
 /tr
   /tbody
@@ -2152,7 +2152,7 @@
 a href=mailto:[EMAIL PROTECTED]Reid Spencer/a and a
  href=mailto:[EMAIL PROTECTED]Chris Lattner/abr
 a href=http://llvm.org;The LLVM Compiler Infrastructure/abr
-Last modified: $Date: 2007/04/25 14:27:10 $
+Last modified: $Date: 2007/04/28 13:44:59 $
 /address
 /body
 /html


Index: llvm/docs/LangRef.html
diff -u llvm/docs/LangRef.html:1.238 llvm/docs/LangRef.html:1.239
--- llvm/docs/LangRef.html:1.238Wed Apr 25 09:27:10 2007
+++ llvm/docs/LangRef.html  Sat Apr 28 08:44:59 2007
@@ -24,6 +24,7 @@
   lia href=#callingconvCalling Conventions/a/li
   lia href=#globalvarsGlobal Variables/a/li
   lia href=#functionstructureFunctions/a/li
+  lia href=aliasstructureAliases/a
   lia href=#paramattrsParameter Attributes/a/li
   lia href=#moduleasmModule-Level Inline Assembly/a/li
   lia href=#datalayoutData Layout/a/li
@@ -705,7 +706,7 @@
 /div
 div class=doc_text
   pAliases act as second name for the aliasee value (which can be either
-  function or global variable). Aliases may have an
+  function or global variable or bitcast of global value). Aliases may have an
   optional a href=#linkagelinkage type/a, and an
   optional a href=#visibilityvisibility style/a./p
 
@@ -4749,7 +4750,7 @@
 
   a href=mailto:[EMAIL PROTECTED]Chris Lattner/abr
   a href=http://llvm.org;The LLVM Compiler Infrastructure/abr
-  Last modified: $Date: 2007/04/25 14:27:10 $
+  Last modified: $Date: 2007/04/28 13:44:59 $
 /address
 /body
 /html



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


[llvm-commits] CVS: llvm/lib/Bytecode/Reader/Analyzer.cpp Reader.cpp Reader.h

2007-04-28 Thread Anton Korobeynikov


Changes in directory llvm/lib/Bytecode/Reader:

Analyzer.cpp updated: 1.41 - 1.42
Reader.cpp updated: 1.255 - 1.256
Reader.h updated: 1.52 - 1.53
---
Log message:

Implement review feedback. Aliasees can be either GlobalValue's or 
bitcasts of them.


---
Diffs of the changes:  (+61 -10)

 Analyzer.cpp |   21 +
 Reader.cpp   |   41 +++--
 Reader.h |9 +
 3 files changed, 61 insertions(+), 10 deletions(-)


Index: llvm/lib/Bytecode/Reader/Analyzer.cpp
diff -u llvm/lib/Bytecode/Reader/Analyzer.cpp:1.41 
llvm/lib/Bytecode/Reader/Analyzer.cpp:1.42
--- llvm/lib/Bytecode/Reader/Analyzer.cpp:1.41  Tue Apr 24 12:20:52 2007
+++ llvm/lib/Bytecode/Reader/Analyzer.cpp   Sat Apr 28 08:44:59 2007
@@ -179,6 +179,27 @@
 
   }
 
+  virtual void handleGlobalAlias(
+const Type* ElemType,
+GlobalValue::LinkageTypes Linkage,
+unsigned TypeSlotNum,
+unsigned AliaseeSlot) {
+if (os) {
+  *osGA: 
+Linkage=  Linkage
+Type=;
+  //WriteTypeSymbolic(*os, ElemType, M);
+  *os   Slot=  TypeSlotNum   AliaseeSlot=  AliaseeSlot
+   \n;
+}
+
+bca.numValues++;
+if (TypeSlotNum  bca.maxValueSlot)
+  bca.maxValueSlot = TypeSlotNum;
+if (AliaseeSlot  bca.maxValueSlot)
+  bca.maxValueSlot = AliaseeSlot;
+  }
+
   virtual void handleTypeList(unsigned numEntries) {
 bca.maxTypeSlot = numEntries - 1;
   }


Index: llvm/lib/Bytecode/Reader/Reader.cpp
diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.255 
llvm/lib/Bytecode/Reader/Reader.cpp:1.256
--- llvm/lib/Bytecode/Reader/Reader.cpp:1.255   Wed Apr 25 09:27:10 2007
+++ llvm/lib/Bytecode/Reader/Reader.cpp Sat Apr 28 08:44:59 2007
@@ -1923,12 +1923,10 @@
 // Read aliases...
 unsigned VarType = read_vbr_uint();
 while (VarType != Type::VoidTyID) { // List is terminated by Void
-  unsigned TypeSlotNo = VarType  2;
+  unsigned TypeSlotNo = VarType  3;
   unsigned EncodedLinkage = VarType  3;
-  unsigned AliaseeTypeSlotNo, AliaseeSlotNo;
-
-  AliaseeTypeSlotNo = read_vbr_uint();
-  AliaseeSlotNo = read_vbr_uint();
+  bool isConstantAliasee  = (VarType  2)  1;
+  unsigned AliaseeSlotNo  = read_vbr_uint();
 
   const Type *Ty = getType(TypeSlotNo);
   if (!Ty)
@@ -1937,11 +1935,11 @@
   if (!isaPointerType(Ty))
 error(Alias not a pointer type! Ty=  + Ty-getDescription());
   
-  Value* V = getValue(AliaseeTypeSlotNo, AliaseeSlotNo, false);
-  if (!V)
-error(Invalid aliasee! TypeSlotNo= + utostr(AliaseeTypeSlotNo) +
+  Value* V = getValue(TypeSlotNo, AliaseeSlotNo, false);
+  if (!V  !isConstantAliasee)
+error(Invalid aliasee! TypeSlotNo= + utostr(TypeSlotNo) +
SlotNo= + utostr(AliaseeSlotNo));
-  if (!isaGlobalValue(V))
+  if (!isConstantAliasee  !isaGlobalValue(V))
 error(Aliasee is not global value! SlotNo= + utostr(AliaseeSlotNo));
 
   GlobalValue::LinkageTypes Linkage;
@@ -1960,8 +1958,14 @@
   }
   
   GlobalAlias *GA = new GlobalAlias(Ty, Linkage, ,
-dyn_castGlobalValue(V), TheModule);
+dyn_cast_or_nullConstant(V),
+TheModule);
   insertValue(GA, TypeSlotNo, ModuleValues);
+  if (!V  isConstantAliasee)
+Aliasees.push_back(std::make_pair(GA, AliaseeSlotNo));
+
+  if (Handler) Handler-handleGlobalAlias(Ty, Linkage,
+  TypeSlotNo, AliaseeSlotNo);
   VarType = read_vbr_uint();
 }
   }  
@@ -2068,6 +2072,23 @@
   error(Cannot find initializer value.);
   }
 
+  // And aliasees
+  while (!Aliasees.empty()) {
+GlobalAlias *GA = Aliasees.back().first;
+unsigned Slot = Aliasees.back().second;
+Aliasees.pop_back();
+
+// Look up the aliasee value...
+const llvm::PointerType* GAType = GA-getType();
+unsigned TypeSlot = getTypeSlot(GAType);
+if (Constant *CV = getConstantValue(TypeSlot, Slot)) {
+  if (GA-getAliasee())
+error(Aliasee was *already* set?!);
+  GA-setAliasee(CV);
+} else
+  error(Cannot find aliasee value.);
+  }
+
   if (!ConstantFwdRefs.empty())
 error(Use of undefined constants in a module);
 


Index: llvm/lib/Bytecode/Reader/Reader.h
diff -u llvm/lib/Bytecode/Reader/Reader.h:1.52 
llvm/lib/Bytecode/Reader/Reader.h:1.53
--- llvm/lib/Bytecode/Reader/Reader.h:1.52  Mon Apr  9 01:14:31 2007
+++ llvm/lib/Bytecode/Reader/Reader.h   Sat Apr 28 08:44:59 2007
@@ -129,6 +129,9 @@
   /// them.
   typedef std::vectorstd::pairGlobalVariable*, unsigned  GlobalInitsList;
 
+  /// @brief A list of global aliases and the slot number for constant aliasees
+  typedef std::vectorstd::pairGlobalAlias*, unsigned  AliaseeList;
+
   /// This type maps a typeslot/valueslot pair to the corresponding Value*.
   /// It is used for dealing with 

[llvm-commits] CVS: llvm/lib/Bytecode/Writer/SlotCalculator.cpp Writer.cpp

2007-04-28 Thread Anton Korobeynikov


Changes in directory llvm/lib/Bytecode/Writer:

SlotCalculator.cpp updated: 1.112 - 1.113
Writer.cpp updated: 1.177 - 1.178
---
Log message:

Implement review feedback. Aliasees can be either GlobalValue's or 
bitcasts of them.


---
Diffs of the changes:  (+19 -5)

 SlotCalculator.cpp |   13 +
 Writer.cpp |   11 ++-
 2 files changed, 19 insertions(+), 5 deletions(-)


Index: llvm/lib/Bytecode/Writer/SlotCalculator.cpp
diff -u llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.112 
llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.113
--- llvm/lib/Bytecode/Writer/SlotCalculator.cpp:1.112   Mon Apr  9 01:14:31 2007
+++ llvm/lib/Bytecode/Writer/SlotCalculator.cpp Sat Apr 28 08:44:59 2007
@@ -89,6 +89,12 @@
I != E; ++I)
 CreateSlotIfNeeded(I);
 
+  // Add all of the global aliases to the value table...
+  //
+  for (Module::const_alias_iterator I = TheModule-alias_begin(),
+ E = TheModule-alias_end(); I != E; ++I)
+CreateSlotIfNeeded(I);
+
   // Add all of the module level constants used as initializers
   //
   for (Module::const_global_iterator I = TheModule-global_begin(),
@@ -96,6 +102,13 @@
 if (I-hasInitializer())
   CreateSlotIfNeeded(I-getInitializer());
 
+  // Add all of the module level constants used as aliasees
+  //
+  for (Module::const_alias_iterator I = TheModule-alias_begin(),
+ E = TheModule-alias_end(); I != E; ++I)
+if (I-getAliasee())
+  CreateSlotIfNeeded(I-getAliasee());
+
   // Now that all global constants have been added, rearrange constant planes
   // that contain constant strings so that the strings occur at the start of 
the
   // plane, not somewhere in the middle.


Index: llvm/lib/Bytecode/Writer/Writer.cpp
diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.177 
llvm/lib/Bytecode/Writer/Writer.cpp:1.178
--- llvm/lib/Bytecode/Writer/Writer.cpp:1.177   Wed Apr 25 09:27:10 2007
+++ llvm/lib/Bytecode/Writer/Writer.cpp Sat Apr 28 08:44:59 2007
@@ -1095,9 +1095,11 @@
   // Output aliases
   for (Module::const_alias_iterator I = M-alias_begin(), E = M-alias_end();
I != E; ++I) {
-unsigned Slot = Table.getTypeSlot(I-getType());
-assert(((Slot  2)  2) == Slot  Slot # too big!);
+unsigned TypeSlotNo= Table.getTypeSlot(I-getType());
+unsigned AliaseeSlotNo = Table.getSlot(I-getAliasee());
+assert(((TypeSlotNo  3)  3) == TypeSlotNo  Slot # too big!);
 unsigned aliasLinkage = 0;
+unsigned isConstantAliasee = ((!isaGlobalValue(I-getAliasee()))  2);
 switch (I-getLinkage()) {
  case GlobalValue::ExternalLinkage:
   aliasLinkage = 0;
@@ -,9 +1113,8 @@
  default:
   assert(0  Invalid alias linkage);
 }
-output_vbr((Slot  2) | aliasLinkage);
-output_vbr(Table.getTypeSlot(I-getAliasee()-getType()));
-output_vbr(Table.getSlot(I-getAliasee()));
+output_vbr((TypeSlotNo  3) | isConstantAliasee | aliasLinkage);
+output_vbr(AliaseeSlotNo);
   }
   output_typeid(Table.getTypeSlot(Type::VoidTy));
 }



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


[llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp Globals.cpp Module.cpp Verifier.cpp

2007-04-28 Thread Anton Korobeynikov


Changes in directory llvm/lib/VMCore:

AsmWriter.cpp updated: 1.276 - 1.277
Globals.cpp updated: 1.20 - 1.21
Module.cpp updated: 1.81 - 1.82
Verifier.cpp updated: 1.206 - 1.207
---
Log message:

Implement review feedback. Aliasees can be either GlobalValue's or 
bitcasts of them.


---
Diffs of the changes:  (+30 -12)

 AsmWriter.cpp |   14 ++
 Globals.cpp   |   21 ++---
 Module.cpp|3 +++
 Verifier.cpp  |4 +++-
 4 files changed, 30 insertions(+), 12 deletions(-)


Index: llvm/lib/VMCore/AsmWriter.cpp
diff -u llvm/lib/VMCore/AsmWriter.cpp:1.276 llvm/lib/VMCore/AsmWriter.cpp:1.277
--- llvm/lib/VMCore/AsmWriter.cpp:1.276 Wed Apr 25 21:24:10 2007
+++ llvm/lib/VMCore/AsmWriter.cpp   Sat Apr 28 08:44:59 2007
@@ -926,7 +926,7 @@
assert(0  Invalid alias linkage);
   }
   
-  const GlobalValue *Aliasee = GA-getAliasee();
+  const Constant *Aliasee = dyn_cast_or_nullConstant(GA-getAliasee());
   assert(Aliasee  Aliasee cannot be null);
 
   if (const GlobalVariable *GV = dyn_castGlobalVariable(Aliasee)) {
@@ -940,9 +940,15 @@
   Out  getLLVMName(F-getName(), GlobalPrefix);
 else
   Out  @\\;
-  } else
-assert(0  Unsupported aliasee);
-
+  } else {
+const ConstantExpr *CE = 0;
+if ((CE = dyn_castConstantExpr(Aliasee)) 
+(CE-getOpcode() == Instruction::BitCast)) {
+  writeOperand(CE, false);
+} else
+  assert(0  Unsupported aliasee);
+  }
+  
   printInfoComment(*GA);
   Out  \n;
 }


Index: llvm/lib/VMCore/Globals.cpp
diff -u llvm/lib/VMCore/Globals.cpp:1.20 llvm/lib/VMCore/Globals.cpp:1.21
--- llvm/lib/VMCore/Globals.cpp:1.20Wed Apr 25 09:27:10 2007
+++ llvm/lib/VMCore/Globals.cpp Sat Apr 28 08:44:59 2007
@@ -163,12 +163,15 @@
 
//===--===//
 
 GlobalAlias::GlobalAlias(const Type *Ty, LinkageTypes Link,
- const std::string Name, const GlobalValue* aliasee,
+ const std::string Name, Constant* aliasee,
  Module *ParentModule)
-  : GlobalValue(Ty, Value::GlobalAliasVal, 0, 0,
-Link, Name), Aliasee(aliasee) {
+  : GlobalValue(Ty, Value::GlobalAliasVal, Aliasee, 1, Link, Name) {
   LeakDetector::addGarbageObject(this);
 
+  if (aliasee)
+assert(aliasee-getType() == Ty  Alias and aliasee types should 
match!);
+  Aliasee.init(aliasee, this);
+
   if (ParentModule)
 ParentModule-getAliasList().push_back(this);
 }
@@ -190,12 +193,16 @@
 }
 
 bool GlobalAlias::isDeclaration() const {
-  return (Aliasee  Aliasee-isDeclaration());
+  const GlobalValue* AV = dyn_cast_or_nullconst GlobalValue(getAliasee());
+  return (AV  AV-isDeclaration());
 }
 
-void GlobalAlias::setAliasee(const GlobalValue *GV) 
+void GlobalAlias::setAliasee(Constant *Aliasee) 
 {
-  // FIXME: Some checks?
-  Aliasee = GV;
+  if (Aliasee) {
+assert(Aliasee-getType() == getType()  
+   Alias and aliasee types should match!);
+setOperand(0, Aliasee);
+  }
 }
 


Index: llvm/lib/VMCore/Module.cpp
diff -u llvm/lib/VMCore/Module.cpp:1.81 llvm/lib/VMCore/Module.cpp:1.82
--- llvm/lib/VMCore/Module.cpp:1.81 Wed Apr 25 09:27:10 2007
+++ llvm/lib/VMCore/Module.cpp  Sat Apr 28 08:45:00 2007
@@ -298,6 +298,9 @@
 
   for(Module::global_iterator I = global_begin(), E = global_end(); I != E; 
++I)
 I-dropAllReferences();
+
+  for(Module::alias_iterator I = alias_begin(), E = alias_end(); I != E; ++I)
+I-dropAllReferences();
 }
 
 void Module::addLibrary(const std::string Lib) {


Index: llvm/lib/VMCore/Verifier.cpp
diff -u llvm/lib/VMCore/Verifier.cpp:1.206 llvm/lib/VMCore/Verifier.cpp:1.207
--- llvm/lib/VMCore/Verifier.cpp:1.206  Wed Apr 25 09:27:10 2007
+++ llvm/lib/VMCore/Verifier.cppSat Apr 28 08:45:00 2007
@@ -316,7 +316,9 @@
   Assert1(GA.hasExternalLinkage() || GA.hasInternalLinkage() ||
   GA.hasWeakLinkage(),
   Alias should have external or external weak linkage!, GA);
-
+  Assert1(GA.getType() == GA.getAliasee()-getType(),
+  Alias and aliasee types should match!, GA);
+  
   visitGlobalValue(GA);
 }
 



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


[llvm-commits] CVS: llvm/test/Feature/aliases.ll

2007-04-28 Thread Anton Korobeynikov


Changes in directory llvm/test/Feature:

aliases.ll updated: 1.2 - 1.3
---
Log message:

Implement review feedback. Aliasees can be either GlobalValue's or 
bitcasts of them.


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

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


Index: llvm/test/Feature/aliases.ll
diff -u llvm/test/Feature/aliases.ll:1.2 llvm/test/Feature/aliases.ll:1.3
--- llvm/test/Feature/aliases.ll:1.2Sat Apr 28 01:02:13 2007
+++ llvm/test/Feature/aliases.llSat Apr 28 08:45:00 2007
@@ -2,8 +2,6 @@
 ; RUN: llvm-as %t1.ll -o - | llvm-dis  %t2.ll
 ; RUN: diff %t1.ll %t2.ll
 
-; XFAIL: *
-
 @bar = external global i32
 @foo1 = alias i32* @bar
 @foo2 = alias i32* @bar
@@ -15,6 +13,8 @@
 
 @bar_i = alias internal i32* @bar
 
[EMAIL PROTECTED] = alias bitcast (i32* @bar to i64*)
+
 define i32 @test() {
 entry:
%tmp = load i32* @foo1



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


[llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y

2007-04-28 Thread Reid Spencer


Changes in directory llvm/lib/AsmParser:

llvmAsmParser.y updated: 1.352 - 1.353
---
Log message:

Fix a compilation error (jump to case label).


---
Diffs of the changes:  (+64 -77)

 llvmAsmParser.y |  141 +---
 1 files changed, 64 insertions(+), 77 deletions(-)


Index: llvm/lib/AsmParser/llvmAsmParser.y
diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.352 
llvm/lib/AsmParser/llvmAsmParser.y:1.353
--- llvm/lib/AsmParser/llvmAsmParser.y:1.352Sat Apr 28 08:44:59 2007
+++ llvm/lib/AsmParser/llvmAsmParser.y  Sat Apr 28 09:13:42 2007
@@ -139,14 +139,18 @@
   // GetForwardRefForGlobal - Check to see if there is a forward reference
   // for this global.  If so, remove it from the GlobalRefs map and return it.
   // If not, just return null.
-  GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
+  GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ParamAttrsList 
*PAL, 
+  ValID ID) {
 // Check to see if there is a forward reference to this global variable...
 // if there is, eliminate it and patch the reference to use the new def'n.
 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
 GlobalValue *Ret = 0;
 if (I != GlobalRefs.end()) {
   Ret = I-second;
-  GlobalRefs.erase(I);
+  if (PAL  isaFunction(Ret)) 
+Ret = castFunction(Ret)-getParamAttrs() == PAL ? Ret : 0;
+  if (Ret)
+GlobalRefs.erase(I);
 }
 return Ret;
   }
@@ -482,7 +486,7 @@
   //
   switch (ID.Type) {
   case ValID::GlobalName:
-  case ValID::GlobalID:
+  case ValID::GlobalID: {
const PointerType *PTy = dyn_castPointerType(Ty);
if (!PTy) {
  GenerateError(Invalid type for reference to global );
@@ -494,6 +498,7 @@
else
  V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage);
break;
+  }
   default:
V = new Argument(Ty);
   }
@@ -743,7 +748,7 @@
 ID = ValID::createGlobalID(CurModule.Values.size());
   }
 
-  if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
+  if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, 0, ID)) {
 // Move the global to the end of the list, from whereever it was
 // previously inserted.
 GlobalVariable *GV = castGlobalVariable(FWGV);
@@ -1323,62 +1328,35 @@
 UR_OUT(New Upreference!\n);
 CHECK_FOR_ERROR
   }
-  | Types '(' ArgTypeListI ')' OptFuncAttrs {
+  | Types '(' ArgTypeListI ')' {
 std::vectorconst Type* Params;
-ParamAttrsVector Attrs;
-if ($5 != ParamAttr::None) {
-  ParamAttrsWithIndex X; X.index = 0; X.attrs = $5;
-  Attrs.push_back(X);
-}
 unsigned index = 1;
 TypeWithAttrsList::iterator I = $3-begin(), E = $3-end();
 for (; I != E; ++I, ++index) {
   const Type *Ty = I-Ty-get();
   Params.push_back(Ty);
-  if (Ty != Type::VoidTy)
-if (I-Attrs != ParamAttr::None) {
-  ParamAttrsWithIndex X; X.index = index; X.attrs = I-Attrs;
-  Attrs.push_back(X);
-}
 }
 bool isVarArg = Params.size()  Params.back() == Type::VoidTy;
 if (isVarArg) Params.pop_back();
 
-ParamAttrsList *ActualAttrs = 0;
-if (!Attrs.empty())
-  ActualAttrs = ParamAttrsList::get(Attrs);
-FunctionType *FT = FunctionType::get(*$1, Params, isVarArg, ActualAttrs);
+FunctionType *FT = FunctionType::get(*$1, Params, isVarArg);
 delete $3;   // Delete the argument list
 delete $1;   // Delete the return type handle
 $$ = new PATypeHolder(HandleUpRefs(FT)); 
 CHECK_FOR_ERROR
   }
-  | VOID '(' ArgTypeListI ')' OptFuncAttrs {
+  | VOID '(' ArgTypeListI ')' {
 std::vectorconst Type* Params;
-ParamAttrsVector Attrs;
-if ($5 != ParamAttr::None) {
-  ParamAttrsWithIndex X; X.index = 0; X.attrs = $5;
-  Attrs.push_back(X);
-}
 TypeWithAttrsList::iterator I = $3-begin(), E = $3-end();
 unsigned index = 1;
 for ( ; I != E; ++I, ++index) {
   const Type* Ty = I-Ty-get();
   Params.push_back(Ty);
-  if (Ty != Type::VoidTy)
-if (I-Attrs != ParamAttr::None) {
-  ParamAttrsWithIndex X; X.index = index; X.attrs = I-Attrs;
-  Attrs.push_back(X);
-}
 }
 bool isVarArg = Params.size()  Params.back() == Type::VoidTy;
 if (isVarArg) Params.pop_back();
 
-ParamAttrsList *ActualAttrs = 0;
-if (!Attrs.empty())
-  ActualAttrs = ParamAttrsList::get(Attrs);
-
-FunctionType *FT = FunctionType::get($1, Params, isVarArg, ActualAttrs);
+FunctionType *FT = FunctionType::get($1, Params, isVarArg);
 delete $3;  // Delete the argument list
 $$ = new PATypeHolder(HandleUpRefs(FT)); 
 CHECK_FOR_ERROR
@@ -1432,9 +1410,9 @@
   ;
 
 ArgType 
-  : Types OptParamAttrs { 
+  : Types { 
 $$.Ty = $1; 
-$$.Attrs = $2; 
+$$.Attrs = ParamAttr::None;
   }
   ;
 
@@ -2239,7 +2217,7 @@
   if (!Attrs.empty())
 PAL = ParamAttrsList::get(Attrs);
 
-  

[llvm-commits] llvm-gcc mirror update delayed again

2007-04-28 Thread Jeff Cohen
Once again, the log claims it was updated at 2am PDT, but my nightly 
tester failed to pull in any changes at 3am.  Revision 318 is now 
present at 7am.

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


[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp

2007-04-28 Thread Anton Korobeynikov


Changes in directory llvm/lib/VMCore:

Verifier.cpp updated: 1.207 - 1.208
---
Log message:

Let Verifier check aliasees


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

 Verifier.cpp |7 +++
 1 files changed, 7 insertions(+)


Index: llvm/lib/VMCore/Verifier.cpp
diff -u llvm/lib/VMCore/Verifier.cpp:1.207 llvm/lib/VMCore/Verifier.cpp:1.208
--- llvm/lib/VMCore/Verifier.cpp:1.207  Sat Apr 28 08:45:00 2007
+++ llvm/lib/VMCore/Verifier.cppSat Apr 28 09:35:41 2007
@@ -319,6 +319,13 @@
   Assert1(GA.getType() == GA.getAliasee()-getType(),
   Alias and aliasee types should match!, GA);
   
+  if (!isaGlobalValue(GA.getAliasee())) {
+const ConstantExpr *CE = dyn_castConstantExpr(GA.getAliasee());
+Assert1(CE  CE-getOpcode() == Instruction::BitCast,
+Aliasee should be either GlobalValue or bitcast of GlobalValue,
+GA);
+  }
+  
   visitGlobalValue(GA);
 }
 



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


[llvm-commits] CVS: llvm/lib/Bitcode/Reader/BitcodeReader.cpp

2007-04-28 Thread Anton Korobeynikov


Changes in directory llvm/lib/Bitcode/Reader:

BitcodeReader.cpp updated: 1.14 - 1.15
---
Log message:

This is not FIXME anymore


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

 BitcodeReader.cpp |4 +---
 1 files changed, 1 insertion(+), 3 deletions(-)


Index: llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff -u llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.14 
llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.15
--- llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1.14  Wed Apr 25 22:27:58 2007
+++ llvm/lib/Bitcode/Reader/BitcodeReader.cpp   Sat Apr 28 09:57:59 2007
@@ -427,9 +427,7 @@
   AliasInits.push_back(AliasInitWorklist.back());
 } else {
   if (Constant *C = dyn_castConstant(ValueList[ValID]))
-AliasInitWorklist.back().first-setAliasee(
-// FIXME:
-castGlobalValue(C));
+AliasInitWorklist.back().first-setAliasee(C);
   else
 return Error(Alias initializer is not a constant!);
 }



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


Re: [llvm-commits] llvm-gcc mirror update delayed again

2007-04-28 Thread Reid Spencer
On Sat, 28 Apr 2007 07:22:27 -0700
 Jeff Cohen [EMAIL PROTECTED] wrote:
Once again, the log claims it was updated at 2am PDT, but my nightly 
tester failed to pull in any changes at 3am.  Revision 318 is now 
present at 7am.

Jeff, are you sure you're not dealing with a GMT/Localtime issue?

In the last few months the synch has always been available around 6-7am PDT, 
not 2am. 



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

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


Re: [llvm-commits] llvm-gcc mirror update delayed again

2007-04-28 Thread Jeff Cohen
Reid Spencer wrote:
 On Sat, 28 Apr 2007 07:22:27 -0700
  Jeff Cohen [EMAIL PROTECTED] wrote:
   
 Once again, the log claims it was updated at 2am PDT, but my nightly 
 tester failed to pull in any changes at 3am.  Revision 318 is now 
 present at 7am.
 

 Jeff, are you sure you're not dealing with a GMT/Localtime issue?

 In the last few months the synch has always been available around 6-7am PDT, 
 not 2am.

Well, the log shows:


r318 | bwendlin | 2007-04-28 02:03:58 -0700 (Sat, 28 Apr 2007) | 1 line

auto-merge 2007-04-28T02:00:00-0700


That looks like 2am PDT to me.  Also, on most days, it does appear to 
take place at this time.  On some days, it doesn't happen at all.

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


[llvm-commits] Regression tests exist for a reason

2007-04-28 Thread Jeff Cohen
Recent commits have broken 28 tests.  Regression tests exist for a 
reason.  Run them.  Before committing.

FAIL: /usr/home/jeffc/llvm/test/Assembler/2006-05-26-VarargsCallEncode.ll
FAIL: 
/usr/home/jeffc/llvm/test/C++Frontend/2003-11-25-ReturningOpaqueByValue.cpp
FAIL: /usr/home/jeffc/llvm/test/C++Frontend/2004-09-27-CompilerCrash.cpp
FAIL: /usr/home/jeffc/llvm/test/CFrontend/2002-04-10-StructParameters.c
FAIL: /usr/home/jeffc/llvm/test/CFrontend/2002-07-14-MiscTests.c
FAIL: /usr/home/jeffc/llvm/test/CFrontend/2002-07-14-MiscTests3.c
FAIL: /usr/home/jeffc/llvm/test/CFrontend/2007-04-11-InlineAsmStruct.c
FAIL: /usr/home/jeffc/llvm/test/CFrontend/2007-04-11-InlineAsmUnion.c
FAIL: /usr/home/jeffc/llvm/test/CodeGen/ARM/2007-03-06-AddR7.ll
FAIL: 
/usr/home/jeffc/llvm/test/CodeGen/ARM/2007-03-26-RegScavengerAssert.ll 
for PR1266
FAIL: /usr/home/jeffc/llvm/test/CodeGen/ARM/sxt_rot.ll
FAIL: /usr/home/jeffc/llvm/test/CodeGen/ARM/uxt_rot.ll
FAIL: /usr/home/jeffc/llvm/test/CodeGen/Alpha/add.ll
FAIL: /usr/home/jeffc/llvm/test/CodeGen/Alpha/i32_sub_1.ll
FAIL: /usr/home/jeffc/llvm/test/CodeGen/Alpha/zapnot.ll
FAIL: 
/usr/home/jeffc/llvm/test/CodeGen/Generic/2007-04-08-MultipleFrameIndices.ll 
for PR1308
FAIL: /usr/home/jeffc/llvm/test/CodeGen/PowerPC/2007-01-29-lbrx-asm.ll
FAIL: 
/usr/home/jeffc/llvm/test/CodeGen/PowerPC/2007-01-31-InlineAsmAddrMode.ll
FAIL: /usr/home/jeffc/llvm/test/CodeGen/PowerPC/and-elim.ll
FAIL: /usr/home/jeffc/llvm/test/CodeGen/PowerPC/and_sext.ll
FAIL: /usr/home/jeffc/llvm/test/CodeGen/PowerPC/small-arguments.ll
FAIL: 
/usr/home/jeffc/llvm/test/CodeGen/X86/2006-07-12-InlineAsmQConstraint.ll 
for PR828
FAIL: /usr/home/jeffc/llvm/test/CodeGen/X86/2006-11-12-CSRetCC.ll
FAIL: /usr/home/jeffc/llvm/test/CodeGen/X86/mingw-alloca.ll
FAIL: /usr/home/jeffc/llvm/test/CodeGen/X86/trunc-to-bool.ll
FAIL: /usr/home/jeffc/llvm/test/CodeGen/X86/x86-64-arg.ll
FAIL: /usr/home/jeffc/llvm/test/CodeGen/X86/x86-64-shortint.ll
FAIL: /usr/home/jeffc/llvm/test/Feature/paramattrs.ll
FAIL: /usr/home/jeffc/llvm/test/Integer/paramattrs_bt.ll


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


[llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y

2007-04-28 Thread Reid Spencer


Changes in directory llvm/lib/AsmParser:

llvmAsmParser.y updated: 1.353 - 1.354
---
Log message:

Revert the premature portion of the last commit.


---
Diffs of the changes:  (+76 -62)

 llvmAsmParser.y |  138 ++--
 1 files changed, 76 insertions(+), 62 deletions(-)


Index: llvm/lib/AsmParser/llvmAsmParser.y
diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.353 
llvm/lib/AsmParser/llvmAsmParser.y:1.354
--- llvm/lib/AsmParser/llvmAsmParser.y:1.353Sat Apr 28 09:13:42 2007
+++ llvm/lib/AsmParser/llvmAsmParser.y  Sat Apr 28 11:06:50 2007
@@ -139,18 +139,14 @@
   // GetForwardRefForGlobal - Check to see if there is a forward reference
   // for this global.  If so, remove it from the GlobalRefs map and return it.
   // If not, just return null.
-  GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ParamAttrsList 
*PAL, 
-  ValID ID) {
+  GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
 // Check to see if there is a forward reference to this global variable...
 // if there is, eliminate it and patch the reference to use the new def'n.
 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
 GlobalValue *Ret = 0;
 if (I != GlobalRefs.end()) {
   Ret = I-second;
-  if (PAL  isaFunction(Ret)) 
-Ret = castFunction(Ret)-getParamAttrs() == PAL ? Ret : 0;
-  if (Ret)
-GlobalRefs.erase(I);
+  GlobalRefs.erase(I);
 }
 return Ret;
   }
@@ -748,7 +744,7 @@
 ID = ValID::createGlobalID(CurModule.Values.size());
   }
 
-  if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, 0, ID)) {
+  if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
 // Move the global to the end of the list, from whereever it was
 // previously inserted.
 GlobalVariable *GV = castGlobalVariable(FWGV);
@@ -1328,35 +1324,62 @@
 UR_OUT(New Upreference!\n);
 CHECK_FOR_ERROR
   }
-  | Types '(' ArgTypeListI ')' {
+  | Types '(' ArgTypeListI ')' OptFuncAttrs {
 std::vectorconst Type* Params;
+ParamAttrsVector Attrs;
+if ($5 != ParamAttr::None) {
+  ParamAttrsWithIndex X; X.index = 0; X.attrs = $5;
+  Attrs.push_back(X);
+}
 unsigned index = 1;
 TypeWithAttrsList::iterator I = $3-begin(), E = $3-end();
 for (; I != E; ++I, ++index) {
   const Type *Ty = I-Ty-get();
   Params.push_back(Ty);
+  if (Ty != Type::VoidTy)
+if (I-Attrs != ParamAttr::None) {
+  ParamAttrsWithIndex X; X.index = index; X.attrs = I-Attrs;
+  Attrs.push_back(X);
+}
 }
 bool isVarArg = Params.size()  Params.back() == Type::VoidTy;
 if (isVarArg) Params.pop_back();
 
-FunctionType *FT = FunctionType::get(*$1, Params, isVarArg);
+ParamAttrsList *ActualAttrs = 0;
+if (!Attrs.empty())
+  ActualAttrs = ParamAttrsList::get(Attrs);
+FunctionType *FT = FunctionType::get(*$1, Params, isVarArg, ActualAttrs);
 delete $3;   // Delete the argument list
 delete $1;   // Delete the return type handle
 $$ = new PATypeHolder(HandleUpRefs(FT)); 
 CHECK_FOR_ERROR
   }
-  | VOID '(' ArgTypeListI ')' {
+  | VOID '(' ArgTypeListI ')' OptFuncAttrs {
 std::vectorconst Type* Params;
+ParamAttrsVector Attrs;
+if ($5 != ParamAttr::None) {
+  ParamAttrsWithIndex X; X.index = 0; X.attrs = $5;
+  Attrs.push_back(X);
+}
 TypeWithAttrsList::iterator I = $3-begin(), E = $3-end();
 unsigned index = 1;
 for ( ; I != E; ++I, ++index) {
   const Type* Ty = I-Ty-get();
   Params.push_back(Ty);
+  if (Ty != Type::VoidTy)
+if (I-Attrs != ParamAttr::None) {
+  ParamAttrsWithIndex X; X.index = index; X.attrs = I-Attrs;
+  Attrs.push_back(X);
+}
 }
 bool isVarArg = Params.size()  Params.back() == Type::VoidTy;
 if (isVarArg) Params.pop_back();
 
-FunctionType *FT = FunctionType::get($1, Params, isVarArg);
+ParamAttrsList *ActualAttrs = 0;
+if (!Attrs.empty())
+  ActualAttrs = ParamAttrsList::get(Attrs);
+
+FunctionType *FT = FunctionType::get($1, Params, isVarArg, ActualAttrs);
 delete $3;  // Delete the argument list
 $$ = new PATypeHolder(HandleUpRefs(FT)); 
 CHECK_FOR_ERROR
@@ -1410,9 +1433,9 @@
   ;
 
 ArgType 
-  : Types { 
+  : Types OptParamAttrs { 
 $$.Ty = $1; 
-$$.Attrs = ParamAttr::None;
+$$.Attrs = $2; 
   }
   ;
 
@@ -2217,7 +2240,7 @@
   if (!Attrs.empty())
 PAL = ParamAttrsList::get(Attrs);
 
-  FunctionType *FT = FunctionType::get(*$2, ParamTypeList, isVarArg);
+  FunctionType *FT = FunctionType::get(*$2, ParamTypeList, isVarArg, PAL);
   const PointerType *PFT = PointerType::get(FT);
   delete $2;
 
@@ -2230,7 +2253,7 @@
 
   Function *Fn = 0;
   // See if this function was forward referenced.  If so, recycle the object.
-  if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, PAL, ID)) {
+  

Re: [llvm-commits] Regression tests exist for a reason

2007-04-28 Thread Reid Spencer
Jeff,

On Sat, 28 Apr 2007 08:53:34 -0700
 Jeff Cohen [EMAIL PROTECTED] wrote:
Recent commits have broken 28 tests.  Regression tests exist for a 
reason.  Run them.  Before committing.

Sorry. I thought I was committing a trivial change (compile breakage for jump 
across case labels) and accidentally committed my PR1146 changes too. Working 
over a hotel connection is less than satisfying.

This should be fixed now. I'm running regressions as I type this.

Reid.


FAIL: /usr/home/jeffc/llvm/test/Assembler/2006-05-26-VarargsCallEncode.ll
FAIL: 
/usr/home/jeffc/llvm/test/C++Frontend/2003-11-25-ReturningOpaqueByValue.cpp
FAIL: /usr/home/jeffc/llvm/test/C++Frontend/2004-09-27-CompilerCrash.cpp
FAIL: /usr/home/jeffc/llvm/test/CFrontend/2002-04-10-StructParameters.c
FAIL: /usr/home/jeffc/llvm/test/CFrontend/2002-07-14-MiscTests.c
FAIL: /usr/home/jeffc/llvm/test/CFrontend/2002-07-14-MiscTests3.c
FAIL: /usr/home/jeffc/llvm/test/CFrontend/2007-04-11-InlineAsmStruct.c
FAIL: /usr/home/jeffc/llvm/test/CFrontend/2007-04-11-InlineAsmUnion.c
FAIL: /usr/home/jeffc/llvm/test/CodeGen/ARM/2007-03-06-AddR7.ll
FAIL: 
/usr/home/jeffc/llvm/test/CodeGen/ARM/2007-03-26-RegScavengerAssert.ll 
for PR1266
FAIL: /usr/home/jeffc/llvm/test/CodeGen/ARM/sxt_rot.ll
FAIL: /usr/home/jeffc/llvm/test/CodeGen/ARM/uxt_rot.ll
FAIL: /usr/home/jeffc/llvm/test/CodeGen/Alpha/add.ll
FAIL: /usr/home/jeffc/llvm/test/CodeGen/Alpha/i32_sub_1.ll
FAIL: /usr/home/jeffc/llvm/test/CodeGen/Alpha/zapnot.ll
FAIL: 
/usr/home/jeffc/llvm/test/CodeGen/Generic/2007-04-08-MultipleFrameIndices.ll 
for PR1308
FAIL: /usr/home/jeffc/llvm/test/CodeGen/PowerPC/2007-01-29-lbrx-asm.ll
FAIL: 
/usr/home/jeffc/llvm/test/CodeGen/PowerPC/2007-01-31-InlineAsmAddrMode.ll
FAIL: /usr/home/jeffc/llvm/test/CodeGen/PowerPC/and-elim.ll
FAIL: /usr/home/jeffc/llvm/test/CodeGen/PowerPC/and_sext.ll
FAIL: /usr/home/jeffc/llvm/test/CodeGen/PowerPC/small-arguments.ll
FAIL: 
/usr/home/jeffc/llvm/test/CodeGen/X86/2006-07-12-InlineAsmQConstraint.ll 
for PR828
FAIL: /usr/home/jeffc/llvm/test/CodeGen/X86/2006-11-12-CSRetCC.ll
FAIL: /usr/home/jeffc/llvm/test/CodeGen/X86/mingw-alloca.ll
FAIL: /usr/home/jeffc/llvm/test/CodeGen/X86/trunc-to-bool.ll
FAIL: /usr/home/jeffc/llvm/test/CodeGen/X86/x86-64-arg.ll
FAIL: /usr/home/jeffc/llvm/test/CodeGen/X86/x86-64-shortint.ll
FAIL: /usr/home/jeffc/llvm/test/Feature/paramattrs.ll
FAIL: /usr/home/jeffc/llvm/test/Integer/paramattrs_bt.ll


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

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


Re: [llvm-commits] Regression tests exist for a reason

2007-04-28 Thread Jeff Cohen
That leaves us with six failures:

FAIL: /usr/home/jeffc/llvm/test/CFrontend/2007-04-11-InlineAsmStruct.c
FAIL: /usr/home/jeffc/llvm/test/CFrontend/2007-04-11-InlineAsmUnion.c
FAIL: 
/usr/home/jeffc/llvm/test/CodeGen/Generic/2007-04-08-MultipleFrameIndices.ll 
for PR1308
FAIL: /usr/home/jeffc/llvm/test/CodeGen/PowerPC/2007-01-29-lbrx-asm.ll
FAIL: 
/usr/home/jeffc/llvm/test/CodeGen/PowerPC/2007-01-31-InlineAsmAddrMode.ll
FAIL: 
/usr/home/jeffc/llvm/test/CodeGen/X86/2006-07-12-InlineAsmQConstraint.ll 
for PR828

Which commit is responsible for these?  We wouldn't have to ask the 
question if everyone ran the regression tests before committing, much 
less waste time answering it.

Yes, I'm ranting here, but this happens too frequently.

Reid Spencer wrote:
 Jeff,

 On Sat, 28 Apr 2007 08:53:34 -0700
  Jeff Cohen [EMAIL PROTECTED] wrote:
   
 Recent commits have broken 28 tests.  Regression tests exist for a 
 reason.  Run them.  Before committing.
 

 Sorry. I thought I was committing a trivial change (compile breakage for jump 
 across case labels) and accidentally committed my PR1146 changes too. Working 
 over a hotel connection is less than satisfying.

 This should be fixed now. I'm running regressions as I type this.

 Reid.

   
 FAIL: /usr/home/jeffc/llvm/test/Assembler/2006-05-26-VarargsCallEncode.ll
 FAIL: 
 /usr/home/jeffc/llvm/test/C++Frontend/2003-11-25-ReturningOpaqueByValue.cpp
 FAIL: /usr/home/jeffc/llvm/test/C++Frontend/2004-09-27-CompilerCrash.cpp
 FAIL: /usr/home/jeffc/llvm/test/CFrontend/2002-04-10-StructParameters.c
 FAIL: /usr/home/jeffc/llvm/test/CFrontend/2002-07-14-MiscTests.c
 FAIL: /usr/home/jeffc/llvm/test/CFrontend/2002-07-14-MiscTests3.c
 FAIL: /usr/home/jeffc/llvm/test/CFrontend/2007-04-11-InlineAsmStruct.c
 FAIL: /usr/home/jeffc/llvm/test/CFrontend/2007-04-11-InlineAsmUnion.c
 FAIL: /usr/home/jeffc/llvm/test/CodeGen/ARM/2007-03-06-AddR7.ll
 FAIL: 
 /usr/home/jeffc/llvm/test/CodeGen/ARM/2007-03-26-RegScavengerAssert.ll 
 for PR1266
 FAIL: /usr/home/jeffc/llvm/test/CodeGen/ARM/sxt_rot.ll
 FAIL: /usr/home/jeffc/llvm/test/CodeGen/ARM/uxt_rot.ll
 FAIL: /usr/home/jeffc/llvm/test/CodeGen/Alpha/add.ll
 FAIL: /usr/home/jeffc/llvm/test/CodeGen/Alpha/i32_sub_1.ll
 FAIL: /usr/home/jeffc/llvm/test/CodeGen/Alpha/zapnot.ll
 FAIL: 
 /usr/home/jeffc/llvm/test/CodeGen/Generic/2007-04-08-MultipleFrameIndices.ll 
 for PR1308
 FAIL: /usr/home/jeffc/llvm/test/CodeGen/PowerPC/2007-01-29-lbrx-asm.ll
 FAIL: 
 /usr/home/jeffc/llvm/test/CodeGen/PowerPC/2007-01-31-InlineAsmAddrMode.ll
 FAIL: /usr/home/jeffc/llvm/test/CodeGen/PowerPC/and-elim.ll
 FAIL: /usr/home/jeffc/llvm/test/CodeGen/PowerPC/and_sext.ll
 FAIL: /usr/home/jeffc/llvm/test/CodeGen/PowerPC/small-arguments.ll
 FAIL: 
 /usr/home/jeffc/llvm/test/CodeGen/X86/2006-07-12-InlineAsmQConstraint.ll 
 for PR828
 FAIL: /usr/home/jeffc/llvm/test/CodeGen/X86/2006-11-12-CSRetCC.ll
 FAIL: /usr/home/jeffc/llvm/test/CodeGen/X86/mingw-alloca.ll
 FAIL: /usr/home/jeffc/llvm/test/CodeGen/X86/trunc-to-bool.ll
 FAIL: /usr/home/jeffc/llvm/test/CodeGen/X86/x86-64-arg.ll
 FAIL: /usr/home/jeffc/llvm/test/CodeGen/X86/x86-64-shortint.ll
 FAIL: /usr/home/jeffc/llvm/test/Feature/paramattrs.ll
 FAIL: /usr/home/jeffc/llvm/test/Integer/paramattrs_bt.ll


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




   

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


Re: [llvm-commits] Regression tests exist for a reason

2007-04-28 Thread Reid Spencer
On Sat, 28 Apr 2007 09:45:19 -0700
 Jeff Cohen [EMAIL PROTECTED] wrote:
That leaves us with six failures:

FAIL: /usr/home/jeffc/llvm/test/CFrontend/2007-04-11-InlineAsmStruct.c
FAIL: /usr/home/jeffc/llvm/test/CFrontend/2007-04-11-InlineAsmUnion.c
FAIL: 
/usr/home/jeffc/llvm/test/CodeGen/Generic/2007-04-08-MultipleFrameIndices.ll 
for PR1308
FAIL: /usr/home/jeffc/llvm/test/CodeGen/PowerPC/2007-01-29-lbrx-asm.ll
FAIL: /usr/home/jeffc/llvm/test/CodeGen/PowerPC/2007-01-31-InlineAsmAddrMode.ll
FAIL: /usr/home/jeffc/llvm/test/CodeGen/X86/2006-07-12-InlineAsmQConstraint.ll 
for PR828

Which commit is responsible for these?  We wouldn't have to ask the question 
if everyone ran the regression tests before committing, much less waste time 
answering it.

Yes, I'm ranting here, but this happens too frequently.

These look to be regressions from the inline assembly stuff that Chris was 
working on last night. Well, at least 4 of them. Not sure about the other two.


Reid Spencer wrote:
 Jeff,

 On Sat, 28 Apr 2007 08:53:34 -0700
  Jeff Cohen [EMAIL PROTECTED] wrote:
   
 Recent commits have broken 28 tests.  Regression tests exist for a 
 reason.  Run them.  Before committing.
 

 Sorry. I thought I was committing a trivial change (compile breakage for 
 jump across case labels) and accidentally committed my PR1146 changes too. 
 Working over a hotel connection is less than satisfying.

 This should be fixed now. I'm running regressions as I type this.

 Reid.

   
 FAIL: /usr/home/jeffc/llvm/test/Assembler/2006-05-26-VarargsCallEncode.ll
 FAIL: 
 /usr/home/jeffc/llvm/test/C++Frontend/2003-11-25-ReturningOpaqueByValue.cpp
 FAIL: /usr/home/jeffc/llvm/test/C++Frontend/2004-09-27-CompilerCrash.cpp
 FAIL: /usr/home/jeffc/llvm/test/CFrontend/2002-04-10-StructParameters.c
 FAIL: /usr/home/jeffc/llvm/test/CFrontend/2002-07-14-MiscTests.c
 FAIL: /usr/home/jeffc/llvm/test/CFrontend/2002-07-14-MiscTests3.c
 FAIL: /usr/home/jeffc/llvm/test/CFrontend/2007-04-11-InlineAsmStruct.c
 FAIL: /usr/home/jeffc/llvm/test/CFrontend/2007-04-11-InlineAsmUnion.c
 FAIL: /usr/home/jeffc/llvm/test/CodeGen/ARM/2007-03-06-AddR7.ll
 FAIL: 
 /usr/home/jeffc/llvm/test/CodeGen/ARM/2007-03-26-RegScavengerAssert.ll 
 for PR1266
 FAIL: /usr/home/jeffc/llvm/test/CodeGen/ARM/sxt_rot.ll
 FAIL: /usr/home/jeffc/llvm/test/CodeGen/ARM/uxt_rot.ll
 FAIL: /usr/home/jeffc/llvm/test/CodeGen/Alpha/add.ll
 FAIL: /usr/home/jeffc/llvm/test/CodeGen/Alpha/i32_sub_1.ll
 FAIL: /usr/home/jeffc/llvm/test/CodeGen/Alpha/zapnot.ll
 FAIL: 
 /usr/home/jeffc/llvm/test/CodeGen/Generic/2007-04-08-MultipleFrameIndices.ll
  
 for PR1308
 FAIL: /usr/home/jeffc/llvm/test/CodeGen/PowerPC/2007-01-29-lbrx-asm.ll
 FAIL: 
 /usr/home/jeffc/llvm/test/CodeGen/PowerPC/2007-01-31-InlineAsmAddrMode.ll
 FAIL: /usr/home/jeffc/llvm/test/CodeGen/PowerPC/and-elim.ll
 FAIL: /usr/home/jeffc/llvm/test/CodeGen/PowerPC/and_sext.ll
 FAIL: /usr/home/jeffc/llvm/test/CodeGen/PowerPC/small-arguments.ll
 FAIL: 
 /usr/home/jeffc/llvm/test/CodeGen/X86/2006-07-12-InlineAsmQConstraint.ll 
 for PR828
 FAIL: /usr/home/jeffc/llvm/test/CodeGen/X86/2006-11-12-CSRetCC.ll
 FAIL: /usr/home/jeffc/llvm/test/CodeGen/X86/mingw-alloca.ll
 FAIL: /usr/home/jeffc/llvm/test/CodeGen/X86/trunc-to-bool.ll
 FAIL: /usr/home/jeffc/llvm/test/CodeGen/X86/x86-64-arg.ll
 FAIL: /usr/home/jeffc/llvm/test/CodeGen/X86/x86-64-shortint.ll
 FAIL: /usr/home/jeffc/llvm/test/Feature/paramattrs.ll
 FAIL: /usr/home/jeffc/llvm/test/Integer/paramattrs_bt.ll


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




   


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


Re: [llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp

2007-04-28 Thread Chris Lattner
On Apr 28, 2007, at 7:35 AM, Anton Korobeynikov wrote:
 Index: llvm/lib/VMCore/Verifier.cpp
 diff -u llvm/lib/VMCore/Verifier.cpp:1.207 llvm/lib/VMCore/ 
 Verifier.cpp:1.208
 --- llvm/lib/VMCore/Verifier.cpp:1.207Sat Apr 28 08:45:00 2007
 +++ llvm/lib/VMCore/Verifier.cpp  Sat Apr 28 09:35:41 2007
 @@ -319,6 +319,13 @@
Assert1(GA.getType() == GA.getAliasee()-getType(),
Alias and aliasee types should match!, GA);

 +  if (!isaGlobalValue(GA.getAliasee())) {
 +const ConstantExpr *CE = dyn_castConstantExpr(GA.getAliasee());
 +Assert1(CE  CE-getOpcode() == Instruction::BitCast,

I'd suggest:  isaGlobalValue(CE-getOperand(0))

-Chris

 +Aliasee should be either GlobalValue or bitcast of  
 GlobalValue,
 +GA);
 +  }
 +
visitGlobalValue(GA);
  }




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

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


Re: [llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp

2007-04-28 Thread Anton Korobeynikov
 I'd suggest:  isaGlobalValue(CE-getOperand(0))
So, nobody will produce multiple bitcasts, right?
e.g. this is illegal:
@A = alias (bitcast (bitcast i64* @foo to i8*) to i32*

-- 
With best regards, Anton Korobeynikov.

Faculty of Mathematics  Mechanics, Saint Petersburg State University.


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


Re: [llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp

2007-04-28 Thread Chris Lattner

On Apr 28, 2007, at 1:01 PM, Anton Korobeynikov wrote:

 I'd suggest:  isaGlobalValue(CE-getOperand(0))
 So, nobody will produce multiple bitcasts, right?
 e.g. this is illegal:
 @A = alias (bitcast (bitcast i64* @foo to i8*) to i32*

Right, ConstantExpr::getBitCast will fold those.  Try doing llvm-as |  
llvm-dis  and the output should have them folded.

-Chris

___
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/SelectionDAGISel.cpp

2007-04-28 Thread Chris Lattner


Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGISel.cpp updated: 1.434 - 1.435
---
Log message:

Significant refactoring of the inline asm stuff, to support future changes.
No functionality change.


---
Diffs of the changes:  (+107 -82)

 SelectionDAGISel.cpp |  189 ---
 1 files changed, 107 insertions(+), 82 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.434 
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.435
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.434Sat Apr 28 
01:42:38 2007
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp  Sat Apr 28 15:49:53 2007
@@ -3172,85 +3172,109 @@
   return *Current;
 }
 
+namespace {
+/// AsmOperandInfo - This contains information for each constraint that we are
+/// lowering.
+struct AsmOperandInfo : public InlineAsm::ConstraintInfo {
+  /// ConstraintCode - This contains the actual string for the code, like m.
+  std::string ConstraintCode;
+  
+  /// CallOperand/CallOperandval - If this is the result output operand or a
+  /// clobber, this is null, otherwise it is the incoming operand to the
+  /// CallInst.  This gets modified as the asm is processed.
+  SDOperand CallOperand;
+  Value *CallOperandVal;
+  
+  /// ConstraintVT - The ValueType for the operand value.
+  MVT::ValueType ConstraintVT;
+  
+  AsmOperandInfo(const InlineAsm::ConstraintInfo info)
+: InlineAsm::ConstraintInfo(info),
+  CallOperand(0,0), CallOperandVal(0), ConstraintVT(MVT::Other) {
+  }
+};
+} // end anon namespace.
 
 /// visitInlineAsm - Handle a call to an InlineAsm object.
 ///
 void SelectionDAGLowering::visitInlineAsm(CallInst I) {
   InlineAsm *IA = castInlineAsm(I.getOperand(0));
-  
-  SDOperand AsmStr = DAG.getTargetExternalSymbol(IA-getAsmString().c_str(),
- MVT::Other);
 
-  std::vectorInlineAsm::ConstraintInfo Constraints = IA-ParseConstraints();
-  std::vectorMVT::ValueType ConstraintVTs;
-  
-  /// AsmNodeOperands - A list of pairs.  The first element is a register, the
-  /// second is a bitfield where bit #0 is set if it is a use and bit #1 is set
-  /// if it is a def of that register.
-  std::vectorSDOperand AsmNodeOperands;
-  AsmNodeOperands.push_back(SDOperand());  // reserve space for input chain
-  AsmNodeOperands.push_back(AsmStr);
+  /// ConstraintOperands - Information about all of the constraints.
+  std::vectorAsmOperandInfo ConstraintOperands;
   
   SDOperand Chain = getRoot();
   SDOperand Flag;
   
-  // We fully assign registers here at isel time.  This is not optimal, but
-  // should work.  For register classes that correspond to LLVM classes, we
-  // could let the LLVM RA do its thing, but we currently don't.  Do a prepass
-  // over the constraints, collecting fixed registers that we know we can't 
use.
   std::setunsigned OutputRegs, InputRegs;
-  unsigned OpNum = 1;
-  for (unsigned i = 0, e = Constraints.size(); i != e; ++i) {
-std::string ConstraintCode =
-  GetMostGeneralConstraint(Constraints[i].Codes, TLI);
+
+  // Do a prepass over the constraints, canonicalizing them, and building up 
the
+  // ConstraintOperands list.
+  std::vectorInlineAsm::ConstraintInfo
+ConstraintInfos = IA-ParseConstraints();
+  unsigned OpNo = 1;
+  for (unsigned i = 0, e = ConstraintInfos.size(); i != e; ++i) {
+ConstraintOperands.push_back(AsmOperandInfo(ConstraintInfos[i]));
+AsmOperandInfo OpInfo = ConstraintOperands.back();
+
+// Compute the constraint code to use.
+OpInfo.ConstraintCode = GetMostGeneralConstraint(OpInfo.Codes, TLI);
 
-MVT::ValueType OpVT;
+MVT::ValueType OpVT = MVT::Other;
 
-// Compute the value type for each operand and add it to ConstraintVTs.
-switch (Constraints[i].Type) {
+// Compute the value type for each operand.
+switch (OpInfo.Type) {
 case InlineAsm::isOutput:
-  if (!Constraints[i].isIndirect) {
-// The return value of the call is this value.
+  if (!OpInfo.isIndirect) {
+// The return value of the call is this value.  As such, there is no
+// corresponding argument.
 assert(I.getType() != Type::VoidTy  Bad inline asm!);
 OpVT = TLI.getValueType(I.getType());
   } else {
-const Type *OpTy = I.getOperand(OpNum)-getType();
-OpVT = 
TLI.getValueType(castPointerType(OpTy)-getElementType(),true);
-OpNum++;  // Consumes a call operand.
+OpInfo.CallOperandVal = I.getOperand(OpNo++);
   }
   break;
 case InlineAsm::isInput:
-  if (!Constraints[i].isIndirect) {
-OpVT = TLI.getValueType(I.getOperand(OpNum)-getType());
-  } else {
-const Type *OpTy = I.getOperand(OpNum)-getType();
-OpVT = 
TLI.getValueType(castPointerType(OpTy)-getElementType(),true);
-  }
-  OpNum++;  // Consumes a call operand.
+  

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

2007-04-28 Thread Chris Lattner


Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGISel.cpp updated: 1.435 - 1.436
---
Log message:

merge constraint type analysis stuff together.


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

 SelectionDAGISel.cpp |   35 +--
 1 files changed, 21 insertions(+), 14 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.435 
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.436
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.435Sat Apr 28 
15:49:53 2007
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp  Sat Apr 28 16:01:43 2007
@@ -3178,6 +3178,10 @@
 struct AsmOperandInfo : public InlineAsm::ConstraintInfo {
   /// ConstraintCode - This contains the actual string for the code, like m.
   std::string ConstraintCode;
+
+  /// ConstraintType - Information about the constraint code, e.g. Register,
+  /// RegisterClass, Memory, Other, Unknown.
+  TargetLowering::ConstraintType ConstraintType;
   
   /// CallOperand/CallOperandval - If this is the result output operand or a
   /// clobber, this is null, otherwise it is the incoming operand to the
@@ -3189,7 +3193,8 @@
   MVT::ValueType ConstraintVT;
   
   AsmOperandInfo(const InlineAsm::ConstraintInfo info)
-: InlineAsm::ConstraintInfo(info),
+: InlineAsm::ConstraintInfo(info), 
+  ConstraintType(TargetLowering::C_Unknown),
   CallOperand(0,0), CallOperandVal(0), ConstraintVT(MVT::Other) {
   }
 };
@@ -3217,9 +3222,6 @@
 ConstraintOperands.push_back(AsmOperandInfo(ConstraintInfos[i]));
 AsmOperandInfo OpInfo = ConstraintOperands.back();
 
-// Compute the constraint code to use.
-OpInfo.ConstraintCode = GetMostGeneralConstraint(OpInfo.Codes, TLI);
-
 MVT::ValueType OpVT = MVT::Other;
 
 // Compute the value type for each operand.
@@ -3255,6 +3257,13 @@
 }
 
 OpInfo.ConstraintVT = OpVT;
+
+// Compute the constraint code to use.
+OpInfo.ConstraintCode = GetMostGeneralConstraint(OpInfo.Codes, TLI);
+
+// Compute the constraint type.
+// FIXME: merge this into GetMostGeneralConstraint.
+OpInfo.ConstraintType = TLI.getConstraintType(OpInfo.ConstraintCode);
 
 if (TLI.getRegForInlineAsmConstraint(OpInfo.ConstraintCode, OpVT).first 
==0)
   continue;  // Not assigned a fixed reg.
@@ -3315,7 +3324,8 @@
   if (OpInfo.ConstraintCode.size() == 1)   // not a physreg name.
 CTy = TLI.getConstraintType(OpInfo.ConstraintCode);
   
-  if (CTy != TargetLowering::C_RegisterClass) {
+  if (CTy != TargetLowering::C_RegisterClass 
+  CTy != TargetLowering::C_Register) {
 // Memory output, or 'other' output (e.g. 'X' constraint).
 SDOperand InOperandVal = OpInfo.CallOperand;
 
@@ -,8 +3343,7 @@
 break;
   }
 
-  // Otherwise, this is a register output.
-  assert(CTy == TargetLowering::C_RegisterClass  Unknown op type!);
+  // Otherwise, this is a register or register class output.
 
   // If this is an early-clobber output, or if there is an input
   // constraint that matches this, we need to reserve the input register
@@ -3416,11 +3425,7 @@
 }
   }
   
-  TargetLowering::ConstraintType CTy = TargetLowering::C_RegisterClass;
-  if (OpInfo.ConstraintCode.size() == 1)   // not a physreg name.
-CTy = TLI.getConstraintType(OpInfo.ConstraintCode);
-
-  if (CTy == TargetLowering::C_Other) {
+  if (OpInfo.ConstraintType == TargetLowering::C_Other) {
 assert(!OpInfo.isIndirect  
Don't know how to handle indirect other inputs yet!);
 
@@ -3438,7 +3443,7 @@
 AsmNodeOperands.push_back(DAG.getConstant(ResOpType, MVT::i32));
 AsmNodeOperands.push_back(InOperandVal);
 break;
-  } else if (CTy == TargetLowering::C_Memory) {
+  } else if (OpInfo.ConstraintType == TargetLowering::C_Memory) {
 // Memory input.  Memory operands really want the address of the value,
 // so we want an indirect input.  If we don't have an indirect input,
 // spill the value somewhere if we can, otherwise spill it to a stack
@@ -3475,7 +3480,9 @@
 break;
   }
 
-  assert(CTy == TargetLowering::C_RegisterClass  Unknown op type!);
+  assert((OpInfo.ConstraintType == TargetLowering::C_RegisterClass ||
+  OpInfo.ConstraintType == TargetLowering::C_Register) 
+ Unknown constraint type!);
   assert(!OpInfo.isIndirect  
  Don't know how to handle indirect register inputs yet!);
 



___
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/SelectionDAGISel.cpp

2007-04-28 Thread Chris Lattner


Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGISel.cpp updated: 1.436 - 1.437
---
Log message:

eliminate more redundant constraint type analysis


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

 SelectionDAGISel.cpp |8 ++--
 1 files changed, 2 insertions(+), 6 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.436 
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.437
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.436Sat Apr 28 
16:01:43 2007
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp  Sat Apr 28 16:03:16 2007
@@ -3320,12 +3320,8 @@
 
 switch (OpInfo.Type) {
 case InlineAsm::isOutput: {
-  TargetLowering::ConstraintType CTy = TargetLowering::C_RegisterClass;
-  if (OpInfo.ConstraintCode.size() == 1)   // not a physreg name.
-CTy = TLI.getConstraintType(OpInfo.ConstraintCode);
-  
-  if (CTy != TargetLowering::C_RegisterClass 
-  CTy != TargetLowering::C_Register) {
+  if (OpInfo.ConstraintType != TargetLowering::C_RegisterClass 
+  OpInfo.ConstraintType != TargetLowering::C_Register) {
 // Memory output, or 'other' output (e.g. 'X' constraint).
 SDOperand InOperandVal = OpInfo.CallOperand;
 



___
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/SelectionDAGISel.cpp

2007-04-28 Thread Chris Lattner


Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGISel.cpp updated: 1.437 - 1.438
---
Log message:

memory operands that have a direct operand should have their stores created
before the copies into physregs are done.  This avoids having flag operands
skip the store, causing cycles in the dag at sched time.  This fixes infinite 
loops on these tests:

test/CodeGen/Generic/2007-04-08-MultipleFrameIndices.ll for PR1308: 
http://llvm.org/PR1308 
test/CodeGen/PowerPC/2007-01-29-lbrx-asm.ll
test/CodeGen/PowerPC/2007-01-31-InlineAsmAddrMode.ll
test/CodeGen/X86/2006-07-12-InlineAsmQConstraint.ll for PR828: 
http://llvm.org/PR828 



---
Diffs of the changes:  (+42 -35)

 SelectionDAGISel.cpp |   77 +++
 1 files changed, 42 insertions(+), 35 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.437 
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.438
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.437Sat Apr 28 
16:03:16 2007
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp  Sat Apr 28 16:12:06 2007
@@ -3265,6 +3265,45 @@
 // FIXME: merge this into GetMostGeneralConstraint.
 OpInfo.ConstraintType = TLI.getConstraintType(OpInfo.ConstraintCode);
 
+
+// If this is a memory input, and if the operand is not indirect, do what 
we
+// need to to provide an address for the memory input.
+if (OpInfo.ConstraintType == TargetLowering::C_Memory 
+!OpInfo.isIndirect) {
+  assert(OpInfo.Type == InlineAsm::isInput 
+ Can only indirectify direct input operands!);
+  
+  // Memory operands really want the address of the value.  If we don't 
have
+  // an indirect input, put it in the constpool if we can, otherwise spill
+  // it to a stack slot.
+  
+  // If the operand is a float, integer, or vector constant, spill to a
+  // constant pool entry to get its address.
+  Value *OpVal = OpInfo.CallOperandVal;
+  if (isaConstantFP(OpVal) || isaConstantInt(OpVal) ||
+  isaConstantVector(OpVal)) {
+OpInfo.CallOperand = DAG.getConstantPool(castConstant(OpVal),
+ TLI.getPointerTy());
+  } else {
+// Otherwise, create a stack slot and emit a store to it before the
+// asm.
+const Type *Ty = OpVal-getType();
+uint64_t TySize = TLI.getTargetData()-getTypeSize(Ty);
+unsigned Align  = TLI.getTargetData()-getPrefTypeAlignment(Ty);
+MachineFunction MF = DAG.getMachineFunction();
+int SSFI = MF.getFrameInfo()-CreateStackObject(TySize, Align);
+SDOperand StackSlot = DAG.getFrameIndex(SSFI, TLI.getPointerTy());
+Chain = DAG.getStore(Chain, OpInfo.CallOperand, StackSlot, NULL, 0);
+OpInfo.CallOperand = StackSlot;
+  }
+ 
+  // There is no longer a Value* corresponding to this operand.
+  OpInfo.CallOperandVal = 0;
+  // It is now an indirect operand.
+  OpInfo.isIndirect = true;
+}
+
+
 if (TLI.getRegForInlineAsmConstraint(OpInfo.ConstraintCode, OpVT).first 
==0)
   continue;  // Not assigned a fixed reg.
 
@@ -3323,19 +3362,12 @@
   if (OpInfo.ConstraintType != TargetLowering::C_RegisterClass 
   OpInfo.ConstraintType != TargetLowering::C_Register) {
 // Memory output, or 'other' output (e.g. 'X' constraint).
-SDOperand InOperandVal = OpInfo.CallOperand;
-
-// Check that the operand (the address to store to) isn't a float.
-if (!MVT::isInteger(InOperandVal.getValueType()))
-  assert(0  MATCH FAIL!);
-
-if (!OpInfo.isIndirect)
-  assert(0  MATCH FAIL!);
+assert(OpInfo.isIndirect  Memory output must be indirect operand);
 
 // Add information to the INLINEASM node to know about this output.
 unsigned ResOpType = 4/*MEM*/ | (1  3);
 AsmNodeOperands.push_back(DAG.getConstant(ResOpType, MVT::i32));
-AsmNodeOperands.push_back(InOperandVal);
+AsmNodeOperands.push_back(OpInfo.CallOperand);
 break;
   }
 
@@ -3440,32 +3472,7 @@
 AsmNodeOperands.push_back(InOperandVal);
 break;
   } else if (OpInfo.ConstraintType == TargetLowering::C_Memory) {
-// Memory input.  Memory operands really want the address of the value,
-// so we want an indirect input.  If we don't have an indirect input,
-// spill the value somewhere if we can, otherwise spill it to a stack
-// slot.
-if (!OpInfo.isIndirect) {
-  // If the operand is a float, integer, or vector constant, spill to a
-  // constant pool entry to get its address.
-  Value *OpVal = OpInfo.CallOperandVal;
-  if (isaConstantFP(OpVal) || isaConstantInt(OpVal) ||
-  isaConstantVector(OpVal)) {
-InOperandVal = 

[llvm-commits] CVS: llvm/docs/LangRef.html

2007-04-28 Thread Jeff Cohen


Changes in directory llvm/docs:

LangRef.html updated: 1.239 - 1.240
---
Log message:

Minor corrections.

---
Diffs of the changes:  (+60 -61)

 LangRef.html |  121 +--
 1 files changed, 60 insertions(+), 61 deletions(-)


Index: llvm/docs/LangRef.html
diff -u llvm/docs/LangRef.html:1.239 llvm/docs/LangRef.html:1.240
--- llvm/docs/LangRef.html:1.239Sat Apr 28 08:44:59 2007
+++ llvm/docs/LangRef.html  Sat Apr 28 20:07:00 2007
@@ -3097,7 +3097,7 @@
 h5Example:/h5
 pre
   %X = uitofp i32 257 to float i; yields float:257.0/i
-  %Y = uitofp i8  -1 to double   i; yields double:255.0/i
+  %Y = uitofp i8  -1 to double i; yields double:255.0/i
 /pre
 /div
 
@@ -3129,7 +3129,7 @@
 h5Example:/h5
 pre
   %X = sitofp i32 257 to float i; yields float:257.0/i
-  %Y = sitofp i8  -1 to double   i; yields double:-1.0/i
+  %Y = sitofp i8  -1 to double i; yields double:-1.0/i
 /pre
 /div
 
@@ -3159,12 +3159,13 @@
 truncating or zero extending that value to the size of the integer type. If
 ttvalue/tt is smaller than ttty2/tt then a zero extension is done. If
 ttvalue/tt is larger than ttty2/tt then a truncation is done. If they
-are the same size, then nothing is done (ino-op cast/i)./p
+are the same size, then nothing is done (ino-op cast/i) other than a type
+change./p
 
 h5Example:/h5
 pre
-  %X = ptrtoint i32* %X to i8   i; yields truncation on 32-bit/i
-  %Y = ptrtoint i32* %x to i64  i; yields zero extend on 32-bit/i
+  %X = ptrtoint i32* %X to i8   i; yields truncation on 32-bit 
architecture/i
+  %Y = ptrtoint i32* %x to i64  i; yields zero extension on 32-bit 
architecture/i
 /pre
 /div
 
@@ -3198,9 +3199,9 @@
 
 h5Example:/h5
 pre
-  %X = inttoptr i32 255 to i32*i; yields zero extend on 
64-bit/i
-  %X = inttoptr i32 255 to i32*i; yields no-op on 32-bit /i
-  %Y = inttoptr i16 0 to i32*i; yields zero extend on 32-bit/i
+  %X = inttoptr i32 255 to i32*  i; yields zero extension on 64-bit 
architecture/i
+  %X = inttoptr i32 255 to i32*  i; yields no-op on 32-bit 
architecture/i
+  %Y = inttoptr i64 0 to i32*i; yields truncation on 32-bit 
architecture/i
 /pre
 /div
 
@@ -3237,7 +3238,7 @@
 
 h5Example:/h5
 pre
-  %X = bitcast i8 255 to i8  i; yields i8 :-1/i
+  %X = bitcast i8 255 to i8  i; yields i8 :-1/i
   %Y = bitcast i32* %x to sint*  i; yields sint*:%x/i
   %Z = bitcast 2xint %V to i64;i; yields i64: %V/i   
 /pre
@@ -3255,16 +3256,15 @@
 /div
 div class=doc_text
 h5Syntax:/h5
-pre  lt;resultgt; = icmp lt;condgt; lt;tygt; lt;var1gt;, lt;var2gt;
-i; yields {i1}:result/i
+pre  lt;resultgt; = icmp lt;condgt; lt;tygt; lt;var1gt;, 
lt;var2gt;   i; yields {i1}:result/i
 /pre
 h5Overview:/h5
 pThe 'tticmp/tt' instruction returns a boolean value based on comparison
 of its two integer operands./p
 h5Arguments:/h5
 pThe 'tticmp/tt' instruction takes three operands. The first operand is
-the condition code which indicates the kind of comparison to perform. It is not
-a value, just a keyword. The possibilities for the condition code are:
+the condition code indicating the kind of comparison to perform. It is not
+a value, just a keyword. The possible condition code are:
 ol
   litteq/tt: equal/li
   littne/tt: not equal /li
@@ -3307,7 +3307,7 @@
   tttrue/tt if ttvar1/tt is less than or equal to ttvar2/tt./li
 /ol
 pIf the operands are a href=#t_pointerpointer/a typed, the pointer
-values are treated as integers and then compared./p
+values are compared as if they were integers./p
 
 h5Example:/h5
 pre  lt;resultgt; = icmp eq i32 4, 5  i; yields: result=false/i
@@ -3324,16 +3324,15 @@
 /div
 div class=doc_text
 h5Syntax:/h5
-pre  lt;resultgt; = fcmp lt;condgt; lt;tygt; lt;var1gt;, lt;var2gt;
-i; yields {i1}:result/i
+pre  lt;resultgt; = fcmp lt;condgt; lt;tygt; lt;var1gt;, 
lt;var2gt; i; yields {i1}:result/i
 /pre
 h5Overview:/h5
 pThe 'ttfcmp/tt' instruction returns a boolean value based on comparison
 of its floating point operands./p
 h5Arguments:/h5
 pThe 'ttfcmp/tt' instruction takes three operands. The first operand is
-the condition code which indicates the kind of comparison to perform. It is not
-a value, just a keyword. The possibilities for the condition code are:
+the condition code indicating the kind of comparison to perform. It is not
+a value, just a keyword. The possible condition code are:
 ol
   littfalse/tt: no comparison, always returns false/li
   littoeq/tt: ordered and equal/li
@@ -3352,13 +3351,11 @@
   littuno/tt: unordered (either nans)/li
   litttrue/tt: no comparison, always returns true/li
 /ol
-pIn the preceding, iordered/i means that neither operand is a QNAN while
+piOrdered/i means that neither operand is a QNAN while
 iunordered/i means that either operand may be a QNAN./p
 pThe ttval1/tt and ttval2/tt arguments must be
 a 

Re: [llvm-commits] Regression tests exist for a reason

2007-04-28 Thread Christopher Lamb
As part of the SVN migration, perhaps we could get an autobuilder  
that builds and runs at least the llvm/test suite for each changeset.  
That'd at least make identifying the offending changeset possible.


--
Christopher Lamb



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


Re: [llvm-commits] Regression tests exist for a reason

2007-04-28 Thread Reid Spencer
Hi Chris,

On Sat, 28 Apr 2007 20:09:14 -0500
 Christopher Lamb [EMAIL PROTECTED] wrote:
As part of the SVN migration, perhaps we could get an autobuilder  that builds 
and runs at least the llvm/test suite for each changeset.  That'd at least 
make identifying the offending changeset possible.

That's a pretty good idea. It could even auto-email the llvm-commits list 
saying this change set broke the build or caused regressions

Could you please file an enhancement bug asking for this feature?  That way it 
won't get forgotten.

Thanks,

Reid.

--
Christopher Lamb




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


Re: [llvm-commits] Regression tests exist for a reason

2007-04-28 Thread Christopher Lamb


On Apr 28, 2007, at 9:07 PM, Reid Spencer wrote:


Hi Chris,

On Sat, 28 Apr 2007 20:09:14 -0500
 Christopher Lamb [EMAIL PROTECTED] wrote:
As part of the SVN migration, perhaps we could get an autobuilder   
that builds and runs at least the llvm/test suite for each  
changeset.  That'd at least make identifying the offending  
changeset possible.


That's a pretty good idea. It could even auto-email the llvm- 
commits list saying this change set broke the build or caused  
regressions


Could you please file an enhancement bug asking for this feature?   
That way it won't get forgotten.


Done. http://llvm.org/bugs/show_bug.cgi?id=1368

--
Christopher Lamb



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


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

2007-04-28 Thread Chris Lattner
 Index: llvm/lib/CodeGen/AsmPrinter.cpp
 diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.157 llvm/lib/CodeGen/ 
 AsmPrinter.cpp:1.158
 --- llvm/lib/CodeGen/AsmPrinter.cpp:1.157 Wed Apr 25 09:27:10 2007
 +++ llvm/lib/CodeGen/AsmPrinter.cpp   Sat Apr 28 08:44:59 2007
 @@ -123,18 +123,29 @@
  for (Module::const_alias_iterator I = M.alias_begin(), E =  
 M.alias_end();
   I!=E; ++I) {
 -  const GlobalValue *Aliasee = I-getAliasee();
 -  assert(Aliasee  Aliasee cannot be null!);
 -  std::string Target   = Mang-getValueName(Aliasee);
 -  std::string Name = Mang-getValueName(I);
 +  const Constant *Aliasee = dyn_cast_or_nullConstant(I- 
 getAliasee());
 +  assert(Aliasee  Aliasee cannot be null);

Just use castConstant()

It will assert that the pointer is non-null and is a constant.


 -  // Aliases with external weak linkage was emitted already
 +  std::string Name = Mang-getValueName(I);
 +  std::string Target;
 +
 +  if (const GlobalValue *GV = dyn_castGlobalValue(Aliasee))
 +Target = Mang-getValueName(GV);
 +  else {
 +const ConstantExpr *CE = 0;
 +if ((CE = dyn_castConstantExpr(Aliasee)) 
 +(CE-getOpcode() == Instruction::BitCast))
 +  Target = Mang-getValueName(CE-getOperand(0));
 +else
 +  assert(0  Unsupported aliasee);

This seems like a common operation: I'd suggest introducing an (out- 
of-line) method to GlobalAlias:
  GlobalValue *GlobalAlias::getAliaseeGlobal() const

That does this.  At that point, you'd have:

   if (const GlobalValue *GV = I-getAliaseeGlobal())
 ..
   else
 assert();

-Chris


 +  }
 +
if (I-hasExternalLinkage())
  O  \t.globl\t  Name  \n;
else if (I-hasWeakLinkage())



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

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


Re: [llvm-commits] CVS: llvm/include/llvm/Function.h GlobalAlias.h GlobalValue.h GlobalVariable.h

2007-04-28 Thread Chris Lattner
 Index: llvm/include/llvm/Function.h
 diff -u llvm/include/llvm/Function.h:1.82 llvm/include/llvm/ 
 Function.h:1.83
 --- llvm/include/llvm/Function.h:1.82 Wed Apr 25 09:27:10 2007
 +++ llvm/include/llvm/Function.h  Sat Apr 28 08:44:59 2007
 @@ -81,6 +81,15 @@
void setNext(Function *N) { Next = N; }
void setPrev(Function *N) { Prev = N; }

Please also make Function::removeFromParent etc non-virtual,

-Chris



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


Re: [llvm-commits] CVS: llvm/lib/Transforms/IPO/GlobalDCE.cpp

2007-04-28 Thread Chris Lattner
 Index: llvm/lib/Transforms/IPO/GlobalDCE.cpp
 diff -u llvm/lib/Transforms/IPO/GlobalDCE.cpp:1.43 llvm/lib/ 
 Transforms/IPO/GlobalDCE.cpp:1.44
 --- llvm/lib/Transforms/IPO/GlobalDCE.cpp:1.43Wed Apr 25 09:27:10  
 2007
 +++ llvm/lib/Transforms/IPO/GlobalDCE.cpp Sat Apr 28 08:44:59 2007
 @@ -75,9 +75,8 @@

for (Module::alias_iterator I = M.alias_begin(), E = M.alias_end();
 I != E; ++I) {
 -Changed |= RemoveUnusedGlobalValue(*I);
  // Aliases are always needed even if they are not used.
 -GlobalIsNeeded(I);
 +MarkUsedGlobalsAsNeeded(castConstant(I-getAliasee()));

You can drop the cast, the method already returns a Constant.

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


Re: [llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp Globals.cpp Module.cpp Verifier.cpp

2007-04-28 Thread Chris Lattner
 +++ llvm/lib/VMCore/AsmWriter.cpp Sat Apr 28 08:44:59 2007
 @@ -926,7 +926,7 @@
 assert(0  Invalid alias linkage);
}

 -  const GlobalValue *Aliasee = GA-getAliasee();
 +  const Constant *Aliasee = dyn_cast_or_nullConstant(GA- 
 getAliasee());
assert(Aliasee  Aliasee cannot be null);

You can drop the dyn_cast_or_null


if (const GlobalVariable *GV = dyn_castGlobalVariable(Aliasee)) {
 @@ -940,9 +940,15 @@
Out  getLLVMName(F-getName(), GlobalPrefix);
  else
Out  @\\;
 -  } else
 -assert(0  Unsupported aliasee);
 -
 +  } else {
 +const ConstantExpr *CE = 0;
 +if ((CE = dyn_castConstantExpr(Aliasee)) 
 +(CE-getOpcode() == Instruction::BitCast)) {
 +  writeOperand(CE, false);
 +} else
 +  assert(0  Unsupported aliasee);
 +  }

This can use the new getAliaseeGlobal() method.

  bool GlobalAlias::isDeclaration() const {
 -  return (Aliasee  Aliasee-isDeclaration());
 +  const GlobalValue* AV = dyn_cast_or_nullconst GlobalValue 
 (getAliasee());
 +  return (AV  AV-isDeclaration());
  }

What does it mean for an alias to be a declaration?  I'd be fine with  
them always returning true or false.  What code calls  
GlobalValue::isDeclaration?

 +void GlobalAlias::setAliasee(Constant *Aliasee)
  {
 -  // FIXME: Some checks?
 -  Aliasee = GV;
 +  if (Aliasee) {
 +assert(Aliasee-getType() == getType() 
 +   Alias and aliasee types should match!);
 +setOperand(0, Aliasee);
 +  }
  }

With this code, setAliasee(0) is a noop - that is a bug.

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


Re: [llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y

2007-04-28 Thread Chris Lattner
 +  switch (ID.Type) {
 +  case ValID::GlobalName:
 +  case ValID::GlobalID:
 +   const PointerType *PTy = dyn_castPointerType(Ty);
 +   if (!PTy) {
 + GenerateError(Invalid type for reference to global );
 + return 0;
 +   }
 +   const Type* ElTy = PTy-getElementType();
 +   if (const FunctionType *FTy = dyn_castFunctionType(ElTy))
 + V = new Function(FTy, GlobalValue::ExternalLinkage);
 +   else
 + V = new GlobalVariable(ElTy, false,  
 GlobalValue::ExternalLinkage);
 +   break;
 +  default:
 +   V = new Argument(Ty);
 +  }

Very nice.  Please indent the code in the case statements one more  
space though :)

 @@ -1943,6 +1959,30 @@
  // ThreadLocal
  ThreadLocal : THREAD_LOCAL { $$ = true; } | { $$ = false; };

 +// AliaseeRef - Match either GlobalValue or bitcast to GlobalValue.
 +AliaseeRef : ResultTypes SymbolicValueRef {
 +const Type* VTy = $1-get();
 +Value *V = getVal(VTy, $2);
 +GlobalValue* Aliasee = dyn_castGlobalValue(V);
 +if (!Aliasee)
 +  GEN_ERROR(Aliases can be created only to global values);
 +
 +$$ = Aliasee;
 +CHECK_FOR_ERROR
 +delete $1;
 +   }
 +   | BITCAST '(' AliaseeRef TO Types ')' {
 +Constant *Val = $3;
 +const Type *DestTy = $5-get();
 +if (!CastInst::castIsValid($1, $3, DestTy))
 +  GEN_ERROR(invalid cast opcode for cast from ' +
 +Val-getType()-getDescription() + ' to ' +
 +DestTy-getDescription() + ');
 +
 +$$ = ConstantExpr::getCast($1, $3, DestTy);
 +CHECK_FOR_ERROR
 +delete $5;
 +   };

I'd suggest eliminating this production and...

 @@ -2045,34 +2085,20 @@
  CurGV = 0;
  CHECK_FOR_ERROR
}
 -  | OptGlobalAssign GVVisibilityStyle ALIAS AliasLinkage ResultTypes
 -SymbolicValueRef {
 +  | OptGlobalAssign GVVisibilityStyle ALIAS AliasLinkage AliaseeRef {

Instead of AliaseeRef, use ResolvedVal here.  Then just check  
ResolvedVal for the two acceptable forms.

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


Re: [llvm-commits] CVS: llvm/docs/BytecodeFormat.html LangRef.html

2007-04-28 Thread Chris Lattner
 Index: llvm/docs/LangRef.html
 diff -u llvm/docs/LangRef.html:1.238 llvm/docs/LangRef.html:1.239
 --- llvm/docs/LangRef.html:1.238  Wed Apr 25 09:27:10 2007
 +++ llvm/docs/LangRef.htmlSat Apr 28 08:44:59 2007
 @@ -24,6 +24,7 @@
lia href=#callingconvCalling Conventions/a/li
lia href=#globalvarsGlobal Variables/a/li
lia href=#functionstructureFunctions/a/li
 +  lia href=aliasstructureAliases/a

This needs a #.

Overall, very nice job Anton!

-Chris


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


[llvm-commits] [126685] Add alias support to llvm-gcc

2007-04-28 Thread clattner
Revision: 126685
Author:   clattner
Date: 2007-04-28 21:24:20 -0700 (Sat, 28 Apr 2007)

Log Message:
---
Add alias support to llvm-gcc

Patch by Anton K!

Modified Paths:
--
apple-local/branches/llvm/gcc/llvm-backend.cpp
apple-local/branches/llvm/gcc/llvm.h
apple-local/branches/llvm/gcc/varasm.c

Modified: apple-local/branches/llvm/gcc/llvm-backend.cpp
===
--- apple-local/branches/llvm/gcc/llvm-backend.cpp  2007-04-28 17:04:47 UTC 
(rev 126684)
+++ apple-local/branches/llvm/gcc/llvm-backend.cpp  2007-04-29 04:24:20 UTC 
(rev 126685)
@@ -28,6 +28,7 @@
 #include llvm/Module.h
 #include llvm/ModuleProvider.h
 #include llvm/PassManager.h
+#include llvm/ValueSymbolTable.h
 #include llvm/Analysis/LoopPass.h
 #include llvm/Analysis/Verifier.h
 #include llvm/Assembly/Writer.h
@@ -57,6 +58,7 @@
 #include coretypes.h
 #include flags.h
 #include tree.h
+#include c-tree.h // For aliases
 #include diagnostic.h
 #include output.h
 #include toplev.h
@@ -532,6 +534,86 @@
   timevar_pop(TV_LLVM_FUNCS);
 }
 
+// emit_alias_to_llvm - Given decl and target emit alias to target. gcc is
+// little bit insane, it can ask us for alias emission in many places. Such
+// places are divided into two stages: it's allowed to have unresolved target 
at
+// stage 0 (hence result code -1), but not on stage 1 (error). Zero is returned
+// if alias was emitted.
+int emit_alias_to_llvm(tree decl, tree target, unsigned stage) {
+  if (errorcount || sorrycount) return -2;
+
+  timevar_push(TV_LLVM_GLOBALS);
+
+  // Get or create LLVM global for our alias.
+  GlobalValue *V = castGlobalValue(DECL_LLVM(decl));
+  
+  // Try to grab decl from IDENTIFIER_NODE
+  GlobalValue *Aliasee = 0;
+  if (tree c_decl = lookup_name(target))
+Aliasee = castGlobalValue(DECL_LLVM(c_decl));
+
+  // Query SymTab for aliasee
+  const char* AliaseeName = IDENTIFIER_POINTER(target);
+  if (!Aliasee) {
+Aliasee =
+  dyn_cast_or_nullGlobalValue(TheModule-
+getValueSymbolTable().lookup(AliaseeName));
+  }
+
+  // Last resort. Query for name set via __asm__
+  if (!Aliasee) {
+std::string starred = std::string(\001) + AliaseeName;
+Aliasee =
+  dyn_cast_or_nullGlobalValue(TheModule-
+getValueSymbolTable().lookup(starred));
+  }
+  
+  if (!Aliasee) {
+if (stage)
+  error (%J%qD aliased to undefined symbol %qE,
+ decl, decl, target);
+timevar_pop(TV_LLVM_GLOBALS);
+return -1;
+  }  
+
+  GlobalValue::LinkageTypes Linkage;
+  GlobalValue::VisibilityTypes Visibility;
+
+  // Check for external weak linkage
+  if (DECL_EXTERNAL(decl)  DECL_WEAK(decl))
+Linkage = GlobalValue::WeakLinkage;
+  else if (!TREE_PUBLIC(decl))
+Linkage = GlobalValue::InternalLinkage;
+  else
+Linkage = GlobalValue::ExternalLinkage;
+
+  GlobalAlias* GA = new GlobalAlias(Aliasee-getType(), Linkage, ,
+Aliasee, TheModule);
+  // Handle visibility style
+  if (TREE_PUBLIC(decl)  DECL_VISIBILITY(decl) == VISIBILITY_HIDDEN)
+GA-setVisibility(GlobalValue::HiddenVisibility);
+
+  if (V-getType() == GA-getType())
+V-replaceAllUsesWith(GA);
+  else if (!V-use_empty())
+error (%J% Alias %qD used with invalid type!, decl, decl);
+
+  changeLLVMValue(V, GA);
+  GA-takeName(V);
+  if (GlobalVariable *GV = dyn_castGlobalVariable(V))
+GV-eraseFromParent();
+  else if (GlobalAlias *GA = dyn_castGlobalAlias(V))
+GA-eraseFromParent();
+  else if (Function *F = dyn_castFunction(V))
+F-eraseFromParent();
+  else
+assert(0  Unsuported global value);
+  
+  timevar_pop(TV_LLVM_GLOBALS);
+  return 0;
+}
+
+  
 /// emit_global_to_llvm - Emit the specified VAR_DECL or aggregate CONST_DECL 
to
 /// LLVM as a global variable.  This function implements the end of
 /// assemble_variable.
@@ -845,12 +927,12 @@
   
   // Update the decl that points to F.
   changeLLVMValue(F, FInNewType);
+
+  // Now we can give GV the proper name.
+  GV-takeName(F);
   
   // F is now dead, nuke it.
   F-eraseFromParent();
-  
-  // Now we can give GV the proper name.
-  GV-setName(Name);
 }
 
   } else {

Modified: apple-local/branches/llvm/gcc/llvm.h
===
--- apple-local/branches/llvm/gcc/llvm.h2007-04-28 17:04:47 UTC (rev 
126684)
+++ apple-local/branches/llvm/gcc/llvm.h2007-04-29 04:24:20 UTC (rev 
126685)
@@ -49,6 +49,10 @@
  */
 void emit_global_to_llvm(union tree_node*);
 
+/* emit_global_to_llvm - Emit the specified alias to LLVM
+ */
+int emit_alias_to_llvm(union tree_node*, union tree_node*, unsigned);
+
 /* llvm_get_decl_name - Used by varasm.c, returns the specified declaration's
  * name.
  */

Modified: 

[llvm-commits] [126686] two minor fixes

2007-04-28 Thread clattner
Revision: 126686
Author:   clattner
Date: 2007-04-28 21:26:55 -0700 (Sat, 28 Apr 2007)

Log Message:
---
two minor fixes

Modified Paths:
--
apple-local/branches/llvm/gcc/llvm-backend.cpp

Modified: apple-local/branches/llvm/gcc/llvm-backend.cpp
===
--- apple-local/branches/llvm/gcc/llvm-backend.cpp  2007-04-29 04:24:20 UTC 
(rev 126685)
+++ apple-local/branches/llvm/gcc/llvm-backend.cpp  2007-04-29 04:26:55 UTC 
(rev 126686)
@@ -595,8 +595,11 @@
 
   if (V-getType() == GA-getType())
 V-replaceAllUsesWith(GA);
-  else if (!V-use_empty())
-error (%J% Alias %qD used with invalid type!, decl, decl);
+  else if (!V-use_empty()) {
+error (%J Alias %qD used with invalid type!, decl, decl);
+timevar_pop(TV_LLVM_GLOBALS);
+return -1;
+  }
 
   changeLLVMValue(V, GA);
   GA-takeName(V);


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


[llvm-commits] CVS: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp

2007-04-28 Thread Chris Lattner


Changes in directory llvm/lib/Bitcode/Writer:

BitcodeWriter.cpp updated: 1.13 - 1.14
---
Log message:

moved Writer.cpp - BitcodeWriter.cpp to make it more unique in the tree.


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

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


Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
diff -u llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.13 
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.14
--- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.13  Thu Apr 26 00:53:54 2007
+++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp   Sun Apr 29 00:31:57 2007
@@ -1,4 +1,4 @@
-//===--- Bitcode/Writer/Writer.cpp - Bitcode Writer 
---===//
+//===--- Bitcode/Writer/BitcodeWriter.cpp - Bitcode Writer 
===//
 //
 // The LLVM Compiler Infrastructure
 //



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


[llvm-commits] CVS: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp

2007-04-28 Thread Chris Lattner


Changes in directory llvm/lib/Bitcode/Writer:

BitcodeWriter.cpp updated: 1.14 - 1.15
---
Log message:

Fix this to use the right block ID


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

 BitcodeWriter.cpp |4 +---
 1 files changed, 1 insertion(+), 3 deletions(-)


Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
diff -u llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.14 
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.15
--- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp:1.14  Sun Apr 29 00:31:57 2007
+++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp   Sun Apr 29 00:49:09 2007
@@ -485,8 +485,6 @@
  BitstreamWriter Stream,
  SmallVectorunsigned, 64 Vals) {
   return; // FIXME: REMOVE
-  
-  
   unsigned Code = 0;
   unsigned AbbrevToUse = 0;
   switch (I.getOpcode()) {
@@ -524,7 +522,7 @@
 /// WriteFunction - Emit a function body to the module stream.
 static void WriteFunction(const Function F, ValueEnumerator VE, 
   BitstreamWriter Stream) {
-  Stream.EnterSubblock(bitc::TYPE_SYMTAB_BLOCK_ID, 3);
+  Stream.EnterSubblock(bitc::FUNCTION_BLOCK_ID, 3);
   VE.incorporateFunction(F);
 
   SmallVectorunsigned, 64 Vals;



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


[llvm-commits] CVS: llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp

2007-04-28 Thread Chris Lattner


Changes in directory llvm/tools/llvm-bcanalyzer:

llvm-bcanalyzer.cpp updated: 1.10 - 1.11
---
Log message:

fit in 80 cols


---
Diffs of the changes:  (+5 -6)

 llvm-bcanalyzer.cpp |   11 +--
 1 files changed, 5 insertions(+), 6 deletions(-)


Index: llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
diff -u llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp:1.10 
llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp:1.11
--- llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp:1.10 Wed Feb  7 15:41:02 2007
+++ llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp  Sun Apr 29 00:51:00 2007
@@ -27,6 +27,7 @@
 // The tool is also able to print a bytecode file in a straight forward text
 // format that shows the containment and relationships of the information in
 // the bytecode file (-dump option).
+//
 
//===--===//
 
 #include llvm/Analysis/Verifier.h
@@ -46,9 +47,9 @@
 static cl::optstd::string
   OutputFilename(-o, cl::init(-), cl::desc(output file));
 
-static cl::optbool NoDetails (nodetails, cl::desc(Skip detailed output));
-static cl::optbool Dump  (dump, cl::desc(Dump low level bytecode 
trace));
-static cl::optbool Verify(verify, cl::desc(Progressively verify 
module));
+static cl::optbool NoDetails(nodetails, cl::desc(Skip detailed output));
+static cl::optbool Dump(dump, cl::desc(Dump low level bytecode trace));
+static cl::optbool Verify(verify, cl::desc(Progressively verify module));
 
 int main(int argc, char **argv) {
   llvm_shutdown_obj X;  // Call llvm_shutdown() on exit.
@@ -58,7 +59,7 @@
 
 sys::PrintStackTraceOnErrorSignal();
 
-std::ostream* Out = std::cout;  // Default to printing to stdout...
+std::ostream *Out = std::cout;  // Default to printing to stdout...
 std::string ErrorMessage;
 BytecodeAnalysis bca;
 
@@ -92,5 +93,3 @@
   }
   return 1;
 }
-
-// vim: sw=2



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