From 2bf62728b8ce00e295c7bf0fb328427496cc85aa Mon Sep 17 00:00:00 2001 From: Edward O'Callaghan Date: Wed, 5 Aug 2009 04:02:56 +0000 Subject: Fixup C++ style comments are not allowed in ISO C90 to classic C style. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@78152 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/ashrti3.c | 35 +++++++++-------- lib/clear_cache.c | 40 ++++++++++--------- lib/clzdi2.c | 29 +++++++------- lib/clzsi2.c | 76 ++++++++++++++++++----------------- lib/clzti2.c | 29 +++++++------- lib/divti3.c | 39 +++++++++--------- lib/enable_execute_stack.c | 36 +++++++++-------- lib/eprintf.c | 33 ++++++++-------- lib/ffsdi2.c | 30 +++++++------- lib/ffsti2.c | 30 +++++++------- lib/fixunsdfdi.c | 41 ++++++++++--------- lib/fixunsdfsi.c | 41 ++++++++++--------- lib/fixunsdfti.c | 41 ++++++++++--------- lib/fixunssfdi.c | 41 ++++++++++--------- lib/fixunssfsi.c | 41 ++++++++++--------- lib/fixunssfti.c | 41 ++++++++++--------- lib/fixunsxfdi.c | 44 +++++++++++---------- lib/fixunsxfti.c | 44 +++++++++++---------- lib/fixxfdi.c | 39 +++++++++--------- lib/fixxfti.c | 39 +++++++++--------- lib/floattixf.c | 72 ++++++++++++++++++---------------- lib/floatuntixf.c | 74 +++++++++++++++++----------------- lib/gcc_personality_v0.c | 98 ++++++++++++++++++++++++---------------------- lib/lshrdi3.c | 33 ++++++++-------- lib/lshrti3.c | 33 ++++++++-------- lib/negdi2.c | 32 ++++++++------- lib/negti2.c | 32 ++++++++------- lib/negvdi2.c | 29 +++++++------- lib/negvsi2.c | 29 +++++++------- lib/subvdi3.c | 29 +++++++------- lib/subvsi3.c | 29 +++++++------- lib/subvti3.c | 29 +++++++------- lib/trampoline_setup.c | 58 ++++++++++++++------------- 33 files changed, 720 insertions(+), 646 deletions(-) diff --git a/lib/ashrti3.c b/lib/ashrti3.c index bfdd2eb99..55645f78d 100644 --- a/lib/ashrti3.c +++ b/lib/ashrti3.c @@ -1,23 +1,24 @@ -//===-- ashrti3.c - Implement __ashrti3 -----------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements __ashrti3 for the compiler_rt library. -// -//===----------------------------------------------------------------------===// +/* ===-- ashrti3.c - Implement __ashrti3 -----------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __ashrti3 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ #if __x86_64 #include "int_lib.h" -// Returns: arithmetic a >> b +/* Returns: arithmetic a >> b */ -// Precondition: 0 <= b < bits_in_tword +/* Precondition: 0 <= b < bits_in_tword */ ti_int __ashrti3(ti_int a, si_int b) @@ -26,13 +27,13 @@ __ashrti3(ti_int a, si_int b) twords input; twords result; input.all = a; - if (b & bits_in_dword) // bits_in_dword <= b < bits_in_tword + if (b & bits_in_dword) /* bits_in_dword <= b < bits_in_tword */ { - // result.high = input.high < 0 ? -1 : 0 + /* result.high = input.high < 0 ? -1 : 0 */ result.high = input.high >> (bits_in_dword - 1); result.low = input.high >> (b - bits_in_dword); } - else // 0 <= b < bits_in_dword + else /* 0 <= b < bits_in_dword */ { if (b == 0) return a; diff --git a/lib/clear_cache.c b/lib/clear_cache.c index 8176c24e6..1456823df 100644 --- a/lib/clear_cache.c +++ b/lib/clear_cache.c @@ -1,11 +1,12 @@ -//===-- clear_cache.c - Implement __clear_cache ---------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// +/* ===-- clear_cache.c - Implement __clear_cache ---------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + */ #include @@ -13,22 +14,23 @@ #include #endif -// -// The compiler generates calls to __clear_cache() when creating -// trampoline functions on the stack for use with nested functions. -// It is expected to invalidate the instruction cache for the -// specified range. -// +/* + * The compiler generates calls to __clear_cache() when creating + * trampoline functions on the stack for use with nested functions. + * It is expected to invalidate the instruction cache for the + * specified range. + */ + void __clear_cache(void* start, void* end) { #if __i386__ || __x86_64__ -// -// Intel processors have a unified instruction and data cache -// so there is nothing to do -// +/* + * Intel processors have a unified instruction and data cache + * so there is nothing to do + */ #else #if __APPLE__ - // On Darwin, sys_icache_invalidate() provides this functionality + /* On Darwin, sys_icache_invalidate() provides this functionality */ sys_icache_invalidate(start, end-start); #else abort(); diff --git a/lib/clzdi2.c b/lib/clzdi2.c index 7e58a5aa7..34d43625a 100644 --- a/lib/clzdi2.c +++ b/lib/clzdi2.c @@ -1,21 +1,22 @@ -//===-- clzdi2.c - Implement __clzdi2 -------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements __clzdi2 for the compiler_rt library. -// -//===----------------------------------------------------------------------===// +/* ===-- clzdi2.c - Implement __clzdi2 -------------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __clzdi2 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ #include "int_lib.h" -// Returns: the number of leading 0-bits +/* Returns: the number of leading 0-bits */ -// Precondition: a != 0 +/* Precondition: a != 0 */ si_int __clzdi2(di_int a) diff --git a/lib/clzsi2.c b/lib/clzsi2.c index 52062ab22..7e14af293 100644 --- a/lib/clzsi2.c +++ b/lib/clzsi2.c @@ -1,51 +1,53 @@ -//===-- clzsi2.c - Implement __clzsi2 -------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements __clzsi2 for the compiler_rt library. -// -//===----------------------------------------------------------------------===// +/* ===-- clzsi2.c - Implement __clzsi2 -------------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __clzsi2 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ #include "int_lib.h" -// Returns: the number of leading 0-bits +/* Returns: the number of leading 0-bits */ -// Precondition: a != 0 +/* Precondition: a != 0 */ si_int __clzsi2(si_int a) { su_int x = (su_int)a; - si_int t = ((x & 0xFFFF0000) == 0) << 4; // if (x is small) t = 16 else 0 - x >>= 16 - t; // x = [0 - 0xFFFF] - su_int r = t; // r = [0, 16] - // return r + clz(x) + si_int t = ((x & 0xFFFF0000) == 0) << 4; /* if (x is small) t = 16 else 0 */ + x >>= 16 - t; /* x = [0 - 0xFFFF] */ + su_int r = t; /* r = [0, 16] */ + /* return r + clz(x) */ t = ((x & 0xFF00) == 0) << 3; - x >>= 8 - t; // x = [0 - 0xFF] - r += t; // r = [0, 8, 16, 24] - // return r + clz(x) + x >>= 8 - t; /* x = [0 - 0xFF] */ + r += t; /* r = [0, 8, 16, 24] */ + /* return r + clz(x) */ t = ((x & 0xF0) == 0) << 2; - x >>= 4 - t; // x = [0 - 0xF] - r += t; // r = [0, 4, 8, 12, 16, 20, 24, 28] - // return r + clz(x) + x >>= 4 - t; /* x = [0 - 0xF] */ + r += t; /* r = [0, 4, 8, 12, 16, 20, 24, 28] */ + /* return r + clz(x) */ t = ((x & 0xC) == 0) << 1; - x >>= 2 - t; // x = [0 - 3] - r += t; // r = [0 - 30] and is even - // return r + clz(x) -// switch (x) -// { -// case 0: -// return r + 2; -// case 1: -// return r + 1; -// case 2: -// case 3: -// return r; -// } + x >>= 2 - t; /* x = [0 - 3] */ + r += t; /* r = [0 - 30] and is even */ + /* return r + clz(x) */ +/* switch (x) + * { + * case 0: + * return r + 2; + * case 1: + * return r + 1; + * case 2: + * case 3: + * return r; + * } + */ return r + ((2 - x) & -((x & 2) == 0)); } diff --git a/lib/clzti2.c b/lib/clzti2.c index b53106977..acdf479c4 100644 --- a/lib/clzti2.c +++ b/lib/clzti2.c @@ -1,23 +1,24 @@ -//===-- clzti2.c - Implement __clzti2 -------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements __clzti2 for the compiler_rt library. -// -//===----------------------------------------------------------------------===// +/* ===-- clzti2.c - Implement __clzti2 -------------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __clzti2 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ #if __x86_64 #include "int_lib.h" -// Returns: the number of leading 0-bits +/* Returns: the number of leading 0-bits */ -// Precondition: a != 0 +/* Precondition: a != 0 */ si_int __clzti2(ti_int a) diff --git a/lib/divti3.c b/lib/divti3.c index b8eda254c..c752f6cfb 100644 --- a/lib/divti3.c +++ b/lib/divti3.c @@ -1,15 +1,16 @@ -//===-- divti3.c - Implement __divti3 -------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements __divti3 for the compiler_rt library. -// -//===----------------------------------------------------------------------===// +/* ===-- divti3.c - Implement __divti3 -------------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __divti3 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ #if __x86_64 @@ -17,18 +18,18 @@ tu_int __udivmodti4(tu_int a, tu_int b, tu_int* rem); -// Returns: a / b +/* Returns: a / b */ ti_int __divti3(ti_int a, ti_int b) { const int bits_in_tword_m1 = (int)(sizeof(ti_int) * CHAR_BIT) - 1; - ti_int s_a = a >> bits_in_tword_m1; // s_a = a < 0 ? -1 : 0 - ti_int s_b = b >> bits_in_tword_m1; // s_b = b < 0 ? -1 : 0 - a = (a ^ s_a) - s_a; // negate if s_a == -1 - b = (b ^ s_b) - s_b; // negate if s_b == -1 - s_a ^= s_b; // sign of quotient - return (__udivmodti4(a, b, (tu_int*)0) ^ s_a) - s_a; // negate if s_a == -1 + ti_int s_a = a >> bits_in_tword_m1; /* s_a = a < 0 ? -1 : 0 */ + ti_int s_b = b >> bits_in_tword_m1; /* s_b = b < 0 ? -1 : 0 */ + a = (a ^ s_a) - s_a; /* negate if s_a == -1 */ + b = (b ^ s_b) - s_b; /* negate if s_b == -1 */ + s_a ^= s_b; /* sign of quotient */ + return (__udivmodti4(a, b, (tu_int*)0) ^ s_a) - s_a; /* negate if s_a == -1 */ } #endif diff --git a/lib/enable_execute_stack.c b/lib/enable_execute_stack.c index 15ab03fd7..c2ebc30f8 100644 --- a/lib/enable_execute_stack.c +++ b/lib/enable_execute_stack.c @@ -1,11 +1,12 @@ -//===-- enable_execute_stack.c - Implement __enable_execute_stack ---------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// +/* ===-- enable_execute_stack.c - Implement __enable_execute_stack ---------=== + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + */ #include #include @@ -14,20 +15,21 @@ #endif -// -// The compiler generates calls to __enable_execute_stack() when creating -// trampoline functions on the stack for use with nested functions. -// It is expected to mark the page(s) containing the address -// and the next 48 bytes as executable. Since the stack is normally rw- -// that means changing the protection on those page(s) to rwx. -// +/* + * The compiler generates calls to __enable_execute_stack() when creating + * trampoline functions on the stack for use with nested functions. + * It is expected to mark the page(s) containing the address + * and the next 48 bytes as executable. Since the stack is normally rw- + * that means changing the protection on those page(s) to rwx. + */ + void __enable_execute_stack(void* addr) { #if __APPLE__ - // On Darwin, pagesize is always 4096 bytes + /* On Darwin, pagesize is always 4096 bytes */ const uintptr_t pageSize = 4096; #else - // FIXME: We should have a configure check for this. + /* FIXME: We should have a configure check for this. */ const uintptr_t pageSize = getpagesize(); #endif const uintptr_t pageAlignMask = ~(pageSize-1); diff --git a/lib/eprintf.c b/lib/eprintf.c index 56d6c18fb..8d9ce327a 100644 --- a/lib/eprintf.c +++ b/lib/eprintf.c @@ -1,11 +1,12 @@ -//===---------- eprintf.c - Implements __eprintf --------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// +/* ===---------- eprintf.c - Implements __eprintf --------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + */ @@ -13,14 +14,14 @@ #include -// -// __eprintf() was used in an old version of . -// It can eventually go away, but it is needed when linking -// .o files built with the old . -// -// It should never be exported from a dylib, so it is marked -// visibility hidden. -// +/* + * __eprintf() was used in an old version of . + * It can eventually go away, but it is needed when linking + * .o files built with the old . + * + * It should never be exported from a dylib, so it is marked + * visibility hidden. + */ __attribute__((visibility("hidden"))) void __eprintf(const char* format, const char* assertion_expression, const char* line, const char* file) diff --git a/lib/ffsdi2.c b/lib/ffsdi2.c index 93afc6ce3..680fdb3ce 100644 --- a/lib/ffsdi2.c +++ b/lib/ffsdi2.c @@ -1,20 +1,22 @@ -//===-- ffsdi2.c - Implement __ffsdi2 -------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements __ffsdi2 for the compiler_rt library. -// -//===----------------------------------------------------------------------===// +/* ===-- ffsdi2.c - Implement __ffsdi2 -------------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __ffsdi2 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ #include "int_lib.h" -// Returns: the index of the least significant 1-bit in a, or -// the value zero if a is zero. The least significant bit is index one. +/* Returns: the index of the least significant 1-bit in a, or + * the value zero if a is zero. The least significant bit is index one. + */ si_int __ffsdi2(di_int a) diff --git a/lib/ffsti2.c b/lib/ffsti2.c index 194c2cbb4..2ee1a8bd2 100644 --- a/lib/ffsti2.c +++ b/lib/ffsti2.c @@ -1,22 +1,24 @@ -//===-- ffsti2.c - Implement __ffsti2 -------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements __ffsti2 for the compiler_rt library. -// -//===----------------------------------------------------------------------===// +/* ===-- ffsti2.c - Implement __ffsti2 -------------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __ffsti2 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ #if __x86_64 #include "int_lib.h" -// Returns: the index of the least significant 1-bit in a, or -// the value zero if a is zero. The least significant bit is index one. +/* Returns: the index of the least significant 1-bit in a, or + * the value zero if a is zero. The least significant bit is index one. + */ si_int __ffsti2(ti_int a) diff --git a/lib/fixunsdfdi.c b/lib/fixunsdfdi.c index f7e1041ad..4d5dcfebc 100644 --- a/lib/fixunsdfdi.c +++ b/lib/fixunsdfdi.c @@ -1,27 +1,30 @@ -//===-- fixunsdfdi.c - Implement __fixunsdfdi -----------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements __fixunsdfdi for the compiler_rt library. -// -//===----------------------------------------------------------------------===// +/* ===-- fixunsdfdi.c - Implement __fixunsdfdi -----------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __fixunsdfdi for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ #include "int_lib.h" -// Returns: convert a to a unsigned long long, rounding toward zero. -// Negative values all become zero. +/* Returns: convert a to a unsigned long long, rounding toward zero. + * Negative values all become zero. + */ -// Assumption: double is a IEEE 64 bit floating point type -// du_int is a 64 bit integral type -// value in double is representable in du_int or is negative -// (no range checking performed) +/* Assumption: double is a IEEE 64 bit floating point type + * du_int is a 64 bit integral type + * value in double is representable in du_int or is negative + * (no range checking performed) + */ -// seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm +/* seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm */ du_int __fixunsdfdi(double a) diff --git a/lib/fixunsdfsi.c b/lib/fixunsdfsi.c index 383a35efe..f9d2b6d86 100644 --- a/lib/fixunsdfsi.c +++ b/lib/fixunsdfsi.c @@ -1,27 +1,30 @@ -//===-- fixunsdfsi.c - Implement __fixunsdfsi -----------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements __fixunsdfsi for the compiler_rt library. -// -//===----------------------------------------------------------------------===// +/* ===-- fixunsdfsi.c - Implement __fixunsdfsi -----------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __fixunsdfsi for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ #include "int_lib.h" -// Returns: convert a to a unsigned int, rounding toward zero. -// Negative values all become zero. +/* Returns: convert a to a unsigned int, rounding toward zero. + * Negative values all become zero. + */ -// Assumption: double is a IEEE 64 bit floating point type -// su_int is a 32 bit integral type -// value in double is representable in su_int or is negative -// (no range checking performed) +/* Assumption: double is a IEEE 64 bit floating point type + * su_int is a 32 bit integral type + * value in double is representable in su_int or is negative + * (no range checking performed) + */ -// seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm +/* seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm */ su_int __fixunsdfsi(double a) diff --git a/lib/fixunsdfti.c b/lib/fixunsdfti.c index 4b88c6f6b..f765c0092 100644 --- a/lib/fixunsdfti.c +++ b/lib/fixunsdfti.c @@ -1,29 +1,32 @@ -//===-- fixunsdfti.c - Implement __fixunsdfti -----------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements __fixunsdfti for the compiler_rt library. -// -//===----------------------------------------------------------------------===// +/* ===-- fixunsdfti.c - Implement __fixunsdfti -----------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __fixunsdfti for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ #if __x86_64 #include "int_lib.h" -// Returns: convert a to a unsigned long long, rounding toward zero. -// Negative values all become zero. +/* Returns: convert a to a unsigned long long, rounding toward zero. + * Negative values all become zero. + */ -// Assumption: double is a IEEE 64 bit floating point type -// tu_int is a 64 bit integral type -// value in double is representable in tu_int or is negative -// (no range checking performed) +/* Assumption: double is a IEEE 64 bit floating point type + * tu_int is a 64 bit integral type + * value in double is representable in tu_int or is negative + * (no range checking performed) + */ -// seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm +/* seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm */ tu_int __fixunsdfti(double a) diff --git a/lib/fixunssfdi.c b/lib/fixunssfdi.c index 6495c68e7..3837bd890 100644 --- a/lib/fixunssfdi.c +++ b/lib/fixunssfdi.c @@ -1,27 +1,30 @@ -//===-- fixunssfdi.c - Implement __fixunssfdi -----------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements __fixunssfdi for the compiler_rt library. -// -//===----------------------------------------------------------------------===// +/* ===-- fixunssfdi.c - Implement __fixunssfdi -----------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __fixunssfdi for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ #include "int_lib.h" -// Returns: convert a to a unsigned long long, rounding toward zero. -// Negative values all become zero. +/* Returns: convert a to a unsigned long long, rounding toward zero. + * Negative values all become zero. + */ -// Assumption: float is a IEEE 32 bit floating point type -// du_int is a 64 bit integral type -// value in float is representable in du_int or is negative -// (no range checking performed) +/* Assumption: float is a IEEE 32 bit floating point type + * du_int is a 64 bit integral type + * value in float is representable in du_int or is negative + * (no range checking performed) + */ -// seee eeee emmm mmmm mmmm mmmm mmmm mmmm +/* seee eeee emmm mmmm mmmm mmmm mmmm mmmm */ du_int __fixunssfdi(float a) diff --git a/lib/fixunssfsi.c b/lib/fixunssfsi.c index 45c09cd53..a001cd481 100644 --- a/lib/fixunssfsi.c +++ b/lib/fixunssfsi.c @@ -1,27 +1,30 @@ -//===-- fixunssfsi.c - Implement __fixunssfsi -----------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements __fixunssfsi for the compiler_rt library. -// -//===----------------------------------------------------------------------===// +/* ===-- fixunssfsi.c - Implement __fixunssfsi -----------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __fixunssfsi for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ #include "int_lib.h" -// Returns: convert a to a unsigned int, rounding toward zero. -// Negative values all become zero. +/* Returns: convert a to a unsigned int, rounding toward zero. + * Negative values all become zero. + */ -// Assumption: float is a IEEE 32 bit floating point type -// su_int is a 32 bit integral type -// value in float is representable in su_int or is negative -// (no range checking performed) +/* Assumption: float is a IEEE 32 bit floating point type + * su_int is a 32 bit integral type + * value in float is representable in su_int or is negative + * (no range checking performed) + */ -// seee eeee emmm mmmm mmmm mmmm mmmm mmmm +/* seee eeee emmm mmmm mmmm mmmm mmmm mmmm */ su_int __fixunssfsi(float a) diff --git a/lib/fixunssfti.c b/lib/fixunssfti.c index b2f47a824..61fe7bb03 100644 --- a/lib/fixunssfti.c +++ b/lib/fixunssfti.c @@ -1,29 +1,32 @@ -//===-- fixunssfti.c - Implement __fixunssfti -----------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements __fixunssfti for the compiler_rt library. -// -//===----------------------------------------------------------------------===// +/* ===-- fixunssfti.c - Implement __fixunssfti -----------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __fixunssfti for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ #if __x86_64 #include "int_lib.h" -// Returns: convert a to a unsigned long long, rounding toward zero. -// Negative values all become zero. +/* Returns: convert a to a unsigned long long, rounding toward zero. + * Negative values all become zero. + */ -// Assumption: float is a IEEE 32 bit floating point type -// tu_int is a 64 bit integral type -// value in float is representable in tu_int or is negative -// (no range checking performed) +/* Assumption: float is a IEEE 32 bit floating point type + * tu_int is a 64 bit integral type + * value in float is representable in tu_int or is negative + * (no range checking performed) + */ -// seee eeee emmm mmmm mmmm mmmm mmmm mmmm +// seee eeee emmm mmmm mmmm mmmm mmmm mmmm */ tu_int __fixunssfti(float a) diff --git a/lib/fixunsxfdi.c b/lib/fixunsxfdi.c index b0abb9362..e09f2d06d 100644 --- a/lib/fixunsxfdi.c +++ b/lib/fixunsxfdi.c @@ -1,30 +1,34 @@ -//===-- fixunsxfdi.c - Implement __fixunsxfdi -----------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements __fixunsxfdi for the compiler_rt library. -// -//===----------------------------------------------------------------------===// +/* ===-- fixunsxfdi.c - Implement __fixunsxfdi -----------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __fixunsxfdi for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ #if !_ARCH_PPC #include "int_lib.h" -// Returns: convert a to a unsigned long long, rounding toward zero. -// Negative values all become zero. +/* Returns: convert a to a unsigned long long, rounding toward zero. + * Negative values all become zero. + */ -// Assumption: long double is an intel 80 bit floating point type padded with 6 bytes -// du_int is a 64 bit integral type -// value in long double is representable in du_int or is negative -// (no range checking performed) +/* Assumption: long double is an intel 80 bit floating point type padded with 6 bytes + * du_int is a 64 bit integral type + * value in long double is representable in du_int or is negative + * (no range checking performed) + */ -// gggg gggg gggg gggg gggg gggg gggg gggg | gggg gggg gggg gggg seee eeee eeee eeee | -// 1mmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm +/* gggg gggg gggg gggg gggg gggg gggg gggg | gggg gggg gggg gggg seee eeee eeee eeee | + * 1mmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm + */ du_int __fixunsxfdi(long double a) diff --git a/lib/fixunsxfti.c b/lib/fixunsxfti.c index 993594dfa..96c7c4863 100644 --- a/lib/fixunsxfti.c +++ b/lib/fixunsxfti.c @@ -1,30 +1,34 @@ -//===-- fixunsxfti.c - Implement __fixunsxfti -----------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements __fixunsxfti for the compiler_rt library. -// -//===----------------------------------------------------------------------===// +/* ===-- fixunsxfti.c - Implement __fixunsxfti -----------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __fixunsxfti for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ #if __x86_64 #include "int_lib.h" -// Returns: convert a to a unsigned long long, rounding toward zero. -// Negative values all become zero. +/* Returns: convert a to a unsigned long long, rounding toward zero. + * Negative values all become zero. + */ -// Assumption: long double is an intel 80 bit floating point type padded with 6 bytes -// tu_int is a 64 bit integral type -// value in long double is representable in tu_int or is negative -// (no range checking performed) +/* Assumption: long double is an intel 80 bit floating point type padded with 6 bytes + * tu_int is a 64 bit integral type + * value in long double is representable in tu_int or is negative + * (no range checking performed) + */ -// gggg gggg gggg gggg gggg gggg gggg gggg | gggg gggg gggg gggg seee eeee eeee eeee | -// 1mmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm +/* gggg gggg gggg gggg gggg gggg gggg gggg | gggg gggg gggg gggg seee eeee eeee eeee | + * 1mmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm + */ tu_int __fixunsxfti(long double a) diff --git a/lib/fixxfdi.c b/lib/fixxfdi.c index 2a7d20814..48bfc3ceb 100644 --- a/lib/fixxfdi.c +++ b/lib/fixxfdi.c @@ -1,28 +1,31 @@ -//===-- fixxfdi.c - Implement __fixxfdi -----------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements __fixxfdi for the compiler_rt library. -// -//===----------------------------------------------------------------------===// +/* ===-- fixxfdi.c - Implement __fixxfdi -----------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __fixxfdi for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ #if !_ARCH_PPC #include "int_lib.h" -// Returns: convert a to a signed long long, rounding toward zero. +/* Returns: convert a to a signed long long, rounding toward zero. */ -// Assumption: long double is an intel 80 bit floating point type padded with 6 bytes -// su_int is a 32 bit integral type -// value in long double is representable in di_int (no range checking performed) +/* Assumption: long double is an intel 80 bit floating point type padded with 6 bytes + * su_int is a 32 bit integral type + * value in long double is representable in di_int (no range checking performed) + */ -// gggg gggg gggg gggg gggg gggg gggg gggg | gggg gggg gggg gggg seee eeee eeee eeee | -// 1mmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm +/* gggg gggg gggg gggg gggg gggg gggg gggg | gggg gggg gggg gggg seee eeee eeee eeee | + * 1mmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm + */ di_int __fixxfdi(long double a) diff --git a/lib/fixxfti.c b/lib/fixxfti.c index d9cb3eaf0..84406bd16 100644 --- a/lib/fixxfti.c +++ b/lib/fixxfti.c @@ -1,28 +1,31 @@ -//===-- fixxfti.c - Implement __fixxfti -----------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements __fixxfti for the compiler_rt library. -// -//===----------------------------------------------------------------------===// +/* ===-- fixxfti.c - Implement __fixxfti -----------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __fixxfti for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ #if __x86_64 #include "int_lib.h" -// Returns: convert a to a signed long long, rounding toward zero. +/* Returns: convert a to a signed long long, rounding toward zero. */ -// Assumption: long double is an intel 80 bit floating point type padded with 6 bytes -// su_int is a 32 bit integral type -// value in long double is representable in ti_int (no range checking performed) +/* Assumption: long double is an intel 80 bit floating point type padded with 6 bytes + * su_int is a 32 bit integral type + * value in long double is representable in ti_int (no range checking performed) + */ -// gggg gggg gggg gggg gggg gggg gggg gggg | gggg gggg gggg gggg seee eeee eeee eeee | -// 1mmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm +/* gggg gggg gggg gggg gggg gggg gggg gggg | gggg gggg gggg gggg seee eeee eeee eeee | + * 1mmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm + */ ti_int __fixxfti(long double a) diff --git a/lib/floattixf.c b/lib/floattixf.c index 520b6ed08..48ad6bf50 100644 --- a/lib/floattixf.c +++ b/lib/floattixf.c @@ -1,28 +1,31 @@ -//===-- floattixf.c - Implement __floattixf -------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements __floattixf for the compiler_rt library. -// -//===----------------------------------------------------------------------===// +/* ===-- floattixf.c - Implement __floattixf -------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __floattixf for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ #if __x86_64 #include "int_lib.h" #include -// Returns: convert a to a long double, rounding toward even. +/* Returns: convert a to a long double, rounding toward even. */ -// Assumption: long double is a IEEE 80 bit floating point type padded to 128 bits -// ti_int is a 128 bit integral type +/* Assumption: long double is a IEEE 80 bit floating point type padded to 128 bits + * ti_int is a 128 bit integral type + */ -// gggg gggg gggg gggg gggg gggg gggg gggg | gggg gggg gggg gggg seee eeee eeee eeee | -// 1mmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm +/* gggg gggg gggg gggg gggg gggg gggg gggg | gggg gggg gggg gggg seee eeee eeee eeee | + * 1mmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm + */ si_int __clzti2(ti_int a); @@ -38,13 +41,14 @@ __floattixf(ti_int a) int e = sd - 1; // exponent if (sd > LDBL_MANT_DIG) { - // start: 0000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQxxxxxxxxxxxxxxxxxx - // finish: 000000000000000000000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQR - // 12345678901234567890123456 - // 1 = msb 1 bit - // P = bit LDBL_MANT_DIG-1 bits to the right of 1 - // Q = bit LDBL_MANT_DIG bits to the right of 1 - // R = "or" of all bits to the right of Q + /* start: 0000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQxxxxxxxxxxxxxxxxxx + * finish: 000000000000000000000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQR + * 12345678901234567890123456 + * 1 = msb 1 bit + * P = bit LDBL_MANT_DIG-1 bits to the right of 1 + * Q = bit LDBL_MANT_DIG bits to the right of 1 + * R = "or" of all bits to the right of Q + */ switch (sd) { case LDBL_MANT_DIG + 1: @@ -56,27 +60,27 @@ __floattixf(ti_int a) a = ((tu_int)a >> (sd - (LDBL_MANT_DIG+2))) | ((a & ((tu_int)(-1) >> ((N + LDBL_MANT_DIG+2) - sd))) != 0); }; - // finish: - a |= (a & 4) != 0; // Or P into R - ++a; // round - this step may add a significant bit - a >>= 2; // dump Q and R - // a is now rounded to LDBL_MANT_DIG or LDBL_MANT_DIG+1 bits + /* finish: */ + a |= (a & 4) != 0; /* Or P into R */ + ++a; /* round - this step may add a significant bit */ + a >>= 2; /* dump Q and R */ + /* a is now rounded to LDBL_MANT_DIG or LDBL_MANT_DIG+1 bits */ if (a & ((tu_int)1 << LDBL_MANT_DIG)) { a >>= 1; ++e; } - // a is now rounded to LDBL_MANT_DIG bits + /* a is now rounded to LDBL_MANT_DIG bits */ } else { a <<= (LDBL_MANT_DIG - sd); - // a is now rounded to LDBL_MANT_DIG bits + /* a is now rounded to LDBL_MANT_DIG bits */ } long_double_bits fb; - fb.u.high.low = ((su_int)s & 0x8000) | // sign - (e + 16383); // exponent - fb.u.low.all = (du_int)a; // mantissa + fb.u.high.low = ((su_int)s & 0x8000) | /* sign */ + (e + 16383); /* exponent */ + fb.u.low.all = (du_int)a; /* mantissa */ return fb.f; } diff --git a/lib/floatuntixf.c b/lib/floatuntixf.c index a28db10f6..5a48cafec 100644 --- a/lib/floatuntixf.c +++ b/lib/floatuntixf.c @@ -1,28 +1,31 @@ -//===-- floatuntixf.c - Implement __floatuntixf ---------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements __floatuntixf for the compiler_rt library. -// -//===----------------------------------------------------------------------===// +/* ===-- floatuntixf.c - Implement __floatuntixf ---------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __floatuntixf for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ #if __x86_64 #include "int_lib.h" #include -// Returns: convert a to a long double, rounding toward even. +/* Returns: convert a to a long double, rounding toward even. */ -// Assumption: long double is a IEEE 80 bit floating point type padded to 128 bits -// tu_int is a 128 bit integral type +/* Assumption: long double is a IEEE 80 bit floating point type padded to 128 bits + * tu_int is a 128 bit integral type + */ -// gggg gggg gggg gggg gggg gggg gggg gggg | gggg gggg gggg gggg seee eeee eeee eeee | -// 1mmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm +/* gggg gggg gggg gggg gggg gggg gggg gggg | gggg gggg gggg gggg seee eeee eeee eeee | + * 1mmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm + */ si_int __clzti2(ti_int a); @@ -32,17 +35,18 @@ __floatuntixf(tu_int a) if (a == 0) return 0.0; const unsigned N = sizeof(tu_int) * CHAR_BIT; - int sd = N - __clzti2(a); // number of significant digits - int e = sd - 1; // exponent + int sd = N - __clzti2(a); /* number of significant digits */ + int e = sd - 1; /* exponent */ if (sd > LDBL_MANT_DIG) { - // start: 0000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQxxxxxxxxxxxxxxxxxx - // finish: 000000000000000000000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQR - // 12345678901234567890123456 - // 1 = msb 1 bit - // P = bit LDBL_MANT_DIG-1 bits to the right of 1 - // Q = bit LDBL_MANT_DIG bits to the right of 1 - // R = "or" of all bits to the right of Q + /* start: 0000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQxxxxxxxxxxxxxxxxxx + * finish: 000000000000000000000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQR + * 12345678901234567890123456 + * 1 = msb 1 bit + * P = bit LDBL_MANT_DIG-1 bits to the right of 1 + * Q = bit LDBL_MANT_DIG bits to the right of 1 + * R = "or" of all bits to the right of Q + */ switch (sd) { case LDBL_MANT_DIG + 1: @@ -54,26 +58,26 @@ __floatuntixf(tu_int a) a = (a >> (sd - (LDBL_MANT_DIG+2))) | ((a & ((tu_int)(-1) >> ((N + LDBL_MANT_DIG+2) - sd))) != 0); }; - // finish: - a |= (a & 4) != 0; // Or P into R - ++a; // round - this step may add a significant bit - a >>= 2; // dump Q and R - // a is now rounded to LDBL_MANT_DIG or LDBL_MANT_DIG+1 bits + /* finish: */ + a |= (a & 4) != 0; /* Or P into R */ + ++a; /* round - this step may add a significant bit */ + a >>= 2; /* dump Q and R */ + /* a is now rounded to LDBL_MANT_DIG or LDBL_MANT_DIG+1 bits */ if (a & ((tu_int)1 << LDBL_MANT_DIG)) { a >>= 1; ++e; } - // a is now rounded to LDBL_MANT_DIG bits + /* a is now rounded to LDBL_MANT_DIG bits */ } else { a <<= (LDBL_MANT_DIG - sd); - // a is now rounded to LDBL_MANT_DIG bits + /* a is now rounded to LDBL_MANT_DIG bits */ } long_double_bits fb; - fb.u.high.low = (e + 16383); // exponent - fb.u.low.all = (du_int)a; // mantissa + fb.u.high.low = (e + 16383); /* exponent */ + fb.u.low.all = (du_int)a; /* mantissa */ return fb.f; } diff --git a/lib/gcc_personality_v0.c b/lib/gcc_personality_v0.c index 55d1166b8..249f0f0e8 100644 --- a/lib/gcc_personality_v0.c +++ b/lib/gcc_personality_v0.c @@ -1,20 +1,23 @@ -//===-- gcc_personality_v0.c - Implement __gcc_personality_v0 -------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// +/* ===-- gcc_personality_v0.c - Implement __gcc_personality_v0 -------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + */ #include #include #include -// -// _Unwind_* stuff based on C++ ABI public documentation -// http://refspecs.freestandards.org/abi-eh-1.21.html -// +/* + * _Unwind_* stuff based on C++ ABI public documentation + * http://refspecs.freestandards.org/abi-eh-1.21.html + */ + typedef enum { _URC_NO_REASON = 0, _URC_FOREIGN_EXCEPTION_CAUGHT = 1, @@ -52,11 +55,12 @@ extern uintptr_t _Unwind_GetIP(_Unwind_Context_t context); extern uintptr_t _Unwind_GetRegionStart(_Unwind_Context_t context); -// -// Pointer encodings documented at: -// http://refspecs.freestandards.org/LSB_1.3.0/gLSB/gLSB/ehframehdr.html -// -#define DW_EH_PE_omit 0xff // no data follows +/* + * Pointer encodings documented at: + * http://refspecs.freestandards.org/LSB_1.3.0/gLSB/gLSB/ehframehdr.html + */ + +#define DW_EH_PE_omit 0xff /* no data follows */ #define DW_EH_PE_absptr 0x00 #define DW_EH_PE_uleb128 0x01 @@ -73,11 +77,11 @@ extern uintptr_t _Unwind_GetRegionStart(_Unwind_Context_t context); #define DW_EH_PE_datarel 0x30 #define DW_EH_PE_funcrel 0x40 #define DW_EH_PE_aligned 0x50 -#define DW_EH_PE_indirect 0x80 // gcc extension +#define DW_EH_PE_indirect 0x80 /* gcc extension */ -// read a uleb128 encoded value and advance pointer +/* read a uleb128 encoded value and advance pointer */ static uintptr_t readULEB128(const uint8_t** data) { uintptr_t result = 0; @@ -93,7 +97,7 @@ static uintptr_t readULEB128(const uint8_t** data) return result; } -// read a pointer encoded value and advance pointer +/* read a pointer encoded value and advance pointer */ static uintptr_t readEncodedPointer(const uint8_t** data, uint8_t encoding) { const uint8_t* p = *data; @@ -102,7 +106,7 @@ static uintptr_t readEncodedPointer(const uint8_t** data, uint8_t encoding) if ( encoding == DW_EH_PE_omit ) return 0; - // first get value + /* first get value */ switch (encoding & 0x0F) { case DW_EH_PE_absptr: result = *((uintptr_t*)p); @@ -137,15 +141,15 @@ static uintptr_t readEncodedPointer(const uint8_t** data, uint8_t encoding) break; case DW_EH_PE_sleb128: default: - // not supported + /* not supported */ abort(); break; } - // then add relative offset + /* then add relative offset */ switch ( encoding & 0x70 ) { case DW_EH_PE_absptr: - // do nothing + /* do nothing */ break; case DW_EH_PE_pcrel: result += (uintptr_t)(*data); @@ -155,12 +159,12 @@ static uintptr_t readEncodedPointer(const uint8_t** data, uint8_t encoding) case DW_EH_PE_funcrel: case DW_EH_PE_aligned: default: - // not supported + /* not supported */ abort(); break; } - // then apply indirection + /* then apply indirection */ if (encoding & DW_EH_PE_indirect) { result = *((uintptr_t*)result); } @@ -170,24 +174,25 @@ static uintptr_t readEncodedPointer(const uint8_t** data, uint8_t encoding) } -// -// The C compiler makes references to __gcc_personality_v0 in -// the dwarf unwind information for translation units that use -// __attribute__((cleanup(xx))) on local variables. -// This personality routine is called by the system unwinder -// on each frame as the stack is unwound during a C++ exception -// throw through a C function compiled with -fexceptions. -// +/* + * The C compiler makes references to __gcc_personality_v0 in + * the dwarf unwind information for translation units that use + * __attribute__((cleanup(xx))) on local variables. + * This personality routine is called by the system unwinder + * on each frame as the stack is unwound during a C++ exception + * throw through a C function compiled with -fexceptions. + */ + _Unwind_Reason_Code __gcc_personality_v0(int version, _Unwind_Action actions, uint64_t exceptionClass, struct _Unwind_Exception* exceptionObject, _Unwind_Context_t context) { - // Since C does not have catch clauses, there is nothing to do during - // phase 1 (the search phase). + /* Since C does not have catch clauses, there is nothing to do during */ + /* phase 1 (the search phase). */ if ( actions & _UA_SEARCH_PHASE ) return _URC_CONTINUE_UNWIND; - // There is nothing to do if there is no LSDA for this frame. + /* There is nothing to do if there is no LSDA for this frame. */ const uint8_t* lsda = _Unwind_GetLanguageSpecificData(context); if ( lsda == NULL ) return _URC_CONTINUE_UNWIND; @@ -196,7 +201,7 @@ _Unwind_Reason_Code __gcc_personality_v0(int version, _Unwind_Action actions, uintptr_t funcStart = _Unwind_GetRegionStart(context); uintptr_t pcOffset = pc - funcStart; - // Parse LSDA header. + /* Parse LSDA header. */ uint8_t lpStartEncoding = *lsda++; if (lpStartEncoding != DW_EH_PE_omit) { readEncodedPointer(&lsda, lpStartEncoding); @@ -205,7 +210,7 @@ _Unwind_Reason_Code __gcc_personality_v0(int version, _Unwind_Action actions, if (ttypeEncoding != DW_EH_PE_omit) { readULEB128(&lsda); } - // Walk call-site table looking for range that includes current PC. + /* Walk call-site table looking for range that includes current PC. */ uint8_t callSiteEncoding = *lsda++; uint32_t callSiteTableLength = readULEB128(&lsda); const uint8_t* callSiteTableStart = lsda; @@ -215,14 +220,15 @@ _Unwind_Reason_Code __gcc_personality_v0(int version, _Unwind_Action actions, uintptr_t start = readEncodedPointer(&p, callSiteEncoding); uintptr_t length = readEncodedPointer(&p, callSiteEncoding); uintptr_t landingPad = readEncodedPointer(&p, callSiteEncoding); - readULEB128(&p); // action value not used for C code + readULEB128(&p); /* action value not used for C code */ if ( landingPad == 0 ) - continue; // no landing pad for this entry + continue; /* no landing pad for this entry */ if ( (start <= pcOffset) && (pcOffset < (start+length)) ) { - // Found landing pad for the PC. - // Set Instruction Pointer to so we re-enter function - // at landing pad. The landing pad is created by the compiler - // to take two parameters in registers. + /* Found landing pad for the PC. + * Set Instruction Pointer to so we re-enter function + * at landing pad. The landing pad is created by the compiler + * to take two parameters in registers. + */ _Unwind_SetGR(context, __builtin_eh_return_data_regno(0), (uintptr_t)exceptionObject); _Unwind_SetGR(context, __builtin_eh_return_data_regno(1), 0); @@ -231,7 +237,7 @@ _Unwind_Reason_Code __gcc_personality_v0(int version, _Unwind_Action actions, } } - // No landing pad found, continue unwinding. + /* No landing pad found, continue unwinding. */ return _URC_CONTINUE_UNWIND; } diff --git a/lib/lshrdi3.c b/lib/lshrdi3.c index 62eb1a4a0..b3b31bf00 100644 --- a/lib/lshrdi3.c +++ b/lib/lshrdi3.c @@ -1,21 +1,22 @@ -//===-- lshrdi3.c - Implement __lshrdi3 -----------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements __lshrdi3 for the compiler_rt library. -// -//===----------------------------------------------------------------------===// +/* ===-- lshrdi3.c - Implement __lshrdi3 -----------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __lshrdi3 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ #include "int_lib.h" -// Returns: logical a >> b +/* Returns: logical a >> b */ -// Precondition: 0 <= b < bits_in_dword +/* Precondition: 0 <= b < bits_in_dword */ di_int __lshrdi3(di_int a, si_int b) @@ -24,12 +25,12 @@ __lshrdi3(di_int a, si_int b) udwords input; udwords result; input.all = a; - if (b & bits_in_word) // bits_in_word <= b < bits_in_dword + if (b & bits_in_word) /* bits_in_word <= b < bits_in_dword */ { result.high = 0; result.low = input.high >> (b - bits_in_word); } - else // 0 <= b < bits_in_word + else /* 0 <= b < bits_in_word */ { if (b == 0) return a; diff --git a/lib/lshrti3.c b/lib/lshrti3.c index 99258cee1..a2846875d 100644 --- a/lib/lshrti3.c +++ b/lib/lshrti3.c @@ -1,23 +1,24 @@ -//===-- lshrti3.c - Implement __lshrti3 -----------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements __lshrti3 for the compiler_rt library. -// -//===----------------------------------------------------------------------===// +/* ===-- lshrti3.c - Implement __lshrti3 -----------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __lshrti3 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ #if __x86_64 #include "int_lib.h" -// Returns: logical a >> b +/* Returns: logical a >> b */ -// Precondition: 0 <= b < bits_in_tword +/* Precondition: 0 <= b < bits_in_tword */ ti_int __lshrti3(ti_int a, si_int b) @@ -26,12 +27,12 @@ __lshrti3(ti_int a, si_int b) utwords input; utwords result; input.all = a; - if (b & bits_in_dword) // bits_in_dword <= b < bits_in_tword + if (b & bits_in_dword) /* bits_in_dword <= b < bits_in_tword */ { result.high = 0; result.low = input.high >> (b - bits_in_dword); } - else // 0 <= b < bits_in_dword + else /* 0 <= b < bits_in_dword */ { if (b == 0) return a; diff --git a/lib/negdi2.c b/lib/negdi2.c index 2d5cd6301..707b0dd78 100644 --- a/lib/negdi2.c +++ b/lib/negdi2.c @@ -1,24 +1,26 @@ -//===-- negdi2.c - Implement __negdi2 -------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements __negdi2 for the compiler_rt library. -// -//===----------------------------------------------------------------------===// +/* ===-- negdi2.c - Implement __negdi2 -------------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __negdi2 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ #include "int_lib.h" -// Returns: -a +/* Returns: -a */ di_int __negdi2(di_int a) { - // Note: this routine is here for API compatibility; any sane compiler - // should expand it inline. + /* Note: this routine is here for API compatibility; any sane compiler + * should expand it inline. + */ return -a; } diff --git a/lib/negti2.c b/lib/negti2.c index 4244c8b06..6ce6a0403 100644 --- a/lib/negti2.c +++ b/lib/negti2.c @@ -1,27 +1,29 @@ -//===-- negti2.c - Implement __negti2 -------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements __negti2 for the compiler_rt library. -// -//===----------------------------------------------------------------------===// +/* ===-- negti2.c - Implement __negti2 -------------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __negti2 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ #if __x86_64 #include "int_lib.h" -// Returns: -a +/* Returns: -a */ ti_int __negti2(ti_int a) { - // Note: this routine is here for API compatibility; any sane compiler - // should expand it inline. + /* Note: this routine is here for API compatibility; any sane compiler + * should expand it inline. + */ return -a; } diff --git a/lib/negvdi2.c b/lib/negvdi2.c index eb9f6e916..df8a69824 100644 --- a/lib/negvdi2.c +++ b/lib/negvdi2.c @@ -1,22 +1,23 @@ -//===-- negvdi2.c - Implement __negvdi2 -----------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements __negvdi2 for the compiler_rt library. -// -//===----------------------------------------------------------------------===// +/* ===-- negvdi2.c - Implement __negvdi2 -----------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __negvdi2 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ #include "int_lib.h" #include -// Returns: -a +/* Returns: -a */ -// Effects: aborts if -a overflows +/* Effects: aborts if -a overflows */ di_int __negvdi2(di_int a) diff --git a/lib/negvsi2.c b/lib/negvsi2.c index 7e42655e6..a7fbbbd1f 100644 --- a/lib/negvsi2.c +++ b/lib/negvsi2.c @@ -1,22 +1,23 @@ -//===-- negvsi2.c - Implement __negvsi2 -----------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements __negvsi2 for the compiler_rt library. -// -//===----------------------------------------------------------------------===// +/* ===-- negvsi2.c - Implement __negvsi2 -----------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __negvsi2 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ #include "int_lib.h" #include -// Returns: -a +/* Returns: -a */ -// Effects: aborts if -a overflows +/* Effects: aborts if -a overflows */ si_int __negvsi2(si_int a) diff --git a/lib/subvdi3.c b/lib/subvdi3.c index 2548b081e..0261a5d78 100644 --- a/lib/subvdi3.c +++ b/lib/subvdi3.c @@ -1,22 +1,23 @@ -//===-- subvdi3.c - Implement __subvdi3 -----------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements __subvdi3 for the compiler_rt library. -// -//===----------------------------------------------------------------------===// +/* ===-- subvdi3.c - Implement __subvdi3 -----------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __subvdi3 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ #include "int_lib.h" #include -// Returns: a - b +/* Returns: a - b */ -// Effects: aborts if a - b overflows +/* Effects: aborts if a - b overflows */ di_int __subvdi3(di_int a, di_int b) diff --git a/lib/subvsi3.c b/lib/subvsi3.c index 53c141b47..3acb40d3e 100644 --- a/lib/subvsi3.c +++ b/lib/subvsi3.c @@ -1,22 +1,23 @@ -//===-- subvsi3.c - Implement __subvsi3 -----------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements __subvsi3 for the compiler_rt library. -// -//===----------------------------------------------------------------------===// +/* ===-- subvsi3.c - Implement __subvsi3 -----------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __subvsi3 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ #include "int_lib.h" #include -// Returns: a - b +/* Returns: a - b */ -// Effects: aborts if a - b overflows +/* Effects: aborts if a - b overflows */ si_int __subvsi3(si_int a, si_int b) diff --git a/lib/subvti3.c b/lib/subvti3.c index b130c8ceb..a2f764688 100644 --- a/lib/subvti3.c +++ b/lib/subvti3.c @@ -1,24 +1,25 @@ -//===-- subvti3.c - Implement __subvti3 -----------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements __subvti3 for the compiler_rt library. -// -//===----------------------------------------------------------------------===// +/* ===-- subvti3.c - Implement __subvti3 -----------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __subvti3 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ #if __x86_64 #include "int_lib.h" #include -// Returns: a - b +/* Returns: a - b */ -// Effects: aborts if a - b overflows +/* Effects: aborts if a - b overflows */ ti_int __subvti3(ti_int a, ti_int b) diff --git a/lib/trampoline_setup.c b/lib/trampoline_setup.c index a8906bcc0..d62e36b7c 100644 --- a/lib/trampoline_setup.c +++ b/lib/trampoline_setup.c @@ -1,46 +1,48 @@ -//===----- trampoline_setup.c - Implement __trampoline_setup -------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// +/* ===----- trampoline_setup.c - Implement __trampoline_setup -------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + */ #include #include extern void __clear_cache(void* start, void* end); -// -// The ppc compiler generates calls to __trampoline_setup() when creating -// trampoline functions on the stack for use with nested functions. -// This function creates a custom 40-byte trampoline function on the stack -// which loads r11 with a pointer to the outer function's locals -// and then jumps to the target nested function. -// +/* + * The ppc compiler generates calls to __trampoline_setup() when creating + * trampoline functions on the stack for use with nested functions. + * This function creates a custom 40-byte trampoline function on the stack + * which loads r11 with a pointer to the outer function's locals + * and then jumps to the target nested function. + */ + #if __ppc__ void __trampoline_setup(uint32_t* trampOnStack, int trampSizeAllocated, const void* realFunc, void* localsPtr) { - // should never happen, but if compiler did not allocate - // enough space on stack for the trampoline, abort + /* should never happen, but if compiler did not allocate */ + /* enough space on stack for the trampoline, abort */ if ( trampSizeAllocated < 40 ) abort(); - // create trampoline - trampOnStack[0] = 0x7c0802a6; // mflr r0 - trampOnStack[1] = 0x4800000d; // bl Lbase + /* create trampoline */ + trampOnStack[0] = 0x7c0802a6; /* mflr r0 */ + trampOnStack[1] = 0x4800000d; /* bl Lbase */ trampOnStack[2] = (uint32_t)realFunc; trampOnStack[3] = (uint32_t)localsPtr; - trampOnStack[4] = 0x7d6802a6; // Lbase: mflr r11 - trampOnStack[5] = 0x818b0000; // lwz r12,0(r11) - trampOnStack[6] = 0x7c0803a6; // mtlr r0 - trampOnStack[7] = 0x7d8903a6; // mtctr r12 - trampOnStack[8] = 0x816b0004; // lwz r11,4(r11) - trampOnStack[9] = 0x4e800420; // bctr + trampOnStack[4] = 0x7d6802a6; /* Lbase: mflr r11 */ + trampOnStack[5] = 0x818b0000; /* lwz r12,0(r11) */ + trampOnStack[6] = 0x7c0803a6; /* mtlr r0 */ + trampOnStack[7] = 0x7d8903a6; /* mtctr r12 */ + trampOnStack[8] = 0x816b0004; /* lwz r11,4(r11) */ + trampOnStack[9] = 0x4e800420; /* bctr */ - // clear instruction cache + /* clear instruction cache */ __clear_cache(trampOnStack, &trampOnStack[10]); } -#endif // __ppc__ +#endif /* __ppc__ */ -- cgit v1.2.3