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

2007-04-21 Thread Jeff Cohen


Changes in directory llvm/include/llvm/CodeGen:

MachineRelocation.h updated: 1.12 - 1.13
---
Log message:

Make enum-valued bitfield large enough to avoid interpretation as negative 
values in VC++.

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

 MachineRelocation.h |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/include/llvm/CodeGen/MachineRelocation.h
diff -u llvm/include/llvm/CodeGen/MachineRelocation.h:1.12 
llvm/include/llvm/CodeGen/MachineRelocation.h:1.13
--- llvm/include/llvm/CodeGen/MachineRelocation.h:1.12  Sun Dec 10 20:19:29 2006
+++ llvm/include/llvm/CodeGen/MachineRelocation.h   Sat Apr 21 11:29:37 2007
@@ -63,7 +63,7 @@
   } Target;
 
   unsigned TargetReloType : 6; // The target relocation ID.
-  AddressType AddrType: 3; // The field of Target to use.
+  AddressType AddrType: 4; // The field of Target to use.
   bool DoesntNeedFnStub   : 1; // True if we don't need a fn stub.
   bool GOTRelative: 1; // Should this relocation be relative to the 
GOT?
 



___
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/CodeGen/MachineRelocation.h

2007-04-21 Thread Reid Spencer
Jeff,


On Sat, 2007-04-21 at 11:29 -0500, Jeff Cohen wrote:
 
 Changes in directory llvm/include/llvm/CodeGen:
 
 MachineRelocation.h updated: 1.12 - 1.13
 ---
 Log message:
 
 Make enum-valued bitfield large enough to avoid interpretation as negative 
 values in VC++.
 
 ---
 Diffs of the changes:  (+1 -1)
 
  MachineRelocation.h |2 +-
  1 files changed, 1 insertion(+), 1 deletion(-)
 
 
 Index: llvm/include/llvm/CodeGen/MachineRelocation.h
 diff -u llvm/include/llvm/CodeGen/MachineRelocation.h:1.12 
 llvm/include/llvm/CodeGen/MachineRelocation.h:1.13
 --- llvm/include/llvm/CodeGen/MachineRelocation.h:1.12Sun Dec 10 
 20:19:29 2006
 +++ llvm/include/llvm/CodeGen/MachineRelocation.h Sat Apr 21 11:29:37 2007
 @@ -63,7 +63,7 @@
} Target;
  
unsigned TargetReloType : 6; // The target relocation ID.
 -  AddressType AddrType: 3; // The field of Target to use.
 +  AddressType AddrType: 4; // The field of Target to use.

Can't we just make AddressType unsigned ?  Surely VC++ won't treat
something explicitly declared as unsigned as a signed quantity. Then we
shouldn't need the extra bit, right?

Reid.

bool DoesntNeedFnStub   : 1; // True if we don't need a fn stub.
bool GOTRelative: 1; // Should this relocation be relative to the 
 GOT?
  
 
 
 
 ___
 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/CodeGen/MachineRelocation.h

2007-04-21 Thread Jeff Cohen

Reid Spencer wrote:

Jeff,


On Sat, 2007-04-21 at 11:29 -0500, Jeff Cohen wrote:
  

Changes in directory llvm/include/llvm/CodeGen:

MachineRelocation.h updated: 1.12 - 1.13
---
Log message:

Make enum-valued bitfield large enough to avoid interpretation as negative 
values in VC++.

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

 MachineRelocation.h |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/include/llvm/CodeGen/MachineRelocation.h
diff -u llvm/include/llvm/CodeGen/MachineRelocation.h:1.12 
llvm/include/llvm/CodeGen/MachineRelocation.h:1.13
--- llvm/include/llvm/CodeGen/MachineRelocation.h:1.12  Sun Dec 10 20:19:29 2006
+++ llvm/include/llvm/CodeGen/MachineRelocation.h   Sat Apr 21 11:29:37 2007
@@ -63,7 +63,7 @@
   } Target;
 
   unsigned TargetReloType : 6; // The target relocation ID.

-  AddressType AddrType: 3; // The field of Target to use.
+  AddressType AddrType: 4; // The field of Target to use.



Can't we just make AddressType unsigned ?  Surely VC++ won't treat
something explicitly declared as unsigned as a signed quantity. Then we
shouldn't need the extra bit, right?

Reid.


Not without inserting a whole bunch of casts elsewhere.  Unsigneds 
cannot be assigned to enums.
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


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

2006-07-27 Thread Evan Cheng


Changes in directory llvm/include/llvm/CodeGen:

MachineRelocation.h updated: 1.10 - 1.11
---
Log message:

Add basic block machine relocation.

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

 MachineRelocation.h |   40 +++-
 1 files changed, 35 insertions(+), 5 deletions(-)


Index: llvm/include/llvm/CodeGen/MachineRelocation.h
diff -u llvm/include/llvm/CodeGen/MachineRelocation.h:1.10 
llvm/include/llvm/CodeGen/MachineRelocation.h:1.11
--- llvm/include/llvm/CodeGen/MachineRelocation.h:1.10  Thu Jun 22 20:02:37 2006
+++ llvm/include/llvm/CodeGen/MachineRelocation.h   Thu Jul 27 13:18:13 2006
@@ -19,6 +19,7 @@
 
 namespace llvm {
 class GlobalValue;
+class MachineBasicBlock;
 
 /// MachineRelocation - This represents a target-specific relocation value,
 /// produced by the code emitter.  This relocation is resolved after the has
@@ -38,6 +39,7 @@
   enum AddressType {
 isResult, // Relocation has be transformed into its result pointer.
 isGV, // The Target.GV field is valid.
+isBB, // Relocation of BB address.
 isExtSym, // The Target.ExtSym field is valid.
 isConstPool,  // Relocation of constant pool address.
 isJumpTable,  // Relocation of jump table address.
@@ -52,11 +54,12 @@
   intptr_t ConstantVal;
 
   union {
-void *Result;// If this has been resolved to a resolved pointer
-GlobalValue *GV; // If this is a pointer to an LLVM global
-const char *ExtSym;  // If this is a pointer to a named symbol
-unsigned Index;  // Constant pool / jump table index
-unsigned GOTIndex;   // Index in the GOT of this symbol/global
+void *Result;   // If this has been resolved to a resolved pointer
+GlobalValue *GV;// If this is a pointer to an LLVM global
+MachineBasicBlock *MBB; // If this is a pointer to a LLVM BB
+const char *ExtSym; // If this is a pointer to a named symbol
+unsigned Index; // Constant pool / jump table index
+unsigned GOTIndex;  // Index in the GOT of this symbol/global
   } Target;
 
   unsigned TargetReloType : 6; // The target relocation ID.
@@ -83,6 +86,22 @@
 return Result;
   }
 
+  /// MachineRelocation::getBB - Return a relocation entry for a BB.
+  ///
+  static MachineRelocation getBB(intptr_t offset,unsigned RelocationType,
+ MachineBasicBlock *MBB, intptr_t cst = 0) {
+assert((RelocationType  ~63) == 0  Relocation type too large!);
+MachineRelocation Result;
+Result.Offset = offset;
+Result.ConstantVal = cst;
+Result.TargetReloType = RelocationType;
+Result.AddrType = isBB;
+Result.DoesntNeedFnStub = false;
+Result.GOTRelative = false;
+Result.Target.MBB = MBB;
+return Result;
+  }
+
   /// MachineRelocation::getExtSym - Return a relocation entry for an external
   /// symbol, like free.
   ///
@@ -160,6 +179,12 @@
 return AddrType == isGV;
   }
 
+  /// isBasicBlock - Return true if this relocation is a basic block reference.
+  ///
+  bool isBasicBlock() const {
+return AddrType == isBB;
+  }
+
   /// isString - Return true if this is a constant string.
   ///
   bool isString() const {
@@ -200,6 +225,11 @@
 return Target.GV;
   }
 
+  MachineBasicBlock *getBasicBlock() const {
+assert(isBasicBlock()  This is not a basic block reference!);
+return Target.MBB;
+  }
+
   /// getString - If this is a string value, return the string reference.
   ///
   const char *getString() const {



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


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

2006-06-22 Thread Evan Cheng


Changes in directory llvm/include/llvm/CodeGen:

MachineRelocation.h updated: 1.9 - 1.10
---
Log message:

Added jump table address relocation.

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

 MachineRelocation.h |   39 +++
 1 files changed, 35 insertions(+), 4 deletions(-)


Index: llvm/include/llvm/CodeGen/MachineRelocation.h
diff -u llvm/include/llvm/CodeGen/MachineRelocation.h:1.9 
llvm/include/llvm/CodeGen/MachineRelocation.h:1.10
--- llvm/include/llvm/CodeGen/MachineRelocation.h:1.9   Wed May  3 15:30:20 2006
+++ llvm/include/llvm/CodeGen/MachineRelocation.h   Thu Jun 22 20:02:37 2006
@@ -39,7 +39,8 @@
 isResult, // Relocation has be transformed into its result pointer.
 isGV, // The Target.GV field is valid.
 isExtSym, // The Target.ExtSym field is valid.
-isConstPool,  // The Target.ConstPool field is valid.
+isConstPool,  // Relocation of constant pool address.
+isJumpTable,  // Relocation of jump table address.
 isGOTIndex// The Target.GOTIndex field is valid.
   };
   
@@ -54,7 +55,7 @@
 void *Result;// If this has been resolved to a resolved pointer
 GlobalValue *GV; // If this is a pointer to an LLVM global
 const char *ExtSym;  // If this is a pointer to a named symbol
-unsigned ConstPool;  // In this is a pointer to a constant pool entry
+unsigned Index;  // Constant pool / jump table index
 unsigned GOTIndex;   // Index in the GOT of this symbol/global
   } Target;
 
@@ -113,7 +114,24 @@
 Result.AddrType = isConstPool;
 Result.DoesntNeedFnStub = false;
 Result.GOTRelative = false;
-Result.Target.ConstPool = CPI;
+Result.Target.Index = CPI;
+return Result;
+  }
+
+  /// MachineRelocation::getJumpTable - Return a relocation entry for a jump
+  /// table entry.
+  ///
+  static MachineRelocation getJumpTable(intptr_t offset,unsigned 
RelocationType,
+unsigned JTI, intptr_t cst = 0) {
+assert((RelocationType  ~63) == 0  Relocation type too large!);
+MachineRelocation Result;
+Result.Offset = offset;
+Result.ConstantVal = cst;
+Result.TargetReloType = RelocationType;
+Result.AddrType = isJumpTable;
+Result.DoesntNeedFnStub = false;
+Result.GOTRelative = false;
+Result.Target.Index = JTI;
 return Result;
   }
 
@@ -154,6 +172,12 @@
 return AddrType == isConstPool;
   }
 
+  /// isJumpTableIndex - Return true if this is a jump table reference.
+  ///
+  bool isJumpTableIndex() const {
+return AddrType == isJumpTable;
+  }
+
   /// isGOTRelative - Return true the target wants the index into the GOT of
   /// the symbol rather than the address of the symbol.
   bool isGOTRelative() const {
@@ -187,7 +211,14 @@
   /// the index into the constant pool.
   unsigned getConstantPoolIndex() const {
 assert(isConstantPoolIndex()  This is not a constant pool reference!);
-return Target.ConstPool;
+return Target.Index;
+  }
+
+  /// getJumpTableIndex - If this is a jump table reference, return
+  /// the index into the jump table.
+  unsigned getJumpTableIndex() const {
+assert(isJumpTableIndex()  This is not a jump table reference!);
+return Target.Index;
   }
 
   /// getResultPointer - Once this has been resolved to point to an actual



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


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

2006-05-03 Thread Chris Lattner


Changes in directory llvm/include/llvm/CodeGen:

MachineRelocation.h updated: 1.8 - 1.9
---
Log message:

Change from using MachineRelocation ctors to using static methods
in MachineRelocation to create Relocations.


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

 MachineRelocation.h |   65 
 1 files changed, 46 insertions(+), 19 deletions(-)


Index: llvm/include/llvm/CodeGen/MachineRelocation.h
diff -u llvm/include/llvm/CodeGen/MachineRelocation.h:1.8 
llvm/include/llvm/CodeGen/MachineRelocation.h:1.9
--- llvm/include/llvm/CodeGen/MachineRelocation.h:1.8   Wed May  3 13:52:31 2006
+++ llvm/include/llvm/CodeGen/MachineRelocation.h   Wed May  3 15:30:20 2006
@@ -45,7 +45,7 @@
   
   /// Offset - This is the offset from the start of the code buffer of the
   /// relocation to perform.
-  unsigned Offset;
+  intptr_t Offset;
   
   /// ConstantVal - A field that may be used by the target relocation type.
   intptr_t ConstantVal;
@@ -64,35 +64,62 @@
   bool GOTRelative: 1; // Should this relocation be relative to the 
GOT?
 
 public:
-  MachineRelocation(unsigned offset, unsigned RelocationType, GlobalValue *GV,
-intptr_t cst = 0, bool DoesntNeedFunctionStub = 0,
-bool GOTrelative = 0)
-: Offset(offset), ConstantVal(cst), TargetReloType(RelocationType),
-  AddrType(isGV), DoesntNeedFnStub(DoesntNeedFunctionStub),
-  GOTRelative(GOTrelative){
+  /// MachineRelocation::getGV - Return a relocation entry for a GlobalValue.
+  ///
+  static MachineRelocation getGV(intptr_t offset, unsigned RelocationType, 
+ GlobalValue *GV, intptr_t cst = 0,
+ bool DoesntNeedFunctionStub = 0,
+ bool GOTrelative = 0) {
 assert((RelocationType  ~63) == 0  Relocation type too large!);
-Target.GV = GV;
+MachineRelocation Result;
+Result.Offset = offset;
+Result.ConstantVal = cst;
+Result.TargetReloType = RelocationType;
+Result.AddrType = isGV;
+Result.DoesntNeedFnStub = DoesntNeedFunctionStub;
+Result.GOTRelative = GOTrelative;
+Result.Target.GV = GV;
+return Result;
   }
 
-  MachineRelocation(unsigned offset, unsigned RelocationType, const char *ES,
-intptr_t cst = 0, bool GOTrelative = 0)
-: Offset(offset), ConstantVal(cst), TargetReloType(RelocationType),
-  AddrType(isExtSym), DoesntNeedFnStub(false), GOTRelative(GOTrelative) {
+  /// MachineRelocation::getExtSym - Return a relocation entry for an external
+  /// symbol, like free.
+  ///
+  static MachineRelocation getExtSym(intptr_t offset, unsigned RelocationType, 
+ const char *ES, intptr_t cst = 0,
+ bool GOTrelative = 0) {
 assert((RelocationType  ~63) == 0  Relocation type too large!);
-Target.ExtSym = ES;
+MachineRelocation Result;
+Result.Offset = offset;
+Result.ConstantVal = cst;
+Result.TargetReloType = RelocationType;
+Result.AddrType = isExtSym;
+Result.DoesntNeedFnStub = false;
+Result.GOTRelative = GOTrelative;
+Result.Target.ExtSym = ES;
+return Result;
   }
 
-  MachineRelocation(unsigned offset, unsigned RelocationType, unsigned CPI,
-intptr_t cst = 0)
-: Offset(offset), ConstantVal(cst), TargetReloType(RelocationType),
-  AddrType(isConstPool), DoesntNeedFnStub(false), GOTRelative(0) {
+  /// MachineRelocation::getConstPool - Return a relocation entry for a 
constant
+  /// pool entry.
+  ///
+  static MachineRelocation getConstPool(intptr_t offset,unsigned 
RelocationType,
+unsigned CPI, intptr_t cst = 0) {
 assert((RelocationType  ~63) == 0  Relocation type too large!);
-Target.ConstPool = CPI;
+MachineRelocation Result;
+Result.Offset = offset;
+Result.ConstantVal = cst;
+Result.TargetReloType = RelocationType;
+Result.AddrType = isConstPool;
+Result.DoesntNeedFnStub = false;
+Result.GOTRelative = false;
+Result.Target.ConstPool = CPI;
+return Result;
   }
 
   /// getMachineCodeOffset - Return the offset into the code buffer that the
   /// relocation should be performed.
-  unsigned getMachineCodeOffset() const {
+  intptr_t getMachineCodeOffset() const {
 return Offset;
   }
 



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