[llvm-commits] [llvm] r131622 - in /llvm/trunk/include/llvm: MC/MCWin64EH.h Support/Win64EH.h

Charles Davis cdavis at mines.edu
Wed May 18 19:47:23 PDT 2011


Author: cdavis
Date: Wed May 18 21:47:23 2011
New Revision: 131622

URL: http://llvm.org/viewvc/llvm-project?rev=131622&view=rev
Log:
Fix build issues with headers, which I discovered by actually using them.

Also, convert all the inline functions on UnwindInfo into methods.

Modified:
    llvm/trunk/include/llvm/MC/MCWin64EH.h
    llvm/trunk/include/llvm/Support/Win64EH.h

Modified: llvm/trunk/include/llvm/MC/MCWin64EH.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCWin64EH.h?rev=131622&r1=131621&r2=131622&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCWin64EH.h (original)
+++ llvm/trunk/include/llvm/MC/MCWin64EH.h Wed May 18 21:47:23 2011
@@ -33,12 +33,12 @@
     MachineLocation Source;
   public:
     MCWin64EHInstruction(OpType Op, unsigned Register)
-      : Operation(Op), Offset(0), Destination(0), Source(S) {
+      : Operation(Op), Offset(0), Destination(0), Source(Register) {
       assert(Op == Win64EH::UOP_PushNonVol);
     }
     MCWin64EHInstruction(unsigned Size)
       : Operation(Size>128 ? Win64EH::UOP_AllocLarge : Win64EH::UOP_AllocSmall),
-        Offset(size) { }
+        Offset(Size) { }
     MCWin64EHInstruction(unsigned Register, unsigned Off)
       : Operation(Win64EH::UOP_SetFPReg), Offset(Off), Destination(Register) { }
     MCWin64EHInstruction(OpType Op, const MachineLocation &D,
@@ -64,7 +64,7 @@
   struct MCWin64EHUnwindInfo {
     MCWin64EHUnwindInfo() : Begin(0), End(0), ExceptionHandler(0), Lsda(0),
                             Function(0), UnwindOnly(false), LsdaSize(0),
-                            PrologSize(0), LastFrameInst(-1), Chained(false)
+                            PrologSize(0), LastFrameInst(-1), Chained(false),
                             Instructions() {}
     MCSymbol *Begin;
     MCSymbol *End;

Modified: llvm/trunk/include/llvm/Support/Win64EH.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Win64EH.h?rev=131622&r1=131621&r2=131622&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Win64EH.h (original)
+++ llvm/trunk/include/llvm/Support/Win64EH.h Wed May 18 21:47:23 2011
@@ -40,7 +40,7 @@
     uint8_t codeOffset;
     uint8_t unwindOp:4,
             opInfo:4;
-  };
+  } u;
   uint16_t frameOffset;
 };
 
@@ -56,6 +56,13 @@
   UNW_ChainInfo = 0x04
 };
 
+/// RuntimeFunction - An entry in the table of functions with unwind info.
+struct RuntimeFunction {
+  uint64_t startAddress;
+  uint64_t endAddress;
+  uint64_t unwindInfoOffset;
+};
+
 /// UnwindInfo - An entry in the exception table.
 struct UnwindInfo {
   uint8_t version:3,
@@ -65,30 +72,25 @@
   uint8_t frameRegister:4,
           frameOffset:4;
   UnwindCode unwindCodes[1];
+
+  void *getLanguageSpecificData() {
+    return reinterpret_cast<void *>(&unwindCodes[(numCodes+1) & ~1]);
+  }
+  uint64_t getLanguageSpecificHandlerOffset() {
+    return *reinterpret_cast<uint64_t *>(getLanguageSpecificData());
+  }
+  void setLanguageSpecificHandlerOffset(uint64_t offset) {
+    *reinterpret_cast<uint64_t *>(getLanguageSpecificData()) = offset;
+  }
+  RuntimeFunction *getChainedFunctionEntry() {
+    return reinterpret_cast<RuntimeFunction *>(getLanguageSpecificData());
+  }
+  void *getExceptionData() {
+    return reinterpret_cast<void *>(reinterpret_cast<uint64_t *>(
+                                                  getLanguageSpecificData())+1);
+  }
 };
 
-inline UnwindCode &getUnwindCodeEntry(UnwindInfo &info, uint32_t index) {
-  return info.unwindCodes[index];
-}
-inline void *getLanguageSpecificData(UnwindInfo &info) {
-  return reinterpret_cast<void *>(&getUnwindCodeEntry(info,info.numCodes+1)&~1);
-}
-inline uint64_t getLanguageSpecificHandlerOffset(UnwindInfo &info) {
-  return *reinterpret_cast<uint64_t *>(getLangaugeSpecificData(info));
-}
-inline void setLanguageSpecificHandlerOffset(UnwindInfo &info, uint64_t offset){
-  *reinterpret_cast<uint64_t *>(getLanguageSpecificData(info)) = offset;
-}
-inline uint64_t getChainedFunctionEntryOffset(UnwindInfo &info) {
-  return *reinterpret_cast<uint64_t *>(getLanguageSpecificData(info));
-}
-inline void setChainedFunctionEntryOffset(UnwindInfo &info, uint64_t offset) {
-  *reinterpret_cast<uint64_t *>(getLanguageSpecificData(info)) = offset;
-}
-inline void *getExceptionData(UnwindInfo &info) {
-  return reinterpret_cast<void *>(reinterpret_cast<uint64_t *>(
-                                              getLanguageSpecificData(info))+1);
-}
 
 } // End of namespace Win64EH
 } // End of namespace llvm





More information about the llvm-commits mailing list