Advertisement
Guest User

Untitled

a guest
Dec 17th, 2012
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.22 KB | None | 0 0
  1. $ cat $LLVM_HOME/tools/clang/lib/Basic/Targets.cpp
  2. ...
  3.     ARCompactTargetInfo(const std::string& triple) : TargetInfo(triple) {
  4.       // Set the default information variables.
  5.       // Mostly taken from ARC GCC manual, some guessed from other targets.
  6.  
  7.       BigEndian = false;
  8.       TLSSupported = false;
  9.       NoAsmVariants = false;
  10.  
  11.       PointerWidth = PointerAlign = 32;
  12.       BoolWidth = BoolAlign = 8;
  13.       IntWidth = IntAlign = 32;
  14.       LongWidth = LongAlign = 32;
  15.       LongLongWidth = 64; LongLongAlign = 32;
  16.       // TODO: Check this. I believe Suitable Align is an align for anything, so 32 should do.
  17.       SuitableAlign = 32;
  18.       HalfWidth = HalfAlign = 16;
  19.       FloatWidth = FloatAlign = 32;
  20.       DoubleWidth = 64; DoubleAlign = 32;
  21.       LongDoubleWidth = 64; LongDoubleAlign = 32;
  22.  
  23.       // Most of this stuff is probably unsupported.
  24.       LargeArrayMinWidth = 0;
  25.       LargeArrayAlign = 0;
  26.       MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 0;
  27.  
  28.       // Type information.
  29.       SizeType = UnsignedInt;
  30.       PtrDiffType = SignedInt;
  31.       IntMaxType = SignedLongLong;
  32.       UIntMaxType = UnsignedLongLong;
  33.       IntPtrType = SignedInt;
  34.       WCharType = SignedInt; // Not sure if correct.
  35.       WIntType = SignedInt; // Not sure if correct.
  36.       Char16Type = UnsignedShort;
  37.       Char32Type = UnsignedInt;
  38.       Int64Type = SignedLongLong; // Not sure if correct.
  39.       SigAtomicType = SignedInt; // Not sure if correct.
  40.  
  41.       DescriptionString = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-"
  42.                           "i64:32:32:32-f32:32:32:32-f64:32:32:32-n32";
  43.       UserLabelPrefix = "_"; // TODO: Check.
  44.     }
  45. ...
  46. $ cat test.c
  47. int main() {
  48.   double x = 5.5;
  49.   return 0;
  50. }
  51. $ clang -ccc-host-triple arcompact -O0 test.c -emit-llvm -S -o test.ll
  52. $ cat test.ll
  53. ; ModuleID = 'test.c'
  54. target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:32:32-f32:32:32:32-f64:32:32:32-n32"
  55. target triple = "arcompact"
  56.  
  57. define i32 @main() nounwind {
  58. entry:
  59.   %retval = alloca i32, align 4
  60.   %x = alloca double, align 8  <---- why does this happen?
  61.   store i32 0, i32* %retval
  62.   store double 5.500000e+00, double* %x, align 8  <---- why does this happen?
  63.   ret i32 0
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement