├── src ├── bits_and_bobs.cpp └── unknown │ └── Target.cpp ├── test ├── compilator │ ├── dragonegg-validator │ └── local │ │ ├── pr2951.c │ │ ├── ssa.c │ │ ├── lused.c │ │ ├── pr5234.C │ │ ├── no_pred.c │ │ ├── ada │ │ ├── global_constant.adb │ │ ├── asm.adb │ │ ├── global_constant.ads │ │ ├── vce.adb │ │ ├── var_size.adb │ │ ├── non_lvalue.adb │ │ ├── volatile_function.ads │ │ ├── emit_var.ads │ │ ├── array_constructor.adb │ │ ├── array_range_ref.adb │ │ ├── var_offset.adb │ │ ├── fat_fields.adb │ │ ├── volatile_function.adb │ │ ├── unc_constructor.adb │ │ ├── array_size.adb │ │ ├── fat_fields.ads │ │ ├── vce_lv.adb │ │ ├── var_size.ads │ │ ├── field_order.ads │ │ ├── debug_var_size.ads │ │ ├── unc_constructor.ads │ │ ├── switch.adb │ │ ├── var_offset.ads │ │ ├── array_ref.adb │ │ ├── non_bitfield.ads │ │ ├── non_lvalue.ads │ │ ├── init_size.ads │ │ ├── pr15984.adb │ │ ├── bitfield.adb │ │ ├── negative_field_offset.adb │ │ ├── bitfield.ads │ │ ├── placeholder.adb │ │ └── pr15984.ads │ │ ├── bill.C │ │ ├── name.c │ │ ├── c++ │ │ ├── 2006-09-08-powi.cpp │ │ ├── 2005-02-27-PlacementArrayNewCrash.cpp │ │ ├── 2003-11-25-ReturningOpaqueByValue.cpp │ │ ├── 2009-07-16-PrivateCopyConstructor.cpp │ │ ├── 2004-09-27-CompilerCrash.cpp │ │ ├── 2007-04-31-TryCatch.cpp │ │ ├── nameless-type.cpp │ │ ├── 2007-05-16-ReverseBitFieldCrash.cpp │ │ └── 2004-11-27-InlineAsmFunctionRedefinition.cpp │ │ ├── static_chain.c │ │ ├── 2009-01-20-k8.c │ │ ├── pr9714.c │ │ ├── bof.C │ │ ├── sqrtps_nr.c │ │ ├── c │ │ ├── typedef.c │ │ └── 2012-04-20-PointerBIT_AND_EXPR.c │ │ ├── inline-asm-function.c │ │ ├── clone.c │ │ ├── 2008-07-08-FAbsAttributes.c │ │ ├── filelist.cpp │ │ ├── rs.c │ │ ├── zerosize-union-field.c │ │ ├── 2007-03-06-VarSizeInStruct2.c │ │ ├── 2007-03-06-VarSizeInStruct1.c │ │ ├── false.c │ │ ├── 2003-09-30-CommaExprBug.cpp │ │ ├── 2003-09-30-ForIncrementExprBug.cpp │ │ ├── 2003-10-21-InnerClass.cpp │ │ ├── 2008-02-11-AnnotateBuiltin.c │ │ ├── 2003-08-24-Cleanup.cpp │ │ ├── 2007-02-16-VariableSizeStructArg.c │ │ ├── 2008-11-03-OptionOverride.f90 │ │ ├── 2003-10-17-BoolBitfields.cpp │ │ ├── 2003-11-04-CatchLabelName.cpp │ │ ├── 2009-09-04-modify-crash.cpp │ │ ├── pr9652.f │ │ ├── 2003-08-20-ExceptionFail.cpp │ │ ├── 2003-09-30-ForIncrementExprBug2.cpp │ │ ├── 2003-08-21-EmptyClass.cpp │ │ ├── 2007-03-27-ArrayCompatible.c │ │ ├── include.c │ │ ├── 2003-11-04-ArrayConstructors.cpp │ │ ├── 2003-11-25-ReturningOpaqueByValue.cpp │ │ ├── pr9726.c │ │ ├── 2003-09-22-CompositeExprValue.cpp │ │ ├── 2003-11-08-ArrayAddress.cpp │ │ ├── 2005-10-18-VariableSizedElementCrash.c │ │ ├── 2006-09-27-Debug-Protection.cpp │ │ ├── commoncap.i │ │ ├── opt-test.c │ │ ├── together.cpp │ │ ├── wall.c │ │ ├── 2007-11-27-SExtZExt.c │ │ ├── just-compile.cpp │ │ ├── sink.c │ │ ├── 2003-08-27-TypeNamespaces.cpp │ │ ├── 2007-02-16-WritableStrings.c │ │ ├── 2006-05-01-AppleAlignmentPragma.c │ │ ├── vla-1.c │ │ ├── tramp.c │ │ ├── 2003-08-29-ArgPassingBug.cpp │ │ ├── 2010-03-10-arm-asmreg.c │ │ ├── 2009-08-11-AsmBlocksComplexJumpTarget.c │ │ ├── 2003-11-18-EnumArray.cpp │ │ ├── 2007-05-07-NestedStructReturn.c │ │ ├── 2004-11-27-VariableSizeInStructure.c │ │ ├── 2007-12-VarArrayDebug.c │ │ ├── 2004-09-27-CompilerCrash.cpp │ │ ├── ptr-rotate.c │ │ ├── 2003-09-30-NestedFunctionDecl.cpp │ │ ├── 2003-10-27-VirtualBaseClassCrash.cpp │ │ ├── emit-llvm-opt.c │ │ ├── dash-x.cpp │ │ ├── nested-functions.c │ │ ├── cstring-align.c │ │ ├── bid128.c │ │ ├── 2010-06-28-DbgLocalVar.c │ │ ├── 2009-05-17-AlwaysInline.c │ │ ├── fortran │ │ ├── cpow.f90 │ │ └── 2009-02-09-FloorDivExpr.f90 │ │ ├── 2007-02-04-WITH_SIZE_EXPR.c │ │ ├── 2003-08-31-StructLayout.cpp │ │ ├── 2008-11-11-AnnotateStructFieldAttribute.c │ │ ├── 2010-01-05-LinkageName.c │ │ ├── 2005-05-06-CountBuiltins.c │ │ ├── alignstack.c │ │ ├── hollerith_reduced.f90 │ │ ├── 2010-01-14-StaticVariable.c │ │ ├── alignstack.cpp │ │ ├── 2003-08-28-SaveExprBug.cpp │ │ ├── 2003-09-29-ArgumentNumberMismatch.cpp │ │ ├── 2009-02-17-BitField-dbg.c │ │ ├── 2009-04-21-DtorNames-dbg.cpp │ │ ├── 2010-06-28-nowarn.c │ │ ├── 2010-07-19-nowarn.cpp │ │ ├── asm_float_truncate.cpp │ │ ├── 2010-04-30-OptimizedMethod-Dbg.cpp │ │ ├── 2010-11-16-asmblock.c │ │ ├── rsqrtps_nr.c │ │ ├── 2007-09-20-GcrootAttribute.c │ │ ├── 2010-05-14-Optimized-VarType.c │ │ ├── AliasOfRename.c │ │ ├── 2003-08-28-ForwardType.cpp │ │ ├── fp-logical.c │ │ ├── 2010-05-18-asmsched.c │ │ ├── 2010-02-17-DbgArtificialArg.cpp │ │ ├── 2010-05-18-palignr.c │ │ ├── 2006-11-30-Pubnames.cpp │ │ ├── 2007-07-04-NestedCatches.cpp │ │ ├── 2010-02-16-DbgVarScope.c │ │ ├── pr17347.C │ │ ├── facerec_fft2d_MINIMIZED.f90 │ │ ├── 2007-02-05-nested.c │ │ ├── 2010-07-27-MinNoFoldConst.c │ │ ├── 2009-07-15-LineNumbers.cpp │ │ ├── pr11058.cpp │ │ ├── UnderAligned.ii │ │ ├── 2010-08-31-ByValArg.cpp │ │ ├── 2006-11-06-StackTrace.cpp │ │ ├── 2006-11-30-NoCompileUnit.cpp │ │ ├── 2007-04-11-InlineStorageClassC89.c │ │ ├── 2007-04-11-InlineStorageClassC99.c │ │ ├── CodeCompleteConsumer.ii │ │ ├── pr3373.c │ │ ├── 2002-07-29-Casts.c │ │ └── lucas_distrib_spec_MINIMIZED.f90 ├── e.class ├── validator │ ├── c │ │ ├── stdin.c │ │ ├── NoReturn.c │ │ ├── FunctionCastCall.c │ │ ├── NoBuiltin.c │ │ ├── 2012-05-06-SelfInit.c │ │ ├── FunctionVariableAlias.c │ │ ├── LongDoubleSize.c │ │ ├── BuiltinAssumeAligned.c │ │ ├── GlobalAlignment.c │ │ ├── VariableFunctionAlias.c │ │ ├── copysignp.c │ │ ├── trampoline-warning.c │ │ ├── InternVariableWeakref.c │ │ ├── 2012-10-01-Alloca.c │ │ ├── 2012-06-05-Alloca.c │ │ ├── ExternVariableWeakref.c │ │ ├── InternFunctionWeakref.c │ │ ├── ExternFunctionWeakref.c │ │ ├── NoIROptimize.c │ │ ├── EmptyBlock.c │ │ ├── StackProtector.c │ │ ├── rdrand-builtins-64.c │ │ ├── vectorizer.c │ │ ├── VariableAlias.c │ │ ├── 2012-09-10-MRVOverflow.c │ │ ├── FunctionAlias.c │ │ ├── TargetAttributes.c │ │ ├── fma.c │ │ ├── 2012-03-16-AllocaOrder.c │ │ ├── ConstructorAsLValue.c │ │ ├── signbit.c │ │ ├── iceil.c │ │ ├── rdrand-builtins.c │ │ ├── lround.c │ │ ├── fast-math.c │ │ ├── PointerPlusExpr.c │ │ ├── 2012-09-08-BitfieldAlignment.c │ │ └── ThreadLocalVariables.c │ ├── ada │ │ ├── abi_overflow.ads │ │ ├── constant_fold.ads │ │ ├── real_cst.ads │ │ ├── abi_overflow.adb │ │ ├── real_cst.adb │ │ ├── element_copy.ads │ │ ├── empty_type.adb │ │ └── element_copy.adb │ ├── c++ │ │ ├── nullptr29.C │ │ ├── 2004-01-11-DynamicInitializedConstant.cpp │ │ ├── 2012-04-27-Alias.cpp │ │ ├── 2008-01-11-BadWarning.cpp │ │ ├── 2009-02-07-VolatileArrayRefHack.cpp │ │ ├── 2009-02-16-CtorNames-dbg.cpp │ │ ├── nullptr_t.cpp │ │ ├── 2005-01-03-StaticInitializers.cpp │ │ ├── 2012-03-25-LoadRange.cpp │ │ ├── nullptr09.C │ │ ├── 2004-03-09-UnmangledBuiltinMethods.cpp │ │ ├── 2007-07-29-RestrictRefArg.cpp │ │ ├── 2007-07-29-RestrictPtrArg.cpp │ │ ├── EmptyBlock.cpp │ │ ├── nullptr01.C │ │ ├── 2012-04-13-EnumRange.cpp │ │ ├── 2005-02-13-BadDynamicInit.cpp │ │ ├── 2005-02-14-BitFieldOffset.cpp │ │ ├── 2007-08-01-RestrictMethod.cpp │ │ ├── nullptr05.C │ │ ├── 2007-05-23-TryFinally.cpp │ │ ├── nullptr08.C │ │ ├── 2012-12-08-Padding.cpp │ │ ├── MRVAlignment.cpp │ │ ├── 2004-11-27-EmitsUnusedInlineFunctions.cpp │ │ ├── 2007-03-27-FunctionVarRename.cpp │ │ ├── nullptr06.C │ │ ├── 2003-11-02-WeakLinkage.cpp │ │ ├── 2010-06-21-LocalVarDbg.cpp │ │ ├── nullptr13.C │ │ ├── member-alignment.cpp │ │ ├── 2009-09-09-packed-layout.cpp │ │ ├── NotAddressable.cpp │ │ ├── CallReturnAlignment.cpp │ │ ├── 2009-06-30-ByrefBlock.cpp │ │ ├── 2012-09-27-param-align.cpp │ │ ├── 2005-07-21-VirtualBaseAccess.cpp │ │ ├── 2009-12-23-MissingSext.cpp │ │ ├── nullptr20.C │ │ ├── integration-O2.cpp │ │ ├── 2006-11-20-GlobalSymbols.cpp │ │ ├── OffsetType.cpp │ │ ├── varargs.cpp │ │ ├── nullptr22.C │ │ ├── nullptr18.C │ │ ├── m64-ptr.cpp │ │ ├── nullptr17.C │ │ ├── nullptr14.C │ │ ├── 2004-09-27-DidntEmitTemplate.cpp │ │ ├── x86-64-abi-sret-vs-2word-struct-param.cpp │ │ ├── weak-external.cpp │ │ ├── nullptr21.C │ │ ├── nullptr11.C │ │ ├── 2009-06-20-DarwinPPCLayout.cpp │ │ ├── 2007-04-11-InlineStorageClassC++.cpp │ │ ├── 2007-01-06-ELF-Thunk-Sections.cpp │ │ ├── 2007-01-06-ELF-Thunk-Sections-2.cpp │ │ └── 2010-07-23-DeclLoc.cpp │ ├── fortran │ │ ├── 2008-11-03-OptionOverride.f90 │ │ ├── 2012-03-22-NoAlias.f │ │ ├── 2012-11-29-VectorCstCast.f │ │ ├── 2012-04-24-CondExpr.f90 │ │ ├── 2012-04-25-VecPermExpr.f90 │ │ └── VecPackFixTruncExpr.f │ ├── objc │ │ ├── 2008-11-12-Metadata.m │ │ ├── 2007-10-23-GC-WriteBarrier.m │ │ ├── 2009-02-05-VolatileProp.m │ │ ├── 2007-10-18-ProDescriptor.m │ │ ├── 2007-05-02-Strong.m │ │ ├── 2007-04-03-ObjcEH.m │ │ ├── 2008-10-3-EhValue.m │ │ ├── 2010-03-17-StructRef.m │ │ └── 2009-04-28-bitfield-vs-vbc.m │ ├── BitfieldRefAlignment.cpp │ ├── go │ │ └── heap-trampoline.go │ └── validator-lit.cfg ├── dragonegg-lit.site.cfg.in ├── DEFormats.py ├── CMakeLists.txt ├── README └── DEUtils.py ├── include ├── unknown │ └── dragonegg │ │ └── OS.h ├── dragonegg │ ├── Aliasing.h │ ├── Cache.h │ ├── ConstantConversion.h │ ├── ADT │ │ └── Range.h │ └── TypeConversion.h ├── linux │ └── dragonegg │ │ └── OS.h ├── freebsd │ └── dragonegg │ │ └── OS.h ├── openbsd │ └── dragonegg │ │ └── OS.h ├── kfreebsd │ └── dragonegg │ │ └── OS.h └── darwin │ └── dragonegg │ └── OS.h ├── www ├── favicon.ico ├── dragonegg.png └── dragoneggsmall.png ├── exports.map ├── integrated-as.specs ├── utils ├── CMakeLists.txt └── TargetInfo.cpp ├── .gitignore ├── TODO └── CMakeLists.txt /src/bits_and_bobs.cpp: -------------------------------------------------------------------------------- 1 | int ix86_regparm; 2 | -------------------------------------------------------------------------------- /test/compilator/dragonegg-validator: -------------------------------------------------------------------------------- 1 | ../validator/ -------------------------------------------------------------------------------- /src/unknown/Target.cpp: -------------------------------------------------------------------------------- 1 | #error Unknown target architecture 2 | -------------------------------------------------------------------------------- /include/unknown/dragonegg/OS.h: -------------------------------------------------------------------------------- 1 | #error Unknown target operating system 2 | -------------------------------------------------------------------------------- /test/compilator/local/pr2951.c: -------------------------------------------------------------------------------- 1 | void *p = ((void*)&((char*)0)[0]); 2 | -------------------------------------------------------------------------------- /test/compilator/local/ssa.c: -------------------------------------------------------------------------------- 1 | int f(int x, int y, int b) { return b ? x : y; } 2 | -------------------------------------------------------------------------------- /test/e.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llvm-mirror/dragonegg/HEAD/test/e.class -------------------------------------------------------------------------------- /www/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llvm-mirror/dragonegg/HEAD/www/favicon.ico -------------------------------------------------------------------------------- /www/dragonegg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llvm-mirror/dragonegg/HEAD/www/dragonegg.png -------------------------------------------------------------------------------- /test/compilator/local/lused.c: -------------------------------------------------------------------------------- 1 | void f(void) { 2 | __attribute__((used)) int local_var; 3 | } 4 | -------------------------------------------------------------------------------- /test/compilator/local/pr5234.C: -------------------------------------------------------------------------------- 1 | static int f0() { return 1; } 2 | int f1() { return f0(); } 3 | -------------------------------------------------------------------------------- /test/validator/c/stdin.c: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -g -x c -S -o /dev/null - < %s 2 | 3 | void dummy() {} 4 | -------------------------------------------------------------------------------- /www/dragoneggsmall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llvm-mirror/dragonegg/HEAD/www/dragoneggsmall.png -------------------------------------------------------------------------------- /test/compilator/local/no_pred.c: -------------------------------------------------------------------------------- 1 | int f(int x, int y, int b) { 2 | return 0; 3 | return b ? x : y; 4 | } 5 | -------------------------------------------------------------------------------- /exports.map: -------------------------------------------------------------------------------- 1 | { 2 | global: 3 | plugin_is_GPL_compatible; 4 | plugin_init; 5 | local: 6 | *; 7 | }; 8 | -------------------------------------------------------------------------------- /test/compilator/local/ada/global_constant.adb: -------------------------------------------------------------------------------- 1 | package body Global_Constant is 2 | begin 3 | raise An_Error; 4 | end; 5 | -------------------------------------------------------------------------------- /test/compilator/local/bill.C: -------------------------------------------------------------------------------- 1 | #include 2 | void dummysymbol() { 3 | throw(std::runtime_error("string")); 4 | } 5 | -------------------------------------------------------------------------------- /test/compilator/local/name.c: -------------------------------------------------------------------------------- 1 | unsigned bswap(unsigned) __asm__("swap"); 2 | int main(void) { 3 | return bswap(1); 4 | } 5 | -------------------------------------------------------------------------------- /integrated-as.specs: -------------------------------------------------------------------------------- 1 | *invoke_as: 2 | %{!fwpa:%{!S:-fplugin-arg-dragonegg-emit-obj %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}}} 3 | -------------------------------------------------------------------------------- /utils/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_llvm_utility(TargetInfo 2 | TargetInfo.cpp 3 | ) 4 | 5 | target_link_libraries(TargetInfo LLVMSupport) 6 | -------------------------------------------------------------------------------- /test/compilator/local/ada/asm.adb: -------------------------------------------------------------------------------- 1 | with System.Machine_Code; 2 | procedure Asm is 3 | begin 4 | System.Machine_Code.Asm (""); 5 | end; 6 | -------------------------------------------------------------------------------- /test/compilator/local/c++/2006-09-08-powi.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | double foo(double X, int Y) { 4 | return std::pow(X, Y); 5 | } 6 | -------------------------------------------------------------------------------- /test/compilator/local/ada/global_constant.ads: -------------------------------------------------------------------------------- 1 | package Global_Constant is 2 | pragma Elaborate_Body; 3 | An_Error : exception; 4 | end; 5 | -------------------------------------------------------------------------------- /test/compilator/local/ada/vce.adb: -------------------------------------------------------------------------------- 1 | procedure VCE is 2 | S : String (1 .. 2); 3 | B : Character := 'B'; 4 | begin 5 | S := 'A' & B; 6 | end; 7 | -------------------------------------------------------------------------------- /test/compilator/local/static_chain.c: -------------------------------------------------------------------------------- 1 | void X(void) { 2 | auto void D(void); 3 | void E(void) { D(); } 4 | void D(void) {} 5 | E(); 6 | } 7 | -------------------------------------------------------------------------------- /test/validator/c/NoReturn.c: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S %s -o - | FileCheck %s 2 | 3 | void foo() { 4 | exit(1); 5 | // CHECK-NOT: ret void 6 | } 7 | -------------------------------------------------------------------------------- /test/compilator/local/2009-01-20-k8.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc %s -S -march=k8 -o /dev/null 2 | // XFAIL: * 3 | // XTARGET: x86,i386,i686 4 | long double x; 5 | -------------------------------------------------------------------------------- /test/compilator/local/pr9714.c: -------------------------------------------------------------------------------- 1 | void lr_states (int n, double W[], double *pW[]) { 2 | int i; 3 | for (i = 0; i < n; ++i) 4 | pW[i] = &W[i]; 5 | } 6 | -------------------------------------------------------------------------------- /test/compilator/local/bof.C: -------------------------------------------------------------------------------- 1 | #include 2 | void g(std::string &X); 3 | void bof(const char *c, size_t d) { 4 | std::string X(c, d); 5 | g(X); 6 | } 7 | -------------------------------------------------------------------------------- /test/compilator/local/c++/2005-02-27-PlacementArrayNewCrash.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | typedef double Ty[4]; 3 | 4 | void foo(Ty *XX) { 5 | new(XX) Ty(); 6 | } 7 | -------------------------------------------------------------------------------- /test/compilator/local/ada/var_size.adb: -------------------------------------------------------------------------------- 1 | package body Var_Size is 2 | function A (X : T) return String is 3 | begin 4 | return X.A; 5 | end; 6 | end; 7 | -------------------------------------------------------------------------------- /test/compilator/local/sqrtps_nr.c: -------------------------------------------------------------------------------- 1 | typedef float v4sf __attribute__ ((vector_size (16))); 2 | v4sf foo_nr(v4sf v) { 3 | return __builtin_ia32_sqrtps_nr(v); 4 | } 5 | -------------------------------------------------------------------------------- /test/validator/ada/abi_overflow.ads: -------------------------------------------------------------------------------- 1 | -- RUN: true 2 | package ABI_Overflow is 3 | type T is array (1 .. 3) of Character; 4 | procedure Foo (X : T); 5 | end; 6 | -------------------------------------------------------------------------------- /test/compilator/local/ada/non_lvalue.adb: -------------------------------------------------------------------------------- 1 | package body Non_LValue is 2 | function A (Y : U) return String is 3 | begin 4 | return Y.X.B; 5 | end; 6 | end; 7 | -------------------------------------------------------------------------------- /test/compilator/local/ada/volatile_function.ads: -------------------------------------------------------------------------------- 1 | package Volatile_Function is 2 | procedure Volatile; 3 | pragma No_Return (Volatile); 4 | end Volatile_Function; 5 | -------------------------------------------------------------------------------- /test/compilator/local/c/typedef.c: -------------------------------------------------------------------------------- 1 | /* Do not pass a typedef when creating debug info for the function definition */ 2 | typedef void fn_t(); 3 | fn_t b; 4 | void b() {} 5 | -------------------------------------------------------------------------------- /test/compilator/local/inline-asm-function.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc -S %s -fasm-blocks -o - -O | grep naked 2 | // 7533078 (partial). 3 | 4 | asm int f() { 5 | xyz 6 | } 7 | -------------------------------------------------------------------------------- /test/validator/c/FunctionCastCall.c: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S -o /dev/null %s 2 | 3 | typedef void (*ft)(void); 4 | 5 | void foo(ft f) { 6 | ((void(*)(int))f)(0); 7 | } 8 | -------------------------------------------------------------------------------- /test/compilator/local/ada/emit_var.ads: -------------------------------------------------------------------------------- 1 | with Ada.Finalization; 2 | package Emit_Var is 3 | type Search_Type is new Ada.Finalization.Controlled with null record; 4 | end; 5 | -------------------------------------------------------------------------------- /test/compilator/local/clone.c: -------------------------------------------------------------------------------- 1 | static __attribute__((noinline)) int g(int i, int j) { 2 | if (j != 0) return 0; 3 | return i; 4 | } 5 | int f(int i) { return g(i, 0); } 6 | -------------------------------------------------------------------------------- /test/validator/ada/constant_fold.ads: -------------------------------------------------------------------------------- 1 | -- RUN: %dragonegg -S %s -o - | FileCheck %s 2 | package Constant_Fold is 3 | -- CHECK-NOT: ptrtoint 4 | Error : exception; 5 | end; 6 | -------------------------------------------------------------------------------- /test/validator/c++/nullptr29.C: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -xc++ -S -std=c++0x -o /dev/null %s 2 | // XFAIL: gcc-4.5 3 | // PR14777 4 | void f(decltype(nullptr) &__restrict np) { } 5 | -------------------------------------------------------------------------------- /test/compilator/local/ada/array_constructor.adb: -------------------------------------------------------------------------------- 1 | procedure Array_Constructor is 2 | A : array (Integer range <>) of Boolean := (True, False); 3 | begin 4 | null; 5 | end; 6 | -------------------------------------------------------------------------------- /test/compilator/local/ada/array_range_ref.adb: -------------------------------------------------------------------------------- 1 | procedure Array_Range_Ref is 2 | A : String (1 .. 3); 3 | B : String := A (A'RANGE)(1 .. 3); 4 | begin 5 | null; 6 | end; 7 | -------------------------------------------------------------------------------- /test/compilator/local/ada/var_offset.adb: -------------------------------------------------------------------------------- 1 | package body Var_Offset is 2 | function F (X : T) return Character is 3 | begin 4 | return X.Bad_Field; 5 | end; 6 | end; 7 | -------------------------------------------------------------------------------- /test/validator/ada/real_cst.ads: -------------------------------------------------------------------------------- 1 | -- RUN: true 2 | with Ada.Streams; 3 | package Real_Cst is 4 | procedure Write (Stream : access Ada.Streams.Root_Stream_Type'Class); 5 | end; 6 | -------------------------------------------------------------------------------- /test/compilator/local/2008-07-08-FAbsAttributes.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc -S %s -o - | grep readnone 2 | // PR2520 3 | #include 4 | double f(double *x, double *y) { return fabs(*x + *y); } 5 | -------------------------------------------------------------------------------- /test/compilator/local/ada/fat_fields.adb: -------------------------------------------------------------------------------- 1 | package body Fat_Fields is 2 | procedure Proc is 3 | begin 4 | if P = null then 5 | null; 6 | end if; 7 | end; 8 | end; 9 | -------------------------------------------------------------------------------- /test/compilator/local/ada/volatile_function.adb: -------------------------------------------------------------------------------- 1 | package body Volatile_Function is 2 | procedure Volatile is 3 | begin 4 | raise Program_Error; 5 | end; 6 | end Volatile_Function; 7 | -------------------------------------------------------------------------------- /test/compilator/local/filelist.cpp: -------------------------------------------------------------------------------- 1 | // Test that the -filelist option works correctly with -linker=c++. 2 | // RUN: llvmc --dry-run -filelist DUMMY -linker c++ |& grep llvm-g++ 3 | // XFAIL: vg 4 | -------------------------------------------------------------------------------- /test/compilator/local/rs.c: -------------------------------------------------------------------------------- 1 | struct R { 2 | long a; 3 | long b; 4 | }; 5 | 6 | struct R f(long a, long b) { 7 | struct R A; 8 | A.a = a; 9 | A.b = b; 10 | return A; 11 | } 12 | -------------------------------------------------------------------------------- /test/compilator/local/zerosize-union-field.c: -------------------------------------------------------------------------------- 1 | typedef unsigned int Foo __attribute__((aligned(32))); 2 | typedef union{Foo:0;char b;}a; 3 | typedef union{int x; Foo:0;}b; 4 | 5 | a A; 6 | b B; 7 | -------------------------------------------------------------------------------- /test/compilator/local/2007-03-06-VarSizeInStruct2.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc %s -S -o - 2 | char p (int n) { 3 | struct f { 4 | char w; char x[n]; char y[n]; 5 | } F; 6 | 7 | return F.x[0]; 8 | } 9 | -------------------------------------------------------------------------------- /test/compilator/local/ada/unc_constructor.adb: -------------------------------------------------------------------------------- 1 | package body Unc_Constructor is 2 | procedure P (X : A) is 3 | begin 4 | if X = A0 then 5 | null; 6 | end if; 7 | end; 8 | end; 9 | -------------------------------------------------------------------------------- /test/validator/c/NoBuiltin.c: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -fno-builtin -O2 -S %s -o - | FileCheck %s 2 | 3 | void foo(char *c, unsigned n) { 4 | // CHECK-NOT: memset 5 | while (n--) 6 | *(c++) = 0; 7 | } 8 | -------------------------------------------------------------------------------- /test/compilator/local/c++/2003-11-25-ReturningOpaqueByValue.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | std::vector my_method (); 3 | 4 | int 5 | main () 6 | { 7 | my_method (); 8 | return 0; 9 | } 10 | 11 | -------------------------------------------------------------------------------- /test/validator/c/2012-05-06-SelfInit.c: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S %s -o - | FileCheck %s 2 | #include 3 | char *a = (void*)(uintptr_t)(void*)&a; 4 | // CHECK: @a = global i8* bitcast (i8** @a to i8*) 5 | -------------------------------------------------------------------------------- /test/compilator/local/2007-03-06-VarSizeInStruct1.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc %s -w -S -o - 2 | void* p (int n) { 3 | struct f { 4 | char w; char x[n]; char z[]; 5 | } F; 6 | F.x[0]='x'; 7 | return &F; 8 | } 9 | -------------------------------------------------------------------------------- /test/compilator/local/false.c: -------------------------------------------------------------------------------- 1 | #include 2 | extern "C" void test(); 3 | extern std::string test2(); 4 | int test_main() { 5 | std::cout << "h"; 6 | test(); 7 | std::cout << test2() << '\n'; 8 | } 9 | -------------------------------------------------------------------------------- /test/validator/c/FunctionVariableAlias.c: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S %s -o - | FileCheck %s 2 | // XFAIL: gcc-4.8 3 | 4 | int qux; 5 | void foo(void) __attribute__ ((alias ("qux"))); 6 | // CHECK: @foo = alias i32* @qux 7 | -------------------------------------------------------------------------------- /test/compilator/local/2003-09-30-CommaExprBug.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null 2 | 3 | class Empty {}; 4 | 5 | void foo(Empty E); 6 | 7 | void bar() { 8 | foo(Empty()); 9 | } 10 | 11 | -------------------------------------------------------------------------------- /test/compilator/local/2003-09-30-ForIncrementExprBug.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null 2 | 3 | struct C {}; 4 | 5 | C &foo(); 6 | 7 | void foox() { 8 | for (; ; foo()); 9 | } 10 | 11 | -------------------------------------------------------------------------------- /test/compilator/local/2003-10-21-InnerClass.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc -xc++ -S -o - %s | grep {struct.X::Y} 2 | struct X { 3 | 4 | struct Y { 5 | Y(); 6 | }; 7 | 8 | }; 9 | 10 | X::Y::Y() { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /test/compilator/local/ada/array_size.adb: -------------------------------------------------------------------------------- 1 | procedure Array_Size is 2 | subtype S is String (1 .. 2); 3 | type R is record 4 | A : S; 5 | end record; 6 | X : R; 7 | begin 8 | null; 9 | end; 10 | -------------------------------------------------------------------------------- /test/validator/c++/2004-01-11-DynamicInitializedConstant.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -xc++ -S -o - %s | FileCheck %s 2 | 3 | extern int X; 4 | const int Y = X; 5 | const int* foo() { return &Y; } 6 | // CHECK-NOT: constant 7 | -------------------------------------------------------------------------------- /test/validator/c/LongDoubleSize.c: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S -o /dev/null %s 2 | // RUN: %dragonegg -S -o /dev/null %s -m96bit-long-double 3 | // RUN: %dragonegg -S -o /dev/null %s -m128bit-long-double 4 | long double d; 5 | -------------------------------------------------------------------------------- /test/compilator/local/2008-02-11-AnnotateBuiltin.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc %s -S -o - | llvm-as | llvm-dis | grep llvm.annotation 2 | 3 | int main() { 4 | int x = 0; 5 | return __builtin_annotation(x, "annotate"); 6 | } 7 | 8 | -------------------------------------------------------------------------------- /test/validator/c/BuiltinAssumeAligned.c: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S %s -o - | FileCheck %s 2 | // CHECK-NOT: assume_aligned 3 | // XFAIL: gcc-4.5, gcc-4.6 4 | int *foo(int *p) { 5 | return __builtin_assume_aligned(p, 16); 6 | } 7 | -------------------------------------------------------------------------------- /test/compilator/local/2003-08-24-Cleanup.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgxx -xc++ %s -c -o - | llvm-dis | grep unwind 2 | 3 | struct S { ~S(); }; 4 | 5 | int mightthrow(); 6 | 7 | int test() { 8 | S s; 9 | mightthrow(); 10 | } 11 | -------------------------------------------------------------------------------- /test/compilator/local/2007-02-16-VariableSizeStructArg.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc -S -w %s -o - 2 | // PR1170 3 | int f(int a, struct {int b[a];} c) { return c.b[0]; } 4 | 5 | int g(struct {int b[1];} c) { 6 | return c.b[0]; 7 | } 8 | -------------------------------------------------------------------------------- /test/compilator/local/c++/2009-07-16-PrivateCopyConstructor.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | class A { 4 | public: 5 | A(); 6 | private: 7 | A(const A&); 8 | }; 9 | void B() 10 | { 11 | std::set foo; 12 | } 13 | -------------------------------------------------------------------------------- /test/validator/c++/2012-04-27-Alias.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S %s -o - | FileCheck %s 2 | 3 | struct T { 4 | T() {} 5 | ~T() {} 6 | }; 7 | 8 | T foo() { 9 | T x; 10 | return x; 11 | } 12 | // CHECK-NOT: declare 13 | -------------------------------------------------------------------------------- /test/validator/c/GlobalAlignment.c: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S -o - %s | FileCheck %s 2 | 3 | struct s { 4 | char *a, *b, *c; 5 | }; 6 | 7 | // CHECK: @s1 = {{.*}}, align 8 8 | struct s s1 __attribute__((aligned(8))) = { 0, 0, 0 }; 9 | -------------------------------------------------------------------------------- /test/validator/c/VariableFunctionAlias.c: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S %s -o - | FileCheck %s 2 | // XFAIL: gcc-4.8 3 | 4 | void qux(void) { }; 5 | extern int foo __attribute__ ((alias ("qux"))); 6 | // CHECK: @foo = alias void ()* @qux 7 | -------------------------------------------------------------------------------- /test/compilator/local/2008-11-03-OptionOverride.f90: -------------------------------------------------------------------------------- 1 | ! RUN: %llvmgcc -S %s -march=k8 2 | ! XTARGET: x86 3 | ! Note: this file intentionally left blank, the problem itself is in 4 | ! frontend initialization routines and march flag! 5 | -------------------------------------------------------------------------------- /test/compilator/local/ada/fat_fields.ads: -------------------------------------------------------------------------------- 1 | -- RUN: true 2 | package Fat_Fields is 3 | pragma Elaborate_Body; 4 | type A is array (Positive range <>) of Boolean; 5 | type A_Ptr is access A; 6 | P : A_Ptr := null; 7 | end; 8 | -------------------------------------------------------------------------------- /test/compilator/local/ada/vce_lv.adb: -------------------------------------------------------------------------------- 1 | procedure VCE_LV is 2 | type P is access String ; 3 | type T is new P (5 .. 7); 4 | subtype U is String (5 .. 7); 5 | X : T := new U'(others => 'A'); 6 | begin 7 | null; 8 | end; 9 | -------------------------------------------------------------------------------- /test/validator/c++/2008-01-11-BadWarning.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -xc++ %s -S -o /dev/null 2>&1 | not grep warning 2 | // rdar://5683899 3 | void** f(void **Buckets, unsigned NumBuckets) { 4 | return Buckets + NumBuckets; 5 | } 6 | 7 | -------------------------------------------------------------------------------- /test/validator/fortran/2008-11-03-OptionOverride.f90: -------------------------------------------------------------------------------- 1 | ! RUN: %dragonegg -S %s -march=k8 2 | ! XTARGET: x86 3 | ! Note: this file intentionally left blank, the problem itself is in 4 | ! frontend initialization routines and march flag! 5 | -------------------------------------------------------------------------------- /test/compilator/local/2003-10-17-BoolBitfields.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null 2 | 3 | struct test { 4 | bool A : 1; 5 | bool B : 1; 6 | }; 7 | 8 | void foo(test *T) { 9 | T->B = true; 10 | } 11 | 12 | -------------------------------------------------------------------------------- /test/validator/c++/2009-02-07-VolatileArrayRefHack.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S %s -o - | FileCheck %s 2 | // PR3320 3 | 4 | void test(volatile int *a) { 5 | // should be a volatile load. 6 | a[0]; 7 | // CHECK: load volatile 8 | } 9 | -------------------------------------------------------------------------------- /test/validator/c++/2009-02-16-CtorNames-dbg.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S -g %s -o - | FileCheck %s 2 | class A { 3 | int i; 4 | public: 5 | A() { i = 0; } 6 | ~A() { i = 42; } 7 | // CHECK: A::~A 8 | }; 9 | 10 | A a; 11 | 12 | -------------------------------------------------------------------------------- /test/validator/c++/nullptr_t.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -std=c++0x -g -S -o - %s | FileCheck %s 2 | // XFAIL: gcc-4.5 3 | 4 | // CHECK: [ DW_TAG_unspecified_type ] [decltype(nullptr)] 5 | decltype(nullptr) f() { 6 | return nullptr; 7 | } 8 | -------------------------------------------------------------------------------- /test/validator/c/copysignp.c: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S -o /dev/null %s -msse 2 | // PR12664 3 | 4 | typedef float v4sf __attribute__ ((vector_size (16))); 5 | v4sf foo(v4sf l, v4sf r) { 6 | return __builtin_ia32_copysignps (l, r); 7 | } 8 | -------------------------------------------------------------------------------- /test/compilator/local/ada/var_size.ads: -------------------------------------------------------------------------------- 1 | package Var_Size is 2 | type T (Length : Natural) is record 3 | A : String (1 .. Length); 4 | B : String (1 .. Length); 5 | end record; 6 | function A (X : T) return String; 7 | end; 8 | -------------------------------------------------------------------------------- /test/compilator/local/2003-11-04-CatchLabelName.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null 2 | 3 | #include 4 | 5 | void bar(); 6 | 7 | void test() { 8 | try { 9 | bar(); 10 | } catch (std::string) {} 11 | } 12 | -------------------------------------------------------------------------------- /test/compilator/local/2009-09-04-modify-crash.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgxx %s -fapple-kext -S -o - 2 | // The extra check in 71555 caused this to crash on Darwin X86 3 | // in an assert build. 4 | class foo { 5 | virtual ~foo (); 6 | }; 7 | foo::~foo(){} 8 | -------------------------------------------------------------------------------- /test/compilator/local/pr9652.f: -------------------------------------------------------------------------------- 1 | SUBROUTINE FOO() 2 | 3 | DIMENSION IBUFR(4) 4 | CHARACTER*4 VALUE 5 | 6 | VALUE=CHAR(IBUFR(1))//CHAR(IBUFR(2))// 7 | 1 CHAR(IBUFR(3))//CHAR(IBUFR(4)) 8 | 9 | END 10 | -------------------------------------------------------------------------------- /test/validator/c++/2005-01-03-StaticInitializers.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg %s -S -o - | FileCheck %s 2 | 3 | struct S { 4 | int A[2]; 5 | }; 6 | 7 | int XX = (int)(long)&(((struct S*)0)->A[1]); 8 | 9 | // CHECK-NOT: llvm.global_ctors 10 | -------------------------------------------------------------------------------- /test/validator/c++/2012-03-25-LoadRange.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S -o - %s | FileCheck %s 2 | 3 | bool foo(bool *p) { 4 | return *p; 5 | // CHECK: load i8* {{.*}} !range !0 6 | } 7 | // CHECK: !0 = metadata !{i8 0, i8 2} 8 | -------------------------------------------------------------------------------- /test/validator/c++/nullptr09.C: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -xc++ -S -std=c++0x -o /dev/null %s 2 | // XFAIL: gcc-4.5 3 | // PR14777 4 | void fun() 5 | { 6 | if( nullptr == 0 ); 7 | decltype(nullptr) mynull = 0; 8 | if( mynull == 0 ); 9 | } 10 | -------------------------------------------------------------------------------- /test/compilator/local/2003-08-20-ExceptionFail.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null 2 | 3 | void foo(); 4 | 5 | void bar() { 6 | struct local { 7 | ~local() { foo(); } 8 | } local_obj; 9 | 10 | foo(); 11 | } 12 | 13 | -------------------------------------------------------------------------------- /test/compilator/local/2003-09-30-ForIncrementExprBug2.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null 2 | 3 | // Test with an opaque type 4 | 5 | struct C; 6 | 7 | C &foo(); 8 | 9 | void foox() { 10 | for (; ; foo()); 11 | } 12 | 13 | -------------------------------------------------------------------------------- /test/compilator/local/2003-08-21-EmptyClass.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null 2 | 3 | // This tests compilation of EMPTY_CLASS_EXPR's 4 | 5 | struct empty {}; 6 | 7 | void foo(empty) {} 8 | 9 | void bar() { foo(empty()); } 10 | -------------------------------------------------------------------------------- /test/compilator/local/2007-03-27-ArrayCompatible.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc -S %s -O2 -o - | grep {ret i8 0} 2 | static char c(int n) { 3 | char x[2][n]; 4 | x[1][0]=0; 5 | return *(n+(char *)x); 6 | } 7 | 8 | char d(void) { 9 | return c(2); 10 | } 11 | -------------------------------------------------------------------------------- /test/compilator/local/ada/field_order.ads: -------------------------------------------------------------------------------- 1 | package Field_Order is 2 | type Tagged_Type is abstract tagged null record; 3 | type With_Discriminant (L : Positive) is new Tagged_Type with record 4 | S : String (1 .. L); 5 | end record; 6 | end; 7 | -------------------------------------------------------------------------------- /test/compilator/local/include.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Check that the 'include' options work. 3 | * RUN: echo "int x;\n" > %t1.inc 4 | * RUN: llvmc -include %t1.inc -fsyntax-only %s 5 | * XFAIL: vg_leak 6 | */ 7 | 8 | int f0(void) { 9 | return x; 10 | } 11 | -------------------------------------------------------------------------------- /test/validator/c++/2004-03-09-UnmangledBuiltinMethods.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -xc++ -S -o - %s | FileCheck %s 2 | 3 | struct AccessFlags { 4 | void strlen(); 5 | }; 6 | 7 | void AccessFlags::strlen() { } 8 | // CHECK: define void @_ZN11AccessFlags6strlenEv 9 | -------------------------------------------------------------------------------- /test/validator/c++/2007-07-29-RestrictRefArg.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S %s -o - | FileCheck %s 2 | 3 | void foo(int & __restrict myptr1, int & myptr2) { 4 | // CHECK: @_Z3fooRiS_(i32* noalias %myptr1, i32* %myptr2) 5 | myptr1 = 0; 6 | myptr2 = 0; 7 | } 8 | -------------------------------------------------------------------------------- /test/compilator/local/2003-11-04-ArrayConstructors.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null 2 | 3 | 4 | struct Foo { 5 | Foo(int); 6 | ~Foo(); 7 | }; 8 | void foo() { 9 | struct { 10 | Foo name; 11 | } Int[] = { 1 }; 12 | } 13 | -------------------------------------------------------------------------------- /test/compilator/local/2003-11-25-ReturningOpaqueByValue.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null 2 | 3 | #include 4 | std::vector my_method (); 5 | 6 | int 7 | main () 8 | { 9 | my_method (); 10 | return 0; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /test/compilator/local/pr9726.c: -------------------------------------------------------------------------------- 1 | void output_vtk (int nx1, int nx2, int big_end, double **input, float *output) { 2 | int i, j; 3 | for (j = 0; j < nx2; j++) 4 | for (i = 0; i < nx1; i++) 5 | output[i] = (float) input[j][i]; 6 | use(output); 7 | } 8 | -------------------------------------------------------------------------------- /test/dragonegg-lit.site.cfg.in: -------------------------------------------------------------------------------- 1 | config.dragonegg_plugin = "@DRAGONEGG_PLUGIN@" 2 | config.gcc_executable = "@GCC@" 3 | config.llvm_tools_dir = "@LLVM_TOOLS_DIR@" 4 | config.target_triple = "@TARGET_TRIPLE@" 5 | config.test_output_dir = "@TEST_OUTPUT_DIR@" 6 | -------------------------------------------------------------------------------- /test/validator/ada/abi_overflow.adb: -------------------------------------------------------------------------------- 1 | -- RUN: %dragonegg -S -O2 %s -o - | FileCheck %s 2 | 3 | package body ABI_Overflow is 4 | procedure Foo (X : T) is 5 | -- CHECK: foo 6 | -- CHECK-NOT: store i64 7 | begin 8 | null; 9 | end; 10 | end; 11 | -------------------------------------------------------------------------------- /test/validator/c++/2007-07-29-RestrictPtrArg.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S %s -o - | FileCheck %s 2 | 3 | void foo(int * __restrict myptr1, int * myptr2) { 4 | // CHECK: @_Z3fooPiS_(i32* noalias %myptr1, i32* %myptr2) 5 | myptr1[0] = 0; 6 | myptr2[0] = 0; 7 | } 8 | -------------------------------------------------------------------------------- /test/compilator/local/2003-09-22-CompositeExprValue.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null 2 | 3 | struct duration { 4 | duration operator/=(int c) { 5 | return *this; 6 | } 7 | }; 8 | 9 | void a000090() { 10 | duration() /= 1; 11 | } 12 | -------------------------------------------------------------------------------- /test/compilator/local/c/2012-04-20-PointerBIT_AND_EXPR.c: -------------------------------------------------------------------------------- 1 | testvacld (int n, ...) 2 | { 3 | __builtin_va_list ap; 4 | __builtin_va_start (ap, n); 5 | _Complex long double t = 6 | __builtin_va_arg (ap, _Complex long double); 7 | __builtin_va_end (ap); 8 | } 9 | -------------------------------------------------------------------------------- /test/validator/objc/2008-11-12-Metadata.m: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -x objective-c -S %s -o /dev/null 2 | 3 | @interface A 4 | @end 5 | @protocol P 6 | @end 7 | @interface B : A

8 | { 9 | } 10 | @end 11 | @implementation B 12 | - (void)test { 13 | } 14 | @end 15 | -------------------------------------------------------------------------------- /test/validator/c++/EmptyBlock.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S -o /dev/null %s -O1 2 | // GCC PR c++/11878 3 | 4 | struct A 5 | { 6 | virtual ~A(); 7 | }; 8 | 9 | template struct B 10 | { 11 | T t; 12 | }; 13 | 14 | void foo() { throw B().t; } 15 | -------------------------------------------------------------------------------- /test/validator/c++/nullptr01.C: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -xc++ -S -std=c++0x -o /dev/null %s 2 | // XFAIL: gcc-4.5 3 | // PR14777 4 | char* const cp1 = nullptr; 5 | char* const cp2 = __null; 6 | char* const cp3 = 0; 7 | decltype(nullptr) mynull = 0; 8 | char* const cp4 = mynull; 9 | -------------------------------------------------------------------------------- /test/validator/c/trampoline-warning.c: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg %s -S -Wtrampolines 2>&1 | FileCheck %s 2 | // CHECK: trampoline generated for nested function 3 | // XFAIL: gcc-4.5 4 | void use(int(*)(void)); 5 | void f(int i) { 6 | int k(void) { return i; } 7 | use(k); 8 | } 9 | -------------------------------------------------------------------------------- /test/validator/c/InternVariableWeakref.c: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S %s -o - | FileCheck %s 2 | 3 | int bar; 4 | static int variable_weakref __attribute__ ((weakref("bar"))); 5 | int *use_variable = &variable_weakref; 6 | 7 | // CHECK: @use_variable = unnamed_addr global i32* @bar 8 | -------------------------------------------------------------------------------- /test/compilator/local/2003-11-08-ArrayAddress.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgxx -xc++ %s -c -o - | llvm-dis | grep getelementptr 2 | 3 | struct foo { 4 | int array[100]; 5 | void *getAddr(unsigned i); 6 | }; 7 | 8 | void *foo::getAddr(unsigned i) { 9 | return &array[i]; 10 | } 11 | -------------------------------------------------------------------------------- /test/compilator/local/2005-10-18-VariableSizedElementCrash.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc %s -S -o - 2 | 3 | int sub1(int i, char *pi) { 4 | typedef int foo[i]; 5 | struct bar {foo f1; int f2:3; int f3:4;} *p = (struct bar *) pi; 6 | xxx(p->f1); 7 | return p->f3; 8 | } 9 | 10 | -------------------------------------------------------------------------------- /test/validator/ada/real_cst.adb: -------------------------------------------------------------------------------- 1 | -- RUN: %dragonegg -S -O2 -gnatn %s 2 | package body Real_Cst is 3 | Cst : constant Float := 0.0; 4 | procedure Write (Stream : access Ada.Streams.Root_Stream_Type'Class) is 5 | begin 6 | Float'Write (Stream, Cst); 7 | end; 8 | end; 9 | -------------------------------------------------------------------------------- /test/validator/c/2012-10-01-Alloca.c: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S %s -o - | FileCheck %s 2 | // XFAIL: gcc-4.7, gcc-4.8 3 | 4 | void use(int*); 5 | 6 | void foo(int n, int i) { 7 | // CHECK: foo 8 | int a[n]; 9 | // CHECK: alloca i8, i{{.*}}, align 16 10 | use(&a[i]); 11 | } 12 | -------------------------------------------------------------------------------- /test/compilator/local/2006-09-27-Debug-Protection.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgxx -O0 -S -g -o - %s | grep {i32 1,} 2 | // RUN: %llvmgxx -O0 -S -g -o - %s | grep {i32 2,} 3 | class A { 4 | public: 5 | int x; 6 | protected: 7 | int y; 8 | private: 9 | int z; 10 | }; 11 | 12 | A a; 13 | -------------------------------------------------------------------------------- /test/compilator/local/ada/debug_var_size.ads: -------------------------------------------------------------------------------- 1 | package Debug_Var_Size is 2 | subtype Length_Type is Positive range 1 .. 64; 3 | type T (Length : Length_Type := 1) is record 4 | Varying_Length : String (1 .. Length); 5 | Fixed_Length : Boolean; 6 | end record; 7 | end; 8 | -------------------------------------------------------------------------------- /test/compilator/local/ada/unc_constructor.ads: -------------------------------------------------------------------------------- 1 | package Unc_Constructor is 2 | type C is null record; 3 | type A is array (Positive range <>) of C; 4 | A0 : constant A; 5 | procedure P (X : A); 6 | private 7 | A0 : aliased constant A := (1 .. 0 => (null record)); 8 | end; 9 | -------------------------------------------------------------------------------- /test/compilator/local/commoncap.i: -------------------------------------------------------------------------------- 1 | typedef _Bool bool; 2 | struct linux_binprm 3 | { 4 | unsigned int cred_prepared:1, cap_effective:1; 5 | }; 6 | int 7 | cap_bprm_set_creds (struct linux_binprm *bprm) 8 | { 9 | bool effective; 10 | bprm->cap_effective = effective; 11 | } 12 | -------------------------------------------------------------------------------- /test/compilator/local/opt-test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Check that the -opt switch works. 3 | * RUN: llvmc %s -opt -o %t 4 | * RUN: %abs_tmp | grep hello 5 | * XFAIL: vg_leak 6 | */ 7 | 8 | #include 9 | 10 | int main() { 11 | printf("hello\n"); 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /test/compilator/local/together.cpp: -------------------------------------------------------------------------------- 1 | // Check that we can compile files of different types together. 2 | // RUN: llvmc %s %p/../test_data/together.c -o %t 3 | // RUN: %abs_tmp | grep hello 4 | // XFAIL: vg 5 | 6 | extern "C" void test(); 7 | 8 | int main() { 9 | test(); 10 | } 11 | -------------------------------------------------------------------------------- /test/compilator/local/wall.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Check that -Wall works as intended 3 | * RUN: llvmc -Wall %s -o %t 4 | * RUN: %abs_tmp | grep hello 5 | * XFAIL: vg_leak 6 | */ 7 | 8 | #include 9 | 10 | int main() { 11 | printf("hello\n"); 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /test/compilator/local/2007-11-27-SExtZExt.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc -S %s -o - | grep "signext" | count 4 2 | 3 | signed char foo1() { return 1; } 4 | 5 | void foo2(signed short a) { } 6 | 7 | signed char foo3(void) { return 1; } 8 | 9 | void foo4(a) signed short a; { } 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /test/compilator/local/c++/2004-09-27-CompilerCrash.cpp: -------------------------------------------------------------------------------- 1 | struct Pass {} ; 2 | template 3 | Pass *callDefaultCtor() { return new PassName(); } 4 | 5 | void foo(Pass *(*C)()); 6 | 7 | #include 8 | 9 | bool foo(std::string &X) { 10 | return X.empty(); 11 | } 12 | -------------------------------------------------------------------------------- /test/compilator/local/just-compile.cpp: -------------------------------------------------------------------------------- 1 | // Test that the -c flag works. 2 | // RUN: llvmc -c %s -o %t.o 3 | // RUN: llvmc --linker=c++ %t.o -o %t 4 | // RUN: %abs_tmp | grep hello 5 | // XFAIL: vg 6 | #include 7 | 8 | int main() { 9 | std::cout << "hello" << '\n'; 10 | } 11 | -------------------------------------------------------------------------------- /test/validator/c/2012-06-05-Alloca.c: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S %s -o - | FileCheck %s 2 | // PR13025 3 | // XFAIL: gcc-4.5, gcc-4.6 4 | 5 | void use(int*); 6 | 7 | void foo(int n, int i) { 8 | // CHECK: foo 9 | int a[n]; 10 | // CHECK: alloca i8, i{{.*}}, align 4 11 | use(&a[i]); 12 | } 13 | -------------------------------------------------------------------------------- /test/compilator/local/ada/switch.adb: -------------------------------------------------------------------------------- 1 | function Switch (N : Integer) return Integer is 2 | begin 3 | case N is 4 | when Integer'First .. -1 => 5 | return -1; 6 | when 0 => 7 | return 0; 8 | when others => 9 | return 1; 10 | end case; 11 | end; 12 | -------------------------------------------------------------------------------- /test/compilator/local/ada/var_offset.ads: -------------------------------------------------------------------------------- 1 | package Var_Offset is 2 | pragma Elaborate_Body; 3 | type T (L : Natural) is record 4 | Var_Len : String (1 .. L); 5 | Space : Integer; 6 | Small : Character; 7 | Bad_Field : Character; 8 | end record; 9 | end; 10 | -------------------------------------------------------------------------------- /test/compilator/local/c++/2007-04-31-TryCatch.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace std 4 | { 5 | codecvt:: 6 | codecvt(size_t __refs) 7 | : __codecvt_abstract_base(__refs), 8 | _M_c_locale_codecvt(_S_get_c_locale()) 9 | { } 10 | } 11 | -------------------------------------------------------------------------------- /test/compilator/local/sink.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Check that the 'sink' options work. 3 | * RUN: llvmc -v -Wall %s -o %t |& grep "Wall" 4 | * RUN: %abs_tmp | grep hello 5 | * XFAIL: vg_leak 6 | */ 7 | 8 | #include 9 | 10 | int main() { 11 | printf("hello\n"); 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /test/validator/c++/2012-04-13-EnumRange.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -fstrict-enums -S -o - %s | FileCheck %s 2 | // XFAIL: gcc-4.5 3 | 4 | enum A { alpha, beta } a; 5 | 6 | int foo() { 7 | return a; 8 | // CHECK: load i32* @a,{{.*}} !range !0 9 | // CHECK: !0 = metadata !{i32 0, i32 2} 10 | } 11 | -------------------------------------------------------------------------------- /test/validator/objc/2007-10-23-GC-WriteBarrier.m: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -x objective-c -S %s -o /dev/null -fobjc-gc 2 | // rdar://5541393 3 | 4 | typedef unsigned int NSUInteger; 5 | __attribute__((objc_gc(strong))) float *_scores; 6 | 7 | void foo(int i, float f) { 8 | _scores[i] = f; 9 | } 10 | -------------------------------------------------------------------------------- /test/compilator/local/2003-08-27-TypeNamespaces.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null 2 | 3 | 4 | namespace foo { 5 | namespace bar { 6 | struct X { X(); }; 7 | 8 | X::X() {} 9 | } 10 | } 11 | 12 | 13 | namespace { 14 | struct Y { Y(); }; 15 | Y::Y() {} 16 | } 17 | -------------------------------------------------------------------------------- /test/compilator/local/2007-02-16-WritableStrings.c: -------------------------------------------------------------------------------- 1 | // Test the -fwritable-strings option. 2 | 3 | // RUN: %llvmgcc -O3 -S -o - -fwritable-strings %s | \ 4 | // RUN: grep {internal unnamed_addr global} 5 | // RUN: %llvmgcc -O3 -S -o - %s | grep {private unnamed_addr constant} 6 | 7 | char *X = "foo"; 8 | -------------------------------------------------------------------------------- /test/validator/c/ExternVariableWeakref.c: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S %s -o - | FileCheck %s 2 | 3 | static int variable_weakref __attribute__ ((weakref("bar"))); 4 | int *use_variable = &variable_weakref; 5 | 6 | // CHECK: @use_variable = unnamed_addr global i32* @bar 7 | // CHECK: @bar = extern_weak global i32 8 | -------------------------------------------------------------------------------- /test/compilator/local/2006-05-01-AppleAlignmentPragma.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc %s -S -o - 2 | 3 | #ifdef __APPLE__ 4 | /* test that X is layed out correctly when this pragma is used. */ 5 | #pragma options align=mac68k 6 | #endif 7 | 8 | struct S { 9 | unsigned A; 10 | unsigned short B; 11 | } X; 12 | 13 | -------------------------------------------------------------------------------- /test/compilator/local/vla-1.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc_only -std=gnu99 %s -S |& grep {warning: alignment for} 2 | // ppc does not support this feature, and gets a fatal error at runtime. 3 | // XFAIL: powerpc 4 | 5 | int foo(int a) 6 | { 7 | int var[a] __attribute__((__aligned__(32))); 8 | return 4; 9 | } 10 | -------------------------------------------------------------------------------- /test/validator/c++/2005-02-13-BadDynamicInit.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg %s -S -o - | FileCheck %s 2 | // This testcase corresponds to PR509 3 | struct Data { 4 | unsigned *data; 5 | unsigned array[1]; 6 | }; 7 | 8 | Data shared_null = { shared_null.array }; 9 | 10 | // CHECK-NOT: llvm.global_ctors 11 | -------------------------------------------------------------------------------- /test/validator/c/InternFunctionWeakref.c: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S %s -o - | FileCheck %s 2 | 3 | int foo(int x) { return x; } 4 | static void function_weakref(void) __attribute__ ((weakref("foo"))); 5 | void *use_function = (void *)function_weakref; 6 | 7 | // CHECK: @use_function = unnamed_addr global {{.*}} @foo 8 | -------------------------------------------------------------------------------- /test/compilator/local/ada/array_ref.adb: -------------------------------------------------------------------------------- 1 | procedure Array_Ref is 2 | type A is array (Natural range <>, Natural range <>) of Boolean; 3 | type A_Access is access A; 4 | function Get (X : A_Access) return Boolean is 5 | begin 6 | return X (0, 0); 7 | end; 8 | begin 9 | null; 10 | end; 11 | -------------------------------------------------------------------------------- /test/compilator/local/tramp.c: -------------------------------------------------------------------------------- 1 | void use(void(*)(void)); 2 | int g(int); 3 | 4 | int f(int x) { 5 | int y; 6 | 7 | void k(void) { 8 | y = g(y); 9 | } 10 | 11 | void l(void) { 12 | use(k); 13 | y = g(y); 14 | } 15 | 16 | y = g(x); 17 | use(k); 18 | use(l); 19 | return y; 20 | } 21 | -------------------------------------------------------------------------------- /test/compilator/local/2003-08-29-ArgPassingBug.cpp: -------------------------------------------------------------------------------- 1 | 2 | // RUN: %llvmgcc -xc++ -c -o /dev/null %s |& not grep WARNING 3 | 4 | struct iterator { 5 | iterator(); 6 | iterator(const iterator &I); 7 | }; 8 | 9 | iterator foo(const iterator &I) { return I; } 10 | 11 | void test() { 12 | foo(iterator()); 13 | } 14 | -------------------------------------------------------------------------------- /test/validator/c/ExternFunctionWeakref.c: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S %s -o - | FileCheck %s 2 | 3 | static void function_weakref(void) __attribute__ ((weakref("foo"))); 4 | void *use_function = (void *)function_weakref; 5 | 6 | // CHECK: @use_function = unnamed_addr global {{.*}} @foo 7 | // CHECK: declare extern_weak void @foo() 8 | -------------------------------------------------------------------------------- /test/validator/c/NoIROptimize.c: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S -O3 -fplugin-arg-dragonegg-llvm-ir-optimize=0 -fplugin-arg-dragonegg-debug-pass-arguments %s 2>&1 | FileCheck %s 2 | 3 | // CHECK-NOT: inline 4 | 5 | inline __attribute__ ((__always_inline__)) void foo(void) {} 6 | void bar(void) { foo(); } 7 | void qaz(void) { bar(); } 8 | -------------------------------------------------------------------------------- /test/compilator/local/2010-03-10-arm-asmreg.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc %s -S -O0 -o - | FileCheck %s 2 | // pr6552 3 | 4 | // XFAIL: * 5 | // XTARGET: arm 6 | 7 | extern void bar(unsigned int ip); 8 | 9 | // CHECK: mov r0, r12 10 | void foo(void) 11 | { 12 | register unsigned int ip __asm ("ip"); 13 | bar(ip); 14 | } 15 | 16 | -------------------------------------------------------------------------------- /test/validator/c++/2005-02-14-BitFieldOffset.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg %s -S -o - | FileCheck %s 2 | 3 | struct QVectorTypedData { 4 | int size; 5 | unsigned int sharable : 1; 6 | unsigned short array[1]; 7 | }; 8 | 9 | void foo(QVectorTypedData *X) { 10 | X->array[0] = 123; 11 | } 12 | // CHECK-NOT: i32 6 13 | -------------------------------------------------------------------------------- /test/compilator/local/2009-08-11-AsmBlocksComplexJumpTarget.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc %s -fasm-blocks -S -o - | grep {\\\*1192} 2 | // Complicated expression as jump target 3 | // XFAIL: * 4 | // XTARGET: x86,i386,i686 5 | 6 | asm void Method3() 7 | { 8 | mov eax,[esp+4] 9 | jmp [eax+(299-1)*4] 10 | } 11 | -------------------------------------------------------------------------------- /test/validator/c++/2007-08-01-RestrictMethod.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S %s -o - | FileCheck %s 2 | 3 | class foo { 4 | int member[4]; 5 | 6 | void bar(int * a); 7 | 8 | }; 9 | 10 | void foo::bar(int * a) __restrict { 11 | // CHECK: @_ZN3foo3barEPi(%struct.foo* noalias %this, i32* %a) 12 | member[3] = *a; 13 | } 14 | -------------------------------------------------------------------------------- /test/validator/c++/nullptr05.C: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -xc++ -S -std=c++0x -o /dev/null %s 2 | // XFAIL: gcc-4.5 3 | // PR14777 4 | class F { }; 5 | 6 | typedef void (F::*pmf)(); 7 | 8 | const pmf pmf1 = nullptr; 9 | const pmf pmf2 = __null; 10 | const pmf pmf3 = 0; 11 | decltype(nullptr) mynull = 0; 12 | const pmf pmf4 = mynull; 13 | -------------------------------------------------------------------------------- /test/compilator/local/2003-11-18-EnumArray.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null 2 | 3 | enum TchkType { 4 | tchkNum, tchkString, tchkSCN, tchkNone 5 | }; 6 | 7 | struct Operator { 8 | enum TchkType tchk[8]; 9 | }; 10 | 11 | struct Operator opTab[] = { 12 | {{tchkNum, tchkNum, tchkString} } 13 | }; 14 | 15 | -------------------------------------------------------------------------------- /test/compilator/local/2007-05-07-NestedStructReturn.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc %s -S -fnested-functions -o - | grep {sret *%agg.result} 2 | 3 | struct X { long m, n, o, p; }; 4 | 5 | struct X p(int n) { 6 | struct X c(int m) { 7 | struct X x; 8 | x.m = m; 9 | x.n = n; 10 | return x; 11 | } 12 | return c(n); 13 | } 14 | -------------------------------------------------------------------------------- /test/validator/c++/2007-05-23-TryFinally.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg %s -S -O2 -o - | FileCheck %s 2 | 3 | struct One { }; 4 | struct Two { }; 5 | 6 | void handle_unexpected () { 7 | // CHECK: resume 8 | // CHECK: resume 9 | try 10 | { 11 | throw; 12 | } 13 | catch (One &) 14 | { 15 | throw Two (); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/validator/c/EmptyBlock.c: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S -o /dev/null %s 2 | 3 | void *buf[20]; 4 | 5 | sub2 (void) 6 | { 7 | __builtin_longjmp (buf, 1); 8 | } 9 | 10 | double 11 | bar (int arg) 12 | { 13 | foo (arg); 14 | __builtin_return (__builtin_apply ((void (*) ()) foo, 15 | __builtin_apply_args (), 16)); 16 | } 17 | -------------------------------------------------------------------------------- /test/validator/c/StackProtector.c: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S -o - %s -fstack-protector --param ssp-buffer-size=1 | FileCheck --check-prefix=SP %s 2 | // RUN: %dragonegg -S -o - %s -fno-stack-protector | FileCheck --check-prefix=NP %s 3 | void foo(void) {} 4 | // SP: attributes {{.*}} "stack-protector-buffer-size"="1" 5 | // NP-NOT: stack-protector 6 | -------------------------------------------------------------------------------- /test/compilator/local/2004-11-27-VariableSizeInStructure.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc %s -S -o /dev/null 2 | 3 | // GCC allows variable sized arrays in structures, crazy! 4 | 5 | // This is PR360. 6 | 7 | int sub1(int i, char *pi) { 8 | typedef int foo[i]; 9 | struct bar {foo f1; int f2;} *p = (struct bar *) pi; 10 | return p->f2; 11 | } 12 | -------------------------------------------------------------------------------- /test/compilator/local/2007-12-VarArrayDebug.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc -S -g -O %s -o - | llc 2 | // RUN: %llvmgcc -S -g %s -o - | llc 3 | 4 | extern void foo (void); 5 | 6 | static 7 | void baz (int i) 8 | { 9 | foo (); 10 | typedef char A[i]; 11 | struct { A b; } *x = 0; 12 | } 13 | 14 | void 15 | bar (i) 16 | { 17 | baz (i); 18 | } 19 | -------------------------------------------------------------------------------- /test/validator/objc/2009-02-05-VolatileProp.m: -------------------------------------------------------------------------------- 1 | /* RUN: %dragonegg -fobjc-exceptions -w -x objective-c -S %s -o /dev/null -pedantic-errors 2 | rdar://6551276 */ 3 | 4 | void foo(const unsigned short *); 5 | void bar() { 6 | unsigned short *s[3]; 7 | int i; 8 | @try { } @catch (id anException) { } 9 | foo(2+s[i]); 10 | } 11 | 12 | -------------------------------------------------------------------------------- /test/compilator/local/2004-09-27-CompilerCrash.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null 2 | 3 | struct Pass {} ; 4 | template 5 | Pass *callDefaultCtor() { return new PassName(); } 6 | 7 | void foo(Pass *(*C)()); 8 | 9 | #include 10 | 11 | bool foo(std::string &X) { 12 | return X.empty(); 13 | } 14 | -------------------------------------------------------------------------------- /test/compilator/local/ada/non_bitfield.ads: -------------------------------------------------------------------------------- 1 | package Non_Bitfield is 2 | type SP is access String; 3 | type E is (A, B, C); 4 | type T (D : E) is record 5 | case D is 6 | when A => X : Boolean; 7 | when B => Y : SP; 8 | when C => Z : String (1 .. 2); 9 | end case; 10 | end record; 11 | end; 12 | -------------------------------------------------------------------------------- /test/compilator/local/ptr-rotate.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc %s -S -m32 -o /dev/null 2 | // RUN: %llvmgcc %s -S -O1 -m32 -o - | llc -march=x86 -mtriple=i386-apple-darwin9.7 | FileCheck %s -check-prefix=DARWIN 3 | 4 | unsigned int func(void *A) { 5 | // DARWIN: roll $27 6 | return ((((unsigned long long) A) >> 5) | (((unsigned long long) A) << 27)); 7 | } 8 | -------------------------------------------------------------------------------- /test/compilator/local/2003-09-30-NestedFunctionDecl.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null 2 | 3 | // The C++ front-end thinks the two foo's are different, the LLVM emitter 4 | // thinks they are the same. The disconnect causes problems. 5 | 6 | void foo() { } 7 | 8 | void bar() { 9 | void foo(); 10 | 11 | foo(); 12 | } 13 | -------------------------------------------------------------------------------- /test/compilator/local/2003-10-27-VirtualBaseClassCrash.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null 2 | 3 | 4 | template 5 | struct super { 6 | int Y; 7 | void foo(); 8 | }; 9 | 10 | template 11 | struct test : virtual super {}; 12 | 13 | extern test X; 14 | 15 | void foo() { 16 | X.foo(); 17 | } 18 | -------------------------------------------------------------------------------- /test/compilator/local/ada/non_lvalue.ads: -------------------------------------------------------------------------------- 1 | package Non_LValue is 2 | type T (Length : Natural) is record 3 | A : String (1 .. Length); 4 | B : String (1 .. Length); 5 | end record; 6 | type T_Ptr is access all T; 7 | type U is record 8 | X : T_Ptr; 9 | end record; 10 | function A (Y : U) return String; 11 | end; 12 | -------------------------------------------------------------------------------- /test/validator/c++/nullptr08.C: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -xc++ -S -std=c++0x -o /dev/null %s 2 | // XFAIL: gcc-4.5 3 | // PR14777 4 | #define assert_true(b) do { char c[2 * bool(b) - 1]; } while(0) 5 | 6 | void fun() 7 | { 8 | assert_true(nullptr ? false : true); 9 | decltype(nullptr) mynull = 0; 10 | assert_true(mynull ? false : true); 11 | } 12 | -------------------------------------------------------------------------------- /test/compilator/local/ada/init_size.ads: -------------------------------------------------------------------------------- 1 | package Init_Size is 2 | type T (B : Boolean := False) is record 3 | case B is 4 | when False => 5 | I : Integer; 6 | when True => 7 | J : Long_Long_Integer; -- Bigger than I 8 | end case; 9 | end record; 10 | A_T : constant T := (False, 0); 11 | end; 12 | -------------------------------------------------------------------------------- /test/validator/ada/element_copy.ads: -------------------------------------------------------------------------------- 1 | -- RUN: true 2 | package Element_Copy is 3 | type SmallInt is range 1 .. 4; 4 | type SmallStr is array (SmallInt range <>) of Character; 5 | type VariableSizedField (D : SmallInt := 2) is record 6 | S : SmallStr (1 .. D) := "Hi"; 7 | end record; 8 | function F return VariableSizedField; 9 | end; 10 | -------------------------------------------------------------------------------- /test/validator/c++/2012-12-08-Padding.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S %s -o - -std=c++11 | FileCheck %s 2 | // PR11742 3 | // This construct is not supported by gcc-4.6 and earlier. 4 | // XFAIL: gcc-4.5, gcc-4.6 5 | 6 | struct S { char c = 1; __attribute__((aligned(8))) char d = 2; } s = S(); 7 | char k = ((char*)&s)[1] + 1; 8 | 9 | // CHECK-NOT: undef 10 | -------------------------------------------------------------------------------- /test/validator/c++/MRVAlignment.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg %s -S -o - | FileCheck %s 2 | // XFAIL: i386, i486, i586, i686 3 | 4 | struct P { 5 | char a; 6 | unsigned b; 7 | unsigned c; 8 | unsigned d; 9 | }; 10 | 11 | void bar(const P&); 12 | P qaz(); 13 | void foo() { 14 | bar(qaz()); 15 | // CHECK: store i64 %mrv_gr2, {{.*}}, align 1 16 | } 17 | -------------------------------------------------------------------------------- /test/validator/c++/2004-11-27-EmitsUnusedInlineFunctions.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg %s -S -o - | FileCheck %s 2 | // The C++ front-end was emitting WAY too many inline functions. This test 3 | // verifies that it does not emit the body of getchar, because it is not used. 4 | // This corresponds to PR459 5 | 6 | #include 7 | // CHECK-NOT: define {{.*}}getchar 8 | -------------------------------------------------------------------------------- /test/validator/c/rdrand-builtins-64.c: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S %s -o - -mrdrnd | FileCheck %s 2 | // XFAIL: gcc-4.5, i386, i486, i586, i686 3 | 4 | #include 5 | 6 | int rdrand64(unsigned long long *p) { 7 | return _rdrand64_step(p); 8 | // CHECK: @rdrand64 9 | // CHECK: call { i64, i32 } @llvm.x86.rdrand.64 10 | // CHECK: store i64 11 | } 12 | -------------------------------------------------------------------------------- /test/validator/objc/2007-10-18-ProDescriptor.m: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -x objective-c -S %s -o /dev/null 2 | @protocol O 3 | @end 4 | @interface O < O > { 5 | } 6 | @end 7 | struct A { 8 | }; 9 | @protocol AB 10 | - (unsigned) ver; 11 | @end 12 | @interface AGy:O < AB > { 13 | } 14 | @end 15 | @implementation AGy 16 | - (unsigned) ver { 17 | } 18 | @end 19 | 20 | -------------------------------------------------------------------------------- /test/compilator/local/emit-llvm-opt.c: -------------------------------------------------------------------------------- 1 | // Check that -emit-llvm [-S] works with -opt. 2 | 3 | // RUN: llvmc -c -opt -emit-llvm -o - %s | llvm-dis | grep "@f0()" | count 1 4 | // RUN: llvmc -c -opt -emit-llvm -S -o - %s | grep "@f0()" | count 1 5 | // RUN: llvmc --dry-run -c -opt -emit-llvm %s |& grep "^opt" 6 | // XFAIL: vg_leak 7 | 8 | int f0(void) { 9 | } 10 | -------------------------------------------------------------------------------- /test/validator/BitfieldRefAlignment.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S %s -o - | FileCheck %s 2 | // Overaligned load of field bf. 3 | 4 | struct S { 5 | char s; 6 | char bf : 3; 7 | }; 8 | 9 | void bar(S &); 10 | 11 | void foo(S &rhs) { 12 | if (rhs.bf == 0) 13 | bar(rhs); 14 | // CHECK: load i8* {{.*}}, align 1 15 | } 16 | -------------------------------------------------------------------------------- /test/validator/c++/2007-03-27-FunctionVarRename.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg %s -S -o - | FileCheck %s 2 | // Only one eprintf should exist in the output 3 | // CHECK-NOT: eprintf1 4 | 5 | extern "C" 6 | void __eprintf(); 7 | 8 | void foo() { 9 | 10 | __eprintf(); 11 | } 12 | 13 | void *bar() { 14 | extern void *__eprintf; 15 | return &__eprintf; 16 | } 17 | -------------------------------------------------------------------------------- /test/compilator/local/dash-x.cpp: -------------------------------------------------------------------------------- 1 | // Test that we can compile .c files as C++ and vice versa 2 | // RUN: llvmc %s -x c++ %p/../test_data/false.c -x c %p/../test_data/false.cpp -x lisp -x whatnot -x none %p/../test_data/false2.cpp -o %t 3 | // RUN: %abs_tmp | grep hello 4 | // XFAIL: vg 5 | 6 | extern int test_main(); 7 | 8 | int main() { 9 | test_main(); 10 | } 11 | -------------------------------------------------------------------------------- /test/compilator/local/nested-functions.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc -S %s -o - -fnested-functions 2 | // PR1274 3 | 4 | void Bork() { 5 | void Fork(const int *src, int size) { 6 | int i = 1; 7 | int x; 8 | 9 | while (i < size) 10 | x = src[i]; 11 | } 12 | } 13 | 14 | void foo(void *a){ 15 | inline void foo_bar() { 16 | a += 1; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/validator/c++/nullptr06.C: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -xc++ -S -std=c++0x -o /dev/null %s 2 | // XFAIL: gcc-4.5 3 | // PR14777 4 | #define assert_true(b) do { char c[2 * bool(b) - 1]; } while(0) 5 | 6 | char* const cp1 = nullptr; 7 | 8 | void fun() 9 | { 10 | assert_true(cp1 == nullptr); 11 | decltype(nullptr) mynull = 0; 12 | assert_true(cp1 == mynull); 13 | } 14 | -------------------------------------------------------------------------------- /test/validator/c/vectorizer.c: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S %s -o - -O3 -msse | FileCheck -check-prefix=VON %s 2 | // RUN: %dragonegg -S %s -o - -O3 -msse -fno-tree-vectorize | FileCheck -check-prefix=VOFF %s 3 | // VON: fadd < 4 | // VOFF-NOT: fadd < 5 | 6 | void bar(float *A, float* B, float K) { 7 | int i; 8 | for (i = 0; i < 64; ++i) 9 | A[i] *= B[i] + K; 10 | } 11 | -------------------------------------------------------------------------------- /test/compilator/local/cstring-align.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc %s -S -Os -o - | llc -march=x86 -mtriple=i386-apple-darwin10 | FileCheck %s 2 | 3 | extern void func(const char *, const char *); 4 | 5 | void long_function_name() { 6 | func("%s: the function name", __func__); 7 | } 8 | 9 | // CHECK: .align 4 10 | // CHECK: ___func__. 11 | // CHECK: .asciz "long_function_name" 12 | -------------------------------------------------------------------------------- /test/validator/ada/empty_type.adb: -------------------------------------------------------------------------------- 1 | -- RUN: %dragonegg -S -O1 %s 2 | procedure Empty_Type is 3 | type Rec (Disc : Integer := 1) is 4 | record 5 | case Disc is 6 | when 1..0 => -- Empty range 7 | Component : Integer; 8 | when others => NULL; 9 | end case; 10 | end record; 11 | R : Rec; 12 | begin 13 | null; 14 | end; 15 | -------------------------------------------------------------------------------- /test/validator/c/VariableAlias.c: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S %s -o - | FileCheck %s 2 | 3 | int qux; 4 | extern int foo __attribute__ ((alias ("qux"))); 5 | // CHECK: @foo = alias i32* @qux 6 | extern int bar __attribute__ ((weak, alias ("foo"))); 7 | // CHECK: @bar = weak alias i32* @qux 8 | extern int baz __attribute__ ((alias ("bar"))); 9 | // CHECK: @baz = alias i32* @qux 10 | -------------------------------------------------------------------------------- /test/validator/c++/2003-11-02-WeakLinkage.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -xc++ -S -o - %s | FileCheck %s 2 | // The template should compile to linkonce linkage, not weak linkage. 3 | 4 | template 5 | void thefunc(); 6 | 7 | template 8 | inline void thefunc() {} 9 | // CHECK: linkonce_odr void @_Z7thefuncIiEvv 10 | 11 | void test() { 12 | thefunc(); 13 | } 14 | 15 | -------------------------------------------------------------------------------- /test/validator/c/2012-09-10-MRVOverflow.c: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S %s -o - | FileCheck %s 2 | // Check that the MRV code doesn't load from beyond the end of an alloca. 3 | // XFAIL: i386, i486, i586, i686 4 | 5 | struct Three { int a; int b; int c; }; 6 | 7 | struct Three foo(struct Three *p) { 8 | return *p; 9 | // CHECK: call void @llvm.memcpy 10 | // CHECK-NOT: bitcast 11 | } 12 | -------------------------------------------------------------------------------- /test/validator/c++/2010-06-21-LocalVarDbg.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -g -Os -S %s -o - | llvm-as -disable-output 2 | // Do not use function name to create named metadata used to hold 3 | // local variable info. For example. llvm.dbg.lv.~A is an invalid name. 4 | class A { 5 | public: 6 | ~A() { int i = 0; i++; } 7 | }; 8 | 9 | int foo(int i) { 10 | A a; 11 | return 0; 12 | } 13 | 14 | -------------------------------------------------------------------------------- /test/validator/go/heap-trampoline.go: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S %s -o - | FileCheck %s 2 | // CHECK-NOT: builtin 3 | // XFAIL: gcc-4.5 4 | // PR16015 5 | 6 | package main 7 | 8 | import "os" 9 | 10 | func main() { 11 | dummy := 0 12 | performance := func(N int) int { 13 | for rep := 0; rep < N; rep++ { 14 | dummy++ 15 | } 16 | return 0 17 | } 18 | os.Exit(performance(123)) 19 | } 20 | -------------------------------------------------------------------------------- /test/compilator/local/ada/pr15984.adb: -------------------------------------------------------------------------------- 1 | package body PR15984 is 2 | 3 | AA : Type3; 4 | 5 | procedure Startup is 6 | begin -- Startup 7 | AA.EEE := False; 8 | end Startup; 9 | 10 | procedure Set is 11 | begin -- Set 12 | AA.EEE := True; 13 | end Set; 14 | 15 | procedure Reset is 16 | begin -- Reset 17 | AA.EEE := False; 18 | end Reset; 19 | 20 | end PR15984; 21 | -------------------------------------------------------------------------------- /test/validator/ada/element_copy.adb: -------------------------------------------------------------------------------- 1 | -- RUN: %dragonegg -S -O2 %s -o - | FileCheck %s 2 | package body Element_Copy is 3 | -- CHECK: @element_copy__variablesizedfieldIP 4 | -- CHECK: store i8 105, 5 | 6 | function F return VariableSizedField is 7 | -- CHECK: @element_copy__f 8 | X : VariableSizedField; 9 | -- CHECK: store i8 105, 10 | begin 11 | return X; 12 | end; 13 | end; 14 | -------------------------------------------------------------------------------- /test/validator/c++/nullptr13.C: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -xc++ -S -std=c++0x -o /dev/null %s 2 | // XFAIL: gcc-4.5 3 | // PR14777 4 | #include 5 | 6 | #define assert_true(b) do { char c[2 * bool(b) - 1]; } while(0) 7 | 8 | void fun() 9 | { 10 | typeid(nullptr); 11 | const decltype(nullptr) mynull = 0; 12 | typeid(mynull); 13 | assert_true(typeid(nullptr) == typeid(mynull)); 14 | } 15 | -------------------------------------------------------------------------------- /test/validator/c/FunctionAlias.c: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S %s -o - | FileCheck %s 2 | 3 | void qux(void) { } 4 | void foo(void) __attribute__ ((alias ("qux"))); 5 | // CHECK: @foo = alias void ()* @qux 6 | void bar(void) __attribute__ ((weak, alias ("foo"))); 7 | // CHECK: @bar = weak alias void ()* @qux 8 | void baz(void) __attribute__ ((alias ("bar"))); 9 | // CHECK: @baz = alias void ()* @qux 10 | -------------------------------------------------------------------------------- /test/validator/c++/member-alignment.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S %s -o - | FileCheck %s 2 | // XFAIL: arm,powerpc 3 | 4 | // rdar://7268289 5 | 6 | class t { 7 | public: 8 | virtual void foo(void); 9 | void bar(void); 10 | }; 11 | 12 | void 13 | t::foo(void) { 14 | // CHECK: _ZN1t3fooEv{{.*}} align 2 15 | } 16 | 17 | void 18 | t::bar(void) { 19 | // CHECK: _ZN1t3barEv{{.*}} align 2 20 | } 21 | 22 | -------------------------------------------------------------------------------- /test/compilator/local/bid128.c: -------------------------------------------------------------------------------- 1 | typedef __attribute__((aligned(16))) struct { 2 | unsigned long long w[3]; 3 | } UINT192; 4 | 5 | UINT192 ten2mk192M[] = { 6 | {{0xcddd6e04c0592104ULL, 0x0fcf80dc33721d53ULL, 0xa7c5ac471b478423ULL}}, 7 | {{0xcddd6e04c0592104ULL, 0x0fcf80dc33721d53ULL, 0xa7c5ac471b478423ULL}}, 8 | {{0xcddd6e04c0592104ULL, 0x0fcf80dc33721d53ULL, 0xa7c5ac471b478423ULL}} 9 | }; 10 | -------------------------------------------------------------------------------- /test/compilator/local/2010-06-28-DbgLocalVar.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc -S -O2 -g %s -o - | llc -O2 -o %t.s 2 | // RUN: grep DW_TAG_structure_type %t.s | count 2 3 | // Radar 8122864 4 | 5 | // Code is not generated for function foo, but preserve type information of 6 | // local variable xyz. 7 | static foo() { 8 | struct X { int a; int b; } xyz; 9 | } 10 | 11 | int bar() { 12 | foo(); 13 | return 1; 14 | } 15 | -------------------------------------------------------------------------------- /test/validator/c++/2009-09-09-packed-layout.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S -m32 %s -o /dev/null 2 | class X { 3 | public: 4 | virtual ~X(); 5 | short y; 6 | }; 7 | #pragma pack(push, 1) 8 | class Z : public X { 9 | public: enum { foo = ('x') }; 10 | virtual int y() const; 11 | }; 12 | #pragma pack(pop) 13 | class Y : public X { 14 | public: enum { foo = ('y'), bar = 0 }; 15 | }; 16 | X x; 17 | Y y; 18 | Z z; 19 | -------------------------------------------------------------------------------- /test/validator/c++/NotAddressable.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg %s -S -o - | FileCheck %s 2 | 3 | void a(int); 4 | 5 | struct Foo { 6 | Foo(); 7 | ~Foo(); 8 | virtual void foo(); 9 | }; 10 | 11 | Foo::Foo() { a(1); } 12 | // CHECK: define void @_ZN3FooC2Ev{{.*}}unnamed_addr 13 | Foo::~Foo() { a(1); } 14 | // CHECK: define void @_ZN3FooD2Ev{{.*}}unnamed_addr 15 | void Foo::foo() { a(1); } 16 | 17 | Foo f; 18 | -------------------------------------------------------------------------------- /test/compilator/local/2009-05-17-AlwaysInline.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc -S %s -O0 -o - -mllvm -disable-llvm-optzns | grep bar 2 | // Check that the gcc inliner is turned off. 3 | 4 | #include 5 | static __inline__ __attribute__ ((always_inline)) 6 | int bar (int x) 7 | { 8 | return 4; 9 | } 10 | 11 | void 12 | foo () 13 | { 14 | long long b = 1; 15 | int Y = bar (4); 16 | printf ("%d\n", Y); 17 | } 18 | -------------------------------------------------------------------------------- /test/validator/c++/CallReturnAlignment.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg %s -O2 -march=native -fplugin-arg-dragonegg-llvm-ir-optimize=0 -S -o - | FileCheck %s 2 | 3 | struct base {}; 4 | 5 | struct child1 : base { 6 | void* P; 7 | }; 8 | 9 | class child2 : base { 10 | child1 C; 11 | }; 12 | 13 | child2 bar(); 14 | bool foo() { 15 | // CHECK: foo 16 | child2 D = bar(); 17 | // CHECK-NOT: store {{.*}}, align 16 18 | } 19 | -------------------------------------------------------------------------------- /test/validator/c/TargetAttributes.c: -------------------------------------------------------------------------------- 1 | // RUN: %eggdragon -O1 -S %s -o - -msse | FileCheck %s --check-prefix=CHECK-SSE 2 | // RUN: %eggdragon -O1 -S %s -o - -mno-sse | FileCheck %s --check-prefix=CHECK-NOSSE 3 | 4 | void bar(char *); 5 | 6 | void foo(void) { 7 | char buf[32] __attribute__ ((aligned (16))); 8 | memset(buf, 0, sizeof(buf)); 9 | // CHECK-SSE: movaps 10 | // CHECK-NOSSE-NOT: xmm 11 | bar(buf); 12 | } 13 | -------------------------------------------------------------------------------- /test/validator/c/fma.c: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -mfma4 -S %s -o - | FileCheck %s 2 | // XFAIL: gcc-4.5, i386, i486, i586, i686 3 | 4 | // CHECK: @fmaftest 5 | // CHECK: call float @llvm.fma.f32 6 | float fmaftest(float a, float b, float c) { return __builtin_fmaf(a, b, c); } 7 | 8 | // CHECK: @fmatest 9 | // CHECK: call double @llvm.fma.f64 10 | double fmatest(double a, double b, double c) { return __builtin_fma(a, b, c); } 11 | -------------------------------------------------------------------------------- /test/validator/fortran/2012-03-22-NoAlias.f: -------------------------------------------------------------------------------- 1 | C RUN: %dragonegg -S %s -o - | FileCheck %s 2 | subroutine sincos(nx, ny) 3 | C CHECK: (i32* noalias %nx, i32* noalias %ny) 4 | 5 | implicit none 6 | 7 | integer, intent(inout) :: nx 8 | integer, intent(in) :: ny 9 | 10 | nx = nx + ny 11 | nx = nx + ny 12 | 13 | end subroutine sincos 14 | -------------------------------------------------------------------------------- /test/validator/c++/2009-06-30-ByrefBlock.cpp: -------------------------------------------------------------------------------- 1 | // Insure __block_holder_tmp is allocated on the stack. Darwin only. 2 | // RUN: %dragonegg %s -S -O2 -o - | egrep {__block_holder_tmp.*alloca} 3 | // XFAIL: * 4 | // XTARGET: darwin 5 | // 6 | // END. 7 | extern void fubar_dispatch_sync(void (^PP)(void)); 8 | void fubar() { 9 | __block void *voodoo; 10 | fubar_dispatch_sync(^(void){voodoo=0;}); 11 | } 12 | -------------------------------------------------------------------------------- /test/validator/c++/2012-09-27-param-align.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S %s -o - | FileCheck %s 2 | // ABI code was producing naturally aligned i64 loads and stores to memory that 3 | // was not as aligned as an i64. 4 | 5 | struct InReg { 6 | unsigned a; 7 | unsigned b; 8 | }; 9 | 10 | void bar(InReg); 11 | 12 | void foo(InReg x) { 13 | bar(x); 14 | // CHECK: store {{.*}}, align 15 | // CHECK: load {{.*}}, align 16 | } 17 | -------------------------------------------------------------------------------- /test/compilator/local/fortran/cpow.f90: -------------------------------------------------------------------------------- 1 | ! PR2443 2 | 3 | ! Program to test the power (**) operator 4 | program testpow 5 | implicit none 6 | real(kind=4) r, s, two 7 | real(kind=8) :: q 8 | complex(kind=4) :: c, z 9 | real, parameter :: del = 0.0001 10 | integer i, j 11 | 12 | two = 2.0 13 | 14 | c = (2.0, 3.0) 15 | c = c ** two 16 | if (abs(c - (-5.0, 12.0)) .gt. del) call abort 17 | end program 18 | -------------------------------------------------------------------------------- /test/validator/c++/2005-07-21-VirtualBaseAccess.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -xc++ %s -S -o - | FileCheck %s 2 | 3 | void foo(int*); 4 | 5 | struct FOO { 6 | int X; 7 | }; 8 | 9 | struct BAR : virtual FOO { BAR(); }; 10 | 11 | BAR testfn() { 12 | // CHECK: "alloca point" = bitcast i32 0 to i32 13 | // CHECK: "ssa point" = bitcast i32 0 to i32 14 | // CHECK-NOT: cast 15 | BAR B; 16 | foo(&B.X); 17 | return B; 18 | } 19 | -------------------------------------------------------------------------------- /test/compilator/local/2007-02-04-WITH_SIZE_EXPR.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc %s -O3 -S -o - 2 | // PR1174 3 | 4 | void zzz (char *s1, char *s2, int len, int *q) 5 | { 6 | int z = 5; 7 | unsigned int i, b; 8 | struct { char a[z]; } x; 9 | 10 | for (i = 0; i < len; i++) 11 | s1[i] = s2[i]; 12 | 13 | b = z & 0x3; 14 | 15 | len += (b == 0 ? 0 : 1) + z; 16 | 17 | *q = len; 18 | 19 | foo (x, x); 20 | } 21 | 22 | -------------------------------------------------------------------------------- /test/compilator/local/2003-08-31-StructLayout.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null 2 | 3 | // There is a HOLE in the derived2 object due to not wanting to place the two 4 | // baseclass instances at the same offset! 5 | 6 | struct baseclass {}; 7 | 8 | class derived1 : public baseclass { 9 | void * NodePtr; 10 | }; 11 | 12 | class derived2 : public baseclass { 13 | derived1 current; 14 | }; 15 | 16 | derived2 RI; 17 | -------------------------------------------------------------------------------- /test/compilator/local/2008-11-11-AnnotateStructFieldAttribute.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc -S %s -o - | grep llvm.ptr.annotation | count 3 2 | 3 | #include 4 | 5 | /* Struct with element X being annotated */ 6 | struct foo { 7 | int X __attribute__((annotate("StructAnnotation"))); 8 | int Y; 9 | int Z; 10 | }; 11 | 12 | 13 | void test(struct foo *F) { 14 | F->X = 42; 15 | F->Z = 1; 16 | F->Y = F->X; 17 | } 18 | 19 | -------------------------------------------------------------------------------- /test/compilator/local/ada/bitfield.adb: -------------------------------------------------------------------------------- 1 | package body Bitfield is 2 | function R (X : T) return Boolean is 3 | begin 4 | return X.B; 5 | end; 6 | function R (X : T) return Float is 7 | begin 8 | return X.F; 9 | end; 10 | procedure W (X : in out T; B : Boolean) is 11 | begin 12 | X.B := B; 13 | end; 14 | procedure W (X : in out T; F : Float) is 15 | begin 16 | X.F := F; 17 | end; 18 | end; 19 | -------------------------------------------------------------------------------- /test/validator/c/2012-03-16-AllocaOrder.c: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S %s -o - | FileCheck %s 2 | // Check that local variables are output in the order that they are declared in. 3 | 4 | void foo(int *); 5 | 6 | int bar(int x) { 7 | // CHECK: @bar 8 | int a; 9 | // CHECK: %a = alloca 10 | int b; 11 | // CHECK: %b = alloca 12 | int c; 13 | // CHECK: %c = alloca 14 | foo (&b); 15 | foo (&c); 16 | foo (&a); 17 | return a + b + c; 18 | } 19 | -------------------------------------------------------------------------------- /test/compilator/local/2010-01-05-LinkageName.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc -O2 -S -g %s -o - | llc -o 2010-01-05-LinkageName.s -O0 2 | // RUN: %compile_c 2010-01-05-LinkageName.s -o 2010-01-05-LinkageName.s 3 | 4 | struct tm {}; 5 | long mktime(struct tm *) __asm("_mktime$UNIX2003"); 6 | tzload(name, sp, doextend){} 7 | long mktime(tmp) 8 | struct tm *const tmp; 9 | { 10 | tzset(); 11 | } 12 | timelocal(tmp) { 13 | return mktime(tmp); 14 | } 15 | 16 | -------------------------------------------------------------------------------- /test/compilator/local/ada/negative_field_offset.adb: -------------------------------------------------------------------------------- 1 | with System; 2 | procedure Negative_Field_Offset (N : Integer) is 3 | type String_Pointer is access String; 4 | -- Force use of a thin pointer. 5 | for String_Pointer'Size use System.Word_Size; 6 | P : String_Pointer; 7 | 8 | procedure Q (P : String_Pointer) is 9 | begin 10 | P (1) := 'Z'; 11 | end; 12 | begin 13 | P := new String (1 .. N); 14 | Q (P); 15 | end; 16 | -------------------------------------------------------------------------------- /test/compilator/local/c++/nameless-type.cpp: -------------------------------------------------------------------------------- 1 | namespace std { 2 | namespace decimal { 3 | class decimal64 { 4 | public: 5 | typedef float __decfloat64 __attribute__ ((mode (DD))); 6 | explicit decimal64 (int __r):__val (__r) {} 7 | private: 8 | __decfloat64 __val; 9 | }; 10 | } 11 | } 12 | 13 | int bar (const std::decimal::decimal64 & x) { } 14 | 15 | int foo () 16 | { 17 | std::decimal::decimal64 x(0); 18 | bar (x); 19 | } 20 | -------------------------------------------------------------------------------- /test/compilator/local/2005-05-06-CountBuiltins.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc %s -S -o - | llvm-as | llvm-dis | not grep call.*__builtin 2 | 3 | int G, H, I; 4 | void foo(int P) { 5 | G = __builtin_clz(P); 6 | H = __builtin_ctz(P); 7 | I = __builtin_popcount(P); 8 | } 9 | 10 | long long g, h, i; 11 | void fooll(float P) { 12 | g = __builtin_clzll(P); 13 | g = __builtin_clzll(P); 14 | h = __builtin_ctzll(P); 15 | i = __builtin_popcountll(P); 16 | } 17 | 18 | -------------------------------------------------------------------------------- /test/compilator/local/alignstack.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc %s -fasm-blocks -S -o - | FileCheck %s 2 | // Complicated expression as jump target 3 | // XFAIL: * 4 | // XTARGET: x86,i386,i686,darwin 5 | 6 | void Method3() 7 | { 8 | // CHECK: Method3 9 | // CHECK-NOT: alignstack 10 | asm("foo:"); 11 | // CHECK: return 12 | } 13 | 14 | void Method4() 15 | { 16 | // CHECK: Method4 17 | // CHECK: alignstack 18 | asm { 19 | bar: 20 | } 21 | // CHECK: return 22 | } 23 | 24 | -------------------------------------------------------------------------------- /test/compilator/local/hollerith_reduced.f90: -------------------------------------------------------------------------------- 1 | implicit none 2 | complex(kind=8) x(2) 3 | complex a(2,2) 4 | character*4 z 5 | character z1(4) 6 | character*4 z2(2,2) 7 | character*80 line 8 | integer i 9 | logical l 10 | real r 11 | character*8 c 12 | 13 | 14 | call test (8h hello) 15 | end 16 | 17 | subroutine test (h) 18 | integer(kind=8) h 19 | character*80 line 20 | 21 | write (line, '(8a)') h 22 | if (line .ne. ' hello') call abort 23 | end subroutine 24 | 25 | -------------------------------------------------------------------------------- /test/compilator/local/2010-01-14-StaticVariable.c: -------------------------------------------------------------------------------- 1 | // This is a regression test on debug info to make sure that llvm emitted 2 | // debug info does not crash gdb. 3 | // RUN: %llvmgcc -S -O0 -g %s -o - | \ 4 | // RUN: llc --disable-fp-elim -o %t.s -O0 -relocation-model=pic 5 | // RUN: %compile_c %t.s -o %t.o 6 | // RUN: echo {quit\n} > %t.in 7 | // RUN: gdb -q -batch -n -x %t.in %t.o > /dev/null 8 | 9 | int foo() { 10 | static int i = 42; 11 | return i; 12 | } 13 | -------------------------------------------------------------------------------- /test/compilator/local/alignstack.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgxx %s -fasm-blocks -S -o - | FileCheck %s 2 | // Complicated expression as jump target 3 | // XFAIL: * 4 | // XTARGET: x86,i386,i686,darwin 5 | 6 | void Method3() 7 | { 8 | // CHECK: Method3 9 | // CHECK-NOT: alignstack 10 | asm("foo:"); 11 | // CHECK: return 12 | } 13 | 14 | void Method4() 15 | { 16 | // CHECK: Method4 17 | // CHECK: alignstack 18 | asm { 19 | bar: 20 | } 21 | // CHECK: return 22 | } 23 | 24 | -------------------------------------------------------------------------------- /test/validator/c++/2009-12-23-MissingSext.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg %s -S -o - | FileCheck %s 2 | // The store of p.y into the temporary was not 3 | // getting extended to 32 bits, so uninitialized 4 | // bits of the temporary were used. 7366161. 5 | struct foo { 6 | char x:8; 7 | signed int y:24; 8 | }; 9 | int bar(struct foo p, int x) { 10 | // CHECK: bar 11 | // CHECK: sext 12 | // CHECK: sext 13 | x = (p.y > x ? x : p.y); 14 | return x; 15 | // CHECK: return 16 | } 17 | -------------------------------------------------------------------------------- /test/validator/c/ConstructorAsLValue.c: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S -o /dev/null %s -fplugin-arg-dragonegg-enable-gcc-optzns -O1 2 | #define __vector __attribute__((vector_size(16) )) 3 | typedef __vector signed char qword; 4 | typedef __vector unsigned int VU32; 5 | extern short g[192 +16]; 6 | void f(qword); 7 | void f1 (unsigned ctr) 8 | { 9 | VU32 pin; 10 | pin = (VU32){(__SIZE_TYPE__)&g[16]}; 11 | do { 12 | f((qword)pin); 13 | ctr--; 14 | } 15 | while(ctr); 16 | } 17 | -------------------------------------------------------------------------------- /test/compilator/local/2003-08-28-SaveExprBug.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null 2 | 3 | 4 | char* eback(); 5 | 6 | template 7 | struct basic_filebuf { 8 | char *instancevar; 9 | 10 | void callee() { 11 | instancevar += eback() != eback(); 12 | } 13 | 14 | void caller(); 15 | }; 16 | 17 | 18 | template 19 | void basic_filebuf<_CharT>::caller() { 20 | callee(); 21 | } 22 | 23 | 24 | template class basic_filebuf; 25 | -------------------------------------------------------------------------------- /test/compilator/local/2003-09-29-ArgumentNumberMismatch.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null 2 | 3 | // Non-POD classes cannot be passed into a function by component, because their 4 | // dtors must be run. Instead, pass them in by reference. The C++ front-end 5 | // was mistakenly "thinking" that 'foo' took a structure by component. 6 | 7 | struct C { 8 | int A, B; 9 | ~C() {} 10 | }; 11 | 12 | void foo(C b); 13 | 14 | void test(C *P) { 15 | foo(*P); 16 | } 17 | 18 | -------------------------------------------------------------------------------- /test/compilator/local/ada/bitfield.ads: -------------------------------------------------------------------------------- 1 | package Bitfield is 2 | -- Read and write of a non-integer scalar bitfield. 3 | type T is record 4 | B : Boolean; 5 | F : Float; 6 | end record; 7 | for T use record 8 | B at 0 range 1 .. 1; 9 | F at 0 range 2 .. 33; 10 | end record; 11 | function R (X : T) return Boolean; 12 | function R (X : T) return Float; 13 | procedure W (X : in out T; B : Boolean); 14 | procedure W (X : in out T; F : Float); 15 | end; 16 | -------------------------------------------------------------------------------- /test/compilator/local/c++/2007-05-16-ReverseBitFieldCrash.cpp: -------------------------------------------------------------------------------- 1 | #pragma reverse_bitfields on 2 | typedef unsigned long UINT32; 3 | 4 | extern void abort(void); 5 | 6 | typedef struct TestStruct 7 | { 8 | long first: 15, 9 | second: 17; 10 | } TestStruct; 11 | 12 | int main (int argc, char * const argv[]) { 13 | 14 | TestStruct testStruct = {1, 0}; 15 | 16 | UINT32 dw = *(UINT32 *)(&testStruct); 17 | 18 | if(!(dw & 0xFFFF)) 19 | abort (); 20 | 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /test/validator/c/signbit.c: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S -o - %s | FileCheck %s 2 | 3 | int sbf(float x) { 4 | // CHECK: @sbf 5 | // CHECK: bitcast float {{.*}} to i32 6 | // CHECK: icmp slt i32 {{.*}}, 0 7 | // CHECK: zext i1 {{.*}} to i32 8 | return __builtin_signbitf(x); 9 | } 10 | 11 | int sbd(double x) { 12 | // CHECK: @sbd 13 | // CHECK: bitcast double {{.*}} to i64 14 | // CHECK: icmp slt i64 {{.*}}, 0 15 | // CHECK: zext i1 {{.*}} to i32 16 | return __builtin_signbit(x); 17 | } 18 | -------------------------------------------------------------------------------- /test/compilator/local/2009-02-17-BitField-dbg.c: -------------------------------------------------------------------------------- 1 | // Check bitfields. 2 | // RUN: %llvmgcc -S -O0 -g %s -o - | \ 3 | // RUN: llc --disable-fp-elim -o 2009-02-17-BitField-dbg.s 4 | // RUN: %compile_c 2009-02-17-BitField-dbg.s -o 2009-02-17-BitField-dbg.o 5 | // RUN: echo {ptype mystruct} > %t2 6 | // RUN: gdb -q -batch -n -x %t2 2009-02-17-BitField-dbg.o | \ 7 | // RUN: tee 2009-02-17-BitField-dbg.out | grep "int a : 4" 8 | // 9 | 10 | struct { 11 | int a:4; 12 | int b:2; 13 | } mystruct; 14 | 15 | -------------------------------------------------------------------------------- /test/compilator/local/ada/placeholder.adb: -------------------------------------------------------------------------------- 1 | procedure Placeholder is 2 | subtype Bounded is Integer range 1 .. 5; 3 | type Vector is array (Bounded range <>) of Integer; 4 | type Interval (Length : Bounded := 1) is record 5 | Points : Vector (1 .. Length); 6 | end record; 7 | An_Interval : Interval := (Length => 1, Points => (1 => 1)); 8 | generic The_Interval : Interval; package R is end; 9 | package body R is end; 10 | package S is new R (An_Interval); 11 | begin null; end; 12 | -------------------------------------------------------------------------------- /test/validator/c/iceil.c: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S %s -o - -O2 -lm -ffast-math | FileCheck %s 2 | // PR14270 3 | 4 | // CHECK-NOT: builtin 5 | 6 | #include 7 | 8 | int iceilf (float a) { return (int) ceil (a); } 9 | int iceil (double a) { return (int) ceil (a); } 10 | int iceill (long double a) { return (int) ceil (a); } 11 | 12 | int ifloorf (float a) { return (int) floor (a); } 13 | int ifloor (double a) { return (int) floor (a); } 14 | int ifloorl (long double a) { return (int) floor (a); } 15 | -------------------------------------------------------------------------------- /test/validator/c/rdrand-builtins.c: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S %s -o - -mrdrnd | FileCheck %s 2 | // XFAIL: gcc-4.5 3 | 4 | #include 5 | 6 | int rdrand16(unsigned short *p) { 7 | return _rdrand16_step(p); 8 | // CHECK: @rdrand16 9 | // CHECK: call { i16, i32 } @llvm.x86.rdrand.16 10 | // CHECK: store i16 11 | } 12 | 13 | int rdrand32(unsigned *p) { 14 | return _rdrand32_step(p); 15 | // CHECK: @rdrand32 16 | // CHECK: call { i32, i32 } @llvm.x86.rdrand.32 17 | // CHECK: store i32 18 | } 19 | -------------------------------------------------------------------------------- /test/compilator/local/2009-04-21-DtorNames-dbg.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc -S -g %s -o - | llc -O0 -o %t.s 2 | // RUN: %compile_c %t.s -o %t.o 3 | // PR4025 4 | 5 | template class vector 6 | { 7 | public: 8 | ~vector () 9 | { 10 | } 11 | }; 12 | 13 | class Foo 14 | { 15 | ~Foo(); 16 | class FooImpl *impl_; 17 | }; 18 | 19 | namespace { 20 | class Bar; 21 | } 22 | 23 | class FooImpl 24 | { 25 | vector thing; 26 | }; 27 | 28 | Foo::~Foo() 29 | { 30 | delete impl_; 31 | } 32 | 33 | -------------------------------------------------------------------------------- /test/validator/c++/nullptr20.C: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -xc++ -S -std=c++0x -o /dev/null %s 2 | // XFAIL: gcc-4.5 3 | // PR14777 4 | #include 5 | #include 6 | 7 | int main() 8 | { 9 | char buf1[64]; 10 | char buf2[64]; 11 | char buf3[64]; 12 | 13 | std::sprintf(buf1, "%p", (void*)0); 14 | std::sprintf(buf2, "%p", nullptr); 15 | decltype(nullptr) mynull = 0; 16 | std::sprintf(buf3, "%p", nullptr); 17 | return std::strcmp(buf1, buf2) != 0 || std::strcmp(buf1, buf3) != 0; 18 | } 19 | -------------------------------------------------------------------------------- /test/compilator/local/2010-06-28-nowarn.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc %s -S -m32 -fasm-blocks -o /dev/null 2 | // This should not warn about unreferenced label. 7729514. 3 | // XFAIL: * 4 | // XTARGET: x86,i386,i686 5 | 6 | void quarterAsm(int array[], int len) 7 | { 8 | __asm 9 | { 10 | mov esi, array; 11 | mov ecx, len; 12 | shr ecx, 2; 13 | loop: 14 | movdqa xmm0, [esi]; 15 | psrad xmm0, 2; 16 | movdqa [esi], xmm0; 17 | add esi, 16; 18 | sub ecx, 1; 19 | jnz loop; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/compilator/local/2010-07-19-nowarn.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc %s -S -m32 -fasm-blocks -o /dev/null 2 | // This should not warn about unreferenced label. 8195660. 3 | // XFAIL: * 4 | // XTARGET: x86,i386,i686 5 | 6 | void quarterAsm(int array[], int len) 7 | { 8 | __asm 9 | { 10 | mov esi, array; 11 | mov ecx, len; 12 | shr ecx, 2; 13 | loop: 14 | movdqa xmm0, [esi]; 15 | psrad xmm0, 2; 16 | movdqa [esi], xmm0; 17 | add esi, 16; 18 | sub ecx, 1; 19 | jnz loop; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/compilator/local/asm_float_truncate.cpp: -------------------------------------------------------------------------------- 1 | void yo() { 2 | double __x; 3 | register long double __value; 4 | register int __ignore; 5 | unsigned short int __cw; 6 | unsigned short int __cwtmp; 7 | __asm __volatile ("fnstcw %3\n\t" 8 | "movzwl %3, %1\n\t" 9 | "andl $0xf3ff, %1\n\t" 10 | "orl $0x0400, %1\n\t" /* rounding down */ 11 | "movw %w1, %2\n\t" 12 | "fldcw %2\n\t" 13 | "frndint\n\t" 14 | "fldcw %3" 15 | : "=t" (__value), "=&q" (__ignore), "=m" (__cwtmp), 16 | "=m" (__cw) 17 | : "0" (__x)); 18 | } 19 | -------------------------------------------------------------------------------- /test/compilator/local/2010-04-30-OptimizedMethod-Dbg.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc -g -S -O2 %s -o - | FileCheck %s 2 | 3 | class foo { 4 | public: 5 | int bar(int x); 6 | static int baz(int x); 7 | }; 8 | 9 | int foo::bar(int x) { 10 | // CHECK: {{i32 [0-9]+, i1 true(, i[0-9]+ [^\}]+[}]|[}]) ; \[ DW_TAG_subprogram \]}} 11 | return x*4 + 1; 12 | } 13 | 14 | int foo::baz(int x) { 15 | // CHECK: {{i32 [0-9]+, i1 true(, i[0-9]+ [^\},]+[}]|[}]) ; \[ DW_TAG_subprogram \]}} 16 | return x*4 + 1; 17 | } 18 | 19 | -------------------------------------------------------------------------------- /test/validator/c++/integration-O2.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg %s -O2 -S -o - | FileCheck %s 2 | 3 | // This test verifies that we get expected codegen out of the -O2 optimization 4 | // level from the full optimizer. 5 | 6 | 7 | 8 | // Verify that ipsccp is running and can eliminate globals. 9 | static int test1g = 42; 10 | void test1f1() { 11 | if (test1g == 0) test1g = 0; 12 | } 13 | int test1f2() { 14 | return test1g; 15 | } 16 | 17 | // CHECK: @_Z7test1f2v() 18 | // CHECK: entry: 19 | // CHECK-NEXT: ret i32 42 20 | -------------------------------------------------------------------------------- /test/validator/c++/2006-11-20-GlobalSymbols.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %eggdragon -O0 -g -S %s -fplugin-arg-dragonegg-emit-ir -o - | FileCheck %s 2 | /// PR1013 3 | // Check to make sure debug symbols use the correct name for globals and 4 | // functions. 5 | 6 | // CHECK: @"\01f\01oo" = unnamed_addr global i32 0 7 | // CHECK: metadata !{metadata !"0x34\00foo\00foo\00\01f\01oo\009\000\001", metadata !6, metadata !6, metadata !9, i32* @"\01f\01oo", null} 8 | 9 | int foo __asm__("f\001oo"); 10 | 11 | int bar() { 12 | return foo; 13 | } 14 | -------------------------------------------------------------------------------- /test/validator/c++/OffsetType.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S -g -o /dev/null %s 2 | 3 | struct X { }; 4 | 5 | struct AnyPtrMem { 6 | template 7 | operator T Class::*() const 8 | { 9 | T x = 0; 10 | return 0; 11 | } 12 | }; 13 | 14 | void test_deduce_ptrmem_with_qual(AnyPtrMem apm) { 15 | const float X::* pm = apm; 16 | } 17 | 18 | struct A { 19 | typedef A* (A::*MemberPointer); 20 | A *m_ptr; 21 | }; 22 | 23 | void foo() { 24 | A::MemberPointer member = &A::m_ptr; 25 | } 26 | -------------------------------------------------------------------------------- /test/validator/c++/varargs.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S %s -o - | FileCheck %s 2 | // rdar://7309675 3 | // PR4678 4 | 5 | // test1 should be compmiled to be a varargs function in the IR even 6 | // though there is no way to do a va_begin. Otherwise, the optimizer 7 | // will warn about 'dropped arguments' at the call site. 8 | 9 | // CHECK: define i32 @_Z5test1z(...) 10 | int test1(...) { 11 | return -1; 12 | } 13 | 14 | // CHECK: call i32 (...)* @_Z5test1z(i32 0) 15 | void test() { 16 | test1(0); 17 | } 18 | 19 | 20 | -------------------------------------------------------------------------------- /test/compilator/local/2010-11-16-asmblock.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc -S %s -fasm-blocks -o - | FileCheck %s 2 | // XFAIL: * 3 | // XTARGET: x86,i386,i686 4 | // 84282548 5 | 6 | void foo() 7 | { 8 | // CHECK: %0 = call i32 asm sideeffect "", "={ecx}"() nounwind 9 | // CHECK: %asmtmp = call i32 asm sideeffect alignstack "sall $$3, $0", "={ecx},{ecx},~{dirflag},~{fpsr},~{flags},~{memory}"(i32 %0) nounwind 10 | // CHECK: store i32 %asmtmp, i32* %"%ecx" 11 | __asm { 12 | sal ecx, 3; 13 | add esi, ecx; 14 | add edi, ecx; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test/compilator/local/rsqrtps_nr.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | typedef float v4sf __attribute__ ((vector_size (16))); 4 | v4sf rfoo_nr(v4sf v) { 5 | return __builtin_ia32_rsqrtps_nr(v); 6 | } 7 | //float rfoof(float x) { 8 | // return __builtin_ia32_rsqrtf(x); 9 | //} 10 | int main(void) { 11 | v4sf x = { -1.0, 2.0, 9.0, 999.0 }; 12 | x = rfoo_nr(x); 13 | printf("%g\n", ((float *)&x)[0]); 14 | printf("%g\n", ((float *)&x)[1]); 15 | printf("%g\n", ((float *)&x)[2]); 16 | printf("%g\n", ((float *)&x)[3]); 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /test/validator/c++/nullptr22.C: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -xc++ -S -std=c++0x -o /dev/null %s 2 | // XFAIL: gcc-4.5 3 | // PR14777 4 | void f1(const char*, ...) __attribute__((format(printf, 1, 2))); 5 | void f2(const char*) __attribute__((nonnull)); 6 | void f3(const char*, ...) __attribute__((sentinel)); 7 | 8 | void f() 9 | { 10 | f1("%p", nullptr); 11 | f2(nullptr); 12 | f3("x", "y", __null); 13 | f3("x", "y", nullptr); 14 | decltype(nullptr) mynull = 0; 15 | f1("%p", mynull); 16 | f2(mynull); 17 | f3("x", "y", mynull); 18 | } 19 | -------------------------------------------------------------------------------- /test/validator/c/lround.c: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S %s -o - | FileCheck %s 2 | // XFAIL: gcc-4.5, gcc-4.6 3 | long int lr(double x) { 4 | return __builtin_lround(x); 5 | } 6 | long int lrf(float x) { 7 | return __builtin_lroundf(x); 8 | } 9 | long int lrl(long double x) { 10 | return __builtin_lroundl(x); 11 | } 12 | int ir(double x) { 13 | return __builtin_iround(x); 14 | } 15 | int irf(float x) { 16 | return __builtin_iroundf(x); 17 | } 18 | int irl(long double x) { 19 | return __builtin_iroundl(x); 20 | } 21 | // CHECK-NOT: builtin 22 | -------------------------------------------------------------------------------- /test/validator/c/fast-math.c: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S %s -o - | FileCheck -check-prefix=DEFAULT %s 2 | // RUN: %dragonegg -S %s -o - -ffast-math | FileCheck -check-prefix=FASTMATH %s 3 | // RUN: %dragonegg -S %s -o - -ffinite-math-only | FileCheck -check-prefix=FINITEMATHONLY %s 4 | // RUN: %dragonegg -S %s -o - -fno-signed-zeros | FileCheck -check-prefix=NOSIGNEDZEROS %s 5 | 6 | double fm(double x, double y) { 7 | return x+y; 8 | // DEFAULT: fadd double 9 | // FASTMATH: fadd fast 10 | // FINITEMATHONLY: fadd nnan ninf 11 | // NOSIGNEDZEROS: fadd nsz 12 | } 13 | -------------------------------------------------------------------------------- /test/validator/c++/nullptr18.C: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -xc++ -S -std=c++0x -o /dev/null %s 2 | // XFAIL: gcc-4.5 3 | // PR14777 4 | template struct tType_equal; 5 | template struct tType_equal { typedef void type; }; 6 | 7 | template 8 | inline typename tType_equal::type 9 | type_equal(U) { } 10 | 11 | char* j( char* ); 12 | bool j( bool ); 13 | 14 | void test_j() 15 | { 16 | type_equal(j(nullptr)); 17 | decltype(nullptr) mynull = 0; 18 | type_equal(j(mynull)); 19 | } 20 | -------------------------------------------------------------------------------- /test/validator/objc/2007-05-02-Strong.m: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S %s -fobjc-gc -o /dev/null 2 | typedef int NSInteger; 3 | typedef struct _NSRect { 4 | int origin; 5 | int size; 6 | } NSRect; 7 | 8 | __attribute__((objc_gc(strong))) NSRect *_cachedRectArray; 9 | extern const NSRect NSZeroRect; 10 | @interface A{ 11 | } 12 | -(void)bar:(NSInteger *)rectCount; 13 | @end 14 | 15 | @implementation A 16 | 17 | -(void)bar:(NSInteger *)rectCount { 18 | NSRect appendRect = NSZeroRect; 19 | 20 | _cachedRectArray[*rectCount - 1] = NSZeroRect; 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /test/validator/c/PointerPlusExpr.c: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S %s -o - -O1 | FileCheck %s 2 | 3 | int foo1(int *A, int N) { 4 | // CHECK: @foo1 5 | return A[N]; 6 | // CHECK: getelementptr i32* %A 7 | } 8 | 9 | int foo2(int *A, int N) { 10 | // CHECK: @foo2 11 | return A[2*N]; 12 | // CHECK: getelementptr i32* %A 13 | } 14 | 15 | int foo3(int *A, int N) { 16 | // CHECK: @foo3 17 | return A[3*N]; 18 | // CHECK: getelementptr i32* %A 19 | } 20 | 21 | int fooM(int *A, int M, int N) { 22 | // CHECK: @fooM 23 | return A[M*N]; 24 | // CHECK: getelementptr i32* %A 25 | } 26 | -------------------------------------------------------------------------------- /test/validator/objc/2007-04-03-ObjcEH.m: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -fobjc-exceptions -S %s -o /dev/null 2 | 3 | @interface B 4 | -(int)bar; 5 | @end 6 | 7 | @interface A 8 | -(void) Foo:(int) state; 9 | @end 10 | 11 | @implementation A 12 | - (void) Foo:(int) state { 13 | 14 | int wasResponded = 0; 15 | @try { 16 | if (state) { 17 | B * b = 0; 18 | @try { } 19 | @finally { 20 | wasResponded = ![b bar]; 21 | } 22 | } 23 | } 24 | @finally { 25 | } 26 | } 27 | @end 28 | 29 | 30 | -------------------------------------------------------------------------------- /test/compilator/local/2007-09-20-GcrootAttribute.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc -S %s -o - | grep llvm.gcroot 2 | // RUN: %llvmgcc -S %s -o - | grep llvm.gcroot | count 6 3 | // RUN: %llvmgcc -S %s -o - | llvm-as 4 | 5 | typedef struct foo_s 6 | { 7 | int a; 8 | } foo, __attribute__ ((gcroot)) *foo_p; 9 | 10 | foo my_foo; 11 | 12 | int alpha () 13 | { 14 | foo my_foo2 = my_foo; 15 | 16 | return my_foo2.a; 17 | } 18 | 19 | int bar (foo a) 20 | { 21 | foo_p b; 22 | return b->a; 23 | } 24 | 25 | foo_p baz (foo_p a, foo_p b, foo_p *c) 26 | { 27 | a = b = *c; 28 | return a; 29 | } 30 | -------------------------------------------------------------------------------- /test/compilator/local/2010-05-14-Optimized-VarType.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc %s -Os -S -g -o - | grep DW_TAG_structure_type | count 1 2 | // Variable 'a' is optimized but the debug info should preserve its type info. 3 | #include 4 | 5 | struct foo { 6 | int Attribute; 7 | }; 8 | 9 | void *getfoo(void) __attribute__((noinline)); 10 | 11 | void *getfoo(void) 12 | { 13 | int *x = malloc(sizeof(int)); 14 | *x = 42; 15 | return (void *)x; 16 | } 17 | 18 | int main(int argc, char *argv[]) { 19 | struct foo *a = (struct foo *)getfoo(); 20 | 21 | return a->Attribute; 22 | } 23 | 24 | -------------------------------------------------------------------------------- /test/compilator/local/AliasOfRename.c: -------------------------------------------------------------------------------- 1 | // PR15090 2 | 3 | extern int *A (); extern __typeof (A) A __asm__ ("AA"); 4 | // A -> AA (extern), renaming. 5 | 6 | 7 | extern __typeof (A) B; extern __typeof (B) B __asm__ ("BB"); 8 | // B -> BB (extern), renaming. 9 | 10 | int *B () { return 0; } 11 | // BB defined. 12 | 13 | 14 | extern __typeof (B) C __asm__ ("B"); 15 | // C -> B (extern), renaming. 16 | 17 | extern __typeof (B) C __attribute__ ((alias ("BB"))); 18 | // B an alias for BB. 19 | 20 | extern __typeof (B) A __attribute__ ((weak, alias ("B"))); 21 | // AA a weak alias for B. 22 | -------------------------------------------------------------------------------- /test/validator/c++/m64-ptr.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg %s -S -o - | FileCheck %s 2 | // XFAIL: powerpc-apple-darwin 3 | 4 | // Make sure pointers are passed as pointers, not converted to int. 5 | // The first load should be of type %struct.StringRef** in either 32 6 | // or 64 bit mode. This formerly happened on x86-64, 7375899. 7 | 8 | class StringRef { 9 | public: 10 | const char *Data; 11 | long Len; 12 | }; 13 | void foo(StringRef X); 14 | void bar(StringRef &A) { 15 | // CHECK: @_Z3barR9StringRef 16 | // CHECK: load %struct.StringRef** 17 | foo(A); 18 | // CHECK: ret void 19 | } 20 | -------------------------------------------------------------------------------- /test/compilator/local/ada/pr15984.ads: -------------------------------------------------------------------------------- 1 | package PR15984 is 2 | 3 | type Type1 is (AAA, BBB); 4 | 5 | type Type2 is record 6 | CCC : Boolean; 7 | DDD : Float; 8 | end record; 9 | pragma pack( Type2 ); 10 | 11 | type Type3 (Format : Type1 := AAA) is record 12 | case Format is 13 | when AAA => 14 | EEE : Boolean; 15 | when BBB => 16 | FFF : Type2; 17 | end case; 18 | end record; 19 | pragma PACK (Type3); 20 | 21 | procedure Startup; 22 | 23 | procedure Set; 24 | 25 | procedure Reset; 26 | 27 | end PR15984; 28 | -------------------------------------------------------------------------------- /test/compilator/local/2003-08-28-ForwardType.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null 2 | 3 | // Default placement versions of operator new. 4 | #include 5 | 6 | void* operator new(size_t, void* __p) throw(); 7 | 8 | 9 | template 10 | struct stdio_filebuf 11 | { stdio_filebuf(); 12 | 13 | }; 14 | 15 | extern stdio_filebuf buf_cout; 16 | 17 | void foo() { 18 | // Create stream buffers for the standard streams and use 19 | // those buffers without destroying and recreating the 20 | // streams. 21 | new (&buf_cout) stdio_filebuf(); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /test/compilator/local/fp-logical.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc %s -S -o - | grep bitcast | count 14 2 | 3 | typedef float vFloat __attribute__ ((__vector_size__ (16))); 4 | typedef unsigned int vUInt32 __attribute__ ((__vector_size__ (16))); 5 | void foo(vFloat *X) { 6 | vFloat NoSignBit = (vFloat) ~ (vUInt32) (vFloat) { -0.f, -0.f, -0.f, -0.f }; 7 | vFloat ExtremeValue = *X & NoSignBit; 8 | *X = ExtremeValue; 9 | } 10 | 11 | void bar(vFloat *X) { 12 | vFloat NoSignBit = (vFloat) ~ (vUInt32) (vFloat) { -0.f, -0.f, -0.f, -0.f }; 13 | vFloat ExtremeValue = *X & ~NoSignBit; 14 | *X = ExtremeValue; 15 | } 16 | -------------------------------------------------------------------------------- /test/compilator/local/2010-05-18-asmsched.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc %s -S -O3 -o - | llc -march=x86-64 -mtriple=x86_64-apple-darwin | FileCheck %s 2 | // r9 used to be clobbered before its value was moved to r10. 7993104. 3 | 4 | void foo(int x, int y) { 5 | // CHECK: bar 6 | // CHECK: movq %r9, %r10 7 | // CHECK: movq %rdi, %r9 8 | // CHECK: bar 9 | register int lr9 asm("r9") = x; 10 | register int lr10 asm("r10") = y; 11 | int foo; 12 | asm volatile("nop" : "=r"(lr9) : "r"(lr9), "r"(lr10)); 13 | foo = lr9; 14 | lr9 = x; 15 | lr10 = foo; 16 | asm volatile("nop" : "=r"(lr9) : "r"(lr9), "r"(lr10)); 17 | } 18 | -------------------------------------------------------------------------------- /test/validator/c++/nullptr17.C: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -xc++ -S -std=c++0x -o /dev/null %s 2 | // XFAIL: gcc-4.5 3 | // PR14777 4 | template struct tType_equal; 5 | template struct tType_equal { typedef void type; }; 6 | 7 | template 8 | inline typename tType_equal::type 9 | type_equal(U) { } 10 | 11 | int i( int ); 12 | long int i( long int ); 13 | bool i( bool ); 14 | 15 | void test_i() 16 | { 17 | // Overload to bool, not int 18 | type_equal(i(nullptr)); 19 | decltype(nullptr) mynull = 0; 20 | type_equal(i(mynull)); 21 | } 22 | -------------------------------------------------------------------------------- /test/compilator/local/2010-02-17-DbgArtificialArg.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc -g -S %s -o - | FileCheck %s 2 | // Here, second to last argument "i32 64" indicates that artificial type is set. 3 | // Test to artificial attribute attahed to "this" pointer type. 4 | // Radar 7655792 and 7655002 5 | 6 | class A { 7 | public: 8 | int fn1(int i) const { return i + 2; }; 9 | }; 10 | 11 | int foo() { 12 | A a; 13 | // Matching "i32 64, metadata !} ; [ DW_TAG_pointer_type ]" 14 | // CHECK: i32 64, metadata {{![0-9]+\} ; \[ DW_TAG_pointer_type \]}} 15 | return a.fn1(1); 16 | } 17 | -------------------------------------------------------------------------------- /test/DEFormats.py: -------------------------------------------------------------------------------- 1 | import DETestRunner 2 | import lit.formats 3 | 4 | class CompilatorTest(lit.formats.FileBasedTest): 5 | def __init__(self, compilers, compiler_flags, language_flags, skip, xfails): 6 | self.compilers = compilers 7 | self.compiler_flags = compiler_flags 8 | self.language_flags = language_flags 9 | self.skip = skip 10 | self.xfails = xfails 11 | 12 | def execute(self, test, litConfig): 13 | return DETestRunner.executeCompilatorTest(test, litConfig, 14 | self.compilers, self.compiler_flags, self.language_flags, self.skip, 15 | self.xfails) 16 | -------------------------------------------------------------------------------- /test/validator/c++/nullptr14.C: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -xc++ -S -std=c++0x -o /dev/null %s 2 | // XFAIL: gcc-4.5 3 | // PR14777 4 | template struct tType_equal; 5 | template struct tType_equal { typedef void type; }; 6 | 7 | template 8 | inline typename tType_equal::type 9 | type_equal(U) { } 10 | 11 | char* f( char* ); 12 | int f( int ); 13 | long int f( long int ); 14 | 15 | void test_f() 16 | { 17 | // Overloading cases 18 | // 19 | type_equal(f(nullptr)); 20 | type_equal(f(0)); 21 | decltype(nullptr) mynull = 0; 22 | type_equal(f(mynull)); 23 | } 24 | -------------------------------------------------------------------------------- /test/validator/c++/2004-09-27-DidntEmitTemplate.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -xc++ %s -S -o - | FileCheck %s 2 | 3 | // This is a testcase for LLVM PR445, which was a problem where the 4 | // instantiation of callDefaultCtor was not being emitted correctly. 5 | 6 | struct Pass {}; 7 | 8 | template 9 | Pass *callDefaultCtor() { return new Pass(); } 10 | // CHECK: define linkonce_odr %struct.Pass* @_Z15callDefaultCtorI4PassEPS0_v 11 | 12 | void foo(Pass *(*C)()); 13 | 14 | struct basic_string { 15 | bool empty() const { return true; } 16 | }; 17 | 18 | 19 | bool foo2(basic_string &X) { 20 | return X.empty(); 21 | } 22 | void baz() { foo(callDefaultCtor); } 23 | -------------------------------------------------------------------------------- /test/compilator/local/2010-05-18-palignr.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc -mssse3 -S -o - %s | llc -mtriple=x86_64-apple-darwin | FileCheck %s 2 | // XFAIL: * 3 | // XTARGET: x86,i386,i686 4 | 5 | #include 6 | 7 | int main () 8 | { 9 | #if defined( __SSSE3__ ) 10 | 11 | #define vec_rld_epi16( _a, _i ) ({ vSInt16 _t = _a; _t = _mm_alignr_epi8( _t, _t, _i ); /*return*/ _t; }) 12 | typedef int16_t vSInt16 __attribute__ ((__vector_size__ (16))); 13 | 14 | short dtbl[] = {1,2,3,4,5,6,7,8}; 15 | vSInt16 *vdtbl = (vSInt16*) dtbl; 16 | 17 | vSInt16 v0; 18 | v0 = *vdtbl; 19 | // CHECK: pshufd $57 20 | v0 = vec_rld_epi16( v0, 4 ); 21 | 22 | return 0; 23 | #endif 24 | } 25 | -------------------------------------------------------------------------------- /test/compilator/local/2006-11-30-Pubnames.cpp: -------------------------------------------------------------------------------- 1 | // This is a regression test on debug info to make sure that we can access 2 | // qualified global names. 3 | // RUN: %llvmgcc -S -O0 -g %s -o - | \ 4 | // RUN: llc --disable-fp-elim -o %t.s -O0 5 | // RUN: %compile_c %t.s -o %t.o 6 | // RUN: %link %t.o -o %t.exe 7 | // RUN: %llvmdsymutil %t.exe 8 | // RUN: echo {break main\nrun\np Pubnames::pubname} > %t.in 9 | // RUN: gdb -q -batch -n -x %t.in %t.exe | tee %t.out | grep {\$1 = 10} 10 | // 11 | // XFAIL: alpha,arm 12 | 13 | struct Pubnames { 14 | static int pubname; 15 | }; 16 | 17 | int Pubnames::pubname = 10; 18 | 19 | int main (int argc, char** argv) { 20 | Pubnames p; 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /test/compilator/local/2007-07-04-NestedCatches.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgxx %s -S -O2 -o - | \ 2 | // RUN: ignore grep {eh\.selector.*One.*Two.*Three.*Four.*Five.*Six.*null} | \ 3 | // RUN: wc -l | grep {\[01\]} 4 | 5 | extern void X(void); 6 | 7 | struct One {}; 8 | struct Two {}; 9 | struct Three {}; 10 | struct Four {}; 11 | struct Five {}; 12 | struct Six {}; 13 | 14 | static void A(void) throw () 15 | { 16 | X(); 17 | } 18 | 19 | static void B(void) throw (Two) 20 | { 21 | try { A(); } catch (One) {} 22 | } 23 | 24 | static void C(void) throw (Six, Five) 25 | { 26 | try { B(); } catch (Three) {} catch (Four) {} 27 | } 28 | 29 | int main () 30 | { 31 | try { C(); } catch (...) {} 32 | } 33 | -------------------------------------------------------------------------------- /test/validator/c++/x86-64-abi-sret-vs-2word-struct-param.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S %s -o - | FileCheck %s 2 | // XFAIL: i386, i486, i586, i686 3 | 4 | struct S { 5 | void* data[3]; 6 | }; 7 | 8 | struct T { 9 | void* data[2]; 10 | }; 11 | 12 | extern "C" S fail(int, int, int, int, T t, void* p) { 13 | // CHECK: %struct.T* byval align 8 14 | S s; 15 | s.data[0] = t.data[0]; 16 | s.data[1] = t.data[1]; 17 | s.data[2] = p; 18 | return s; 19 | } 20 | 21 | extern "C" S* succeed(S* sret, int, int, int, int, T t, void* p) { 22 | // CHECK: %struct.T* byval align 8 23 | sret->data[0] = t.data[0]; 24 | sret->data[1] = t.data[1]; 25 | sret->data[2] = p; 26 | return sret; 27 | } 28 | -------------------------------------------------------------------------------- /test/compilator/local/2010-02-16-DbgVarScope.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc -S -O0 -g %s -o - | \ 2 | // RUN: llc --disable-fp-elim -o %t.s -O0 -relocation-model=pic 3 | // RUN: %compile_c %t.s -o %t.o 4 | // RUN: %link %t.o -o %t.exe 5 | // RUN: echo {break 24\nrun\np loc\n} > %t.in 6 | // RN: gdb -q -batch -n -x %t.in %t.exe | tee %t.out | \ 7 | // RN: grep {$1 = 1} 8 | 9 | int g1 = 1; 10 | int g2 = 2; 11 | 12 | int __attribute__((always_inline)) bar() { 13 | return g2 - g1; 14 | } 15 | void foobar() {} 16 | 17 | void foo(int s) { 18 | unsigned loc = 0; 19 | if (s) { 20 | loc = 1; 21 | foobar(); 22 | } else { 23 | loc = bar(); 24 | foobar(); 25 | } 26 | } 27 | 28 | int main() { 29 | foo(0); 30 | } 31 | -------------------------------------------------------------------------------- /test/compilator/local/pr17347.C: -------------------------------------------------------------------------------- 1 | extern "C++" 2 | { 3 | namespace std 4 | { 5 | class exception 6 | { 7 | public:exception () throw () 8 | { 9 | } virtual ~ exception () throw (); 10 | virtual const char *what () const throw (); 11 | }; 12 | } 13 | namespace __cxxabiv1 14 | { 15 | } 16 | namespace std 17 | { 18 | class bad_cast:public exception 19 | { 20 | public:bad_cast () throw () 21 | { 22 | } virtual ~ bad_cast () throw (); 23 | }; 24 | } 25 | } 26 | namespace __cxxabiv1 27 | { 28 | extern "C" void __cxa_bad_cast (); 29 | } 30 | extern "C" void 31 | __cxxabiv1::__cxa_bad_cast () 32 | { 33 | throw std::bad_cast (); 34 | } 35 | -------------------------------------------------------------------------------- /test/compilator/local/c++/2004-11-27-InlineAsmFunctionRedefinition.cpp: -------------------------------------------------------------------------------- 1 | // PR397 2 | 3 | struct stat { }; 4 | struct stat64 { }; 5 | 6 | extern "C" { 7 | 8 | extern int lstat(const char *, struct stat *) __asm__("lstat64"); 9 | extern int lstat64(const char *, struct stat64 *); 10 | 11 | extern int __lxstat(int, const char *, struct stat *) __asm__("__lxstat64"); 12 | extern int __lxstat64(int, const char *, struct stat64 *); 13 | 14 | extern __inline__ int lstat(const char *path, struct stat *statbuf) { 15 | return __lxstat(3, path, statbuf); 16 | } 17 | extern __inline__ int lstat64(const char *path, struct stat64 *statbuf) { 18 | return __lxstat64(3, path, statbuf); 19 | } 20 | } 21 | 22 | int do_one_file(void) { 23 | return lstat(0, 0) + lstat64(0,0); 24 | } 25 | -------------------------------------------------------------------------------- /test/compilator/local/facerec_fft2d_MINIMIZED.f90: -------------------------------------------------------------------------------- 1 | Module FFT2D 2 | Contains 3 | Subroutine FFT2DF (Space, Freq) 4 | Complex(4), Intent(In) :: Space (:, :) 5 | Complex(4), Pointer :: Freq (:, :) 6 | Integer :: I, SpaceShape (2) 7 | SpaceShape = SHAPE (Space) 8 | If (ASSOCIATED (Freq)) Then 9 | If (SpaceShape (1) /= SIZE (Freq, 2) .OR. & 10 | & SpaceShape (2) /= SIZE (Freq, 1)) Then 11 | End If 12 | End If 13 | Do I = 1, ColLen 14 | End Do 15 | End Subroutine FFT2DF 16 | Subroutine FFT2DB (Freq, Space) 17 | Complex(4), Pointer :: Space (:, :) 18 | If (ASSOCIATED (Space)) Then 19 | If (FreqShape (1) /= SIZE (Space, 2) .OR. & 20 | & FreqShape (2) /= SIZE (Space, 1)) Then 21 | End If 22 | End If 23 | End Subroutine FFT2DB 24 | End Module FFT2D 25 | -------------------------------------------------------------------------------- /test/compilator/local/2007-02-05-nested.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc -S -fnested-functions -O0 -o - %s 2 | // PR915 3 | 4 | extern void abort(void); 5 | 6 | void nest(int n) 7 | { 8 | int a = 0; 9 | int b = 5; 10 | int c = 0; 11 | int d = 7; 12 | 13 | void o(int i, int j) 14 | { 15 | if (i!=j) 16 | abort(); 17 | } 18 | 19 | void f(x) 20 | int x; /* K&R style */ 21 | { 22 | int e = 0; 23 | int f = 2; 24 | int g = 0; 25 | 26 | void y(void) 27 | { 28 | c = n; 29 | e = 1; 30 | g = x; 31 | } 32 | 33 | void z(void) 34 | { 35 | a = 4; 36 | g = 3; 37 | } 38 | 39 | a = 5; 40 | y(); 41 | c = x; 42 | z(); 43 | o(1,e); 44 | o(2,f); 45 | o(3,g); 46 | } 47 | 48 | c = 2; 49 | f(6); 50 | o(4,a); 51 | o(5,b); 52 | o(6,c); 53 | o(7,d); 54 | } 55 | -------------------------------------------------------------------------------- /test/validator/fortran/2012-11-29-VectorCstCast.f: -------------------------------------------------------------------------------- 1 | C RUN: %dragonegg -S %s -o - -O1 -ftree-vectorize -fplugin-arg-dragonegg-enable-gcc-optzns -fdefault-integer-8 -ffixed-line-length-120 -fno-second-underscore 2 | C PR13561 3 | 4 | SUBROUTINE scratc(hpspnp) 5 | IMPLICIT NONE 6 | 7 | INTEGER HEAPDM 8 | PARAMETER (HEAPDM=2) 9 | INTEGER HEAP(HEAPDM) 10 | COMMON // HEAP 11 | 12 | integer hpspnp(*) 13 | INTEGER N 14 | 15 | INTEGER p_UPHBLS 16 | COMMON p_UPHBLS 17 | 18 | LOGICAL UPBOND, UPANGL, UPDIHE, UPIMPR 19 | COMMON /UPCOD/ UPBOND, UPANGL, UPDIHE, UPIMPR 20 | 21 | UPBOND=.TRUE. 22 | UPANGL=.TRUE. 23 | UPDIHE=.TRUE. 24 | UPIMPR=.TRUE. 25 | DO N=1,10 26 | call assign_logical(heap(p_UPHBLS),N,.TRUE.) 27 | ENDDO 28 | RETURN 29 | END 30 | -------------------------------------------------------------------------------- /test/validator/fortran/2012-04-24-CondExpr.f90: -------------------------------------------------------------------------------- 1 | ! RUN: %dragonegg -S %s -O3 -fplugin-arg-dragonegg-enable-gcc-optzns 2 | ! PR12609 3 | MODULE MAIN1 4 | INTEGER :: IHOUR , ISEAS , IREC , IGRP , NUMREC , NUMGRP 5 | REAL , ALLOCATABLE :: SHVALS(:,:,:,:,:) 6 | INTEGER :: NSEAHR(4,24) , NSEACM(4,24) 7 | END 8 | 9 | PROGRAM SHAVE 10 | USE MAIN1 11 | REAL :: SNUM 12 | DO ISEAS = 1 , 4 13 | DO IHOUR = 1 , 24 14 | SNUM = NSEAHR(ISEAS,IHOUR) - NSEACM(ISEAS,IHOUR) 15 | DO IGRP = 1 , NUMGRP 16 | DO IREC = 1 , NUMREC 17 | SHVALS(IREC,IGRP,ISEAS,IHOUR,1) = (1./SNUM) & 18 | & *SHVALS(IREC,IGRP,ISEAS,IHOUR,1) 19 | ENDDO 20 | ENDDO 21 | ENDDO 22 | ENDDO 23 | CONTINUE 24 | END 25 | -------------------------------------------------------------------------------- /test/compilator/local/2010-07-27-MinNoFoldConst.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc -S %s -o - | FileCheck %s 2 | extern int printf(const char *, ...); 3 | static void bad(unsigned int v1, unsigned int v2) { 4 | printf("%u\n", 1631381461u * (((v2 - 1273463329u <= v1 - 1273463329u) ? v2 : v1) - 1273463329u) + 121322179u); 5 | } 6 | // Radar 8198362 7 | // GCC FE wants to convert the above to 8 | // 1631381461u * MIN(v2 - 1273463329u, v1 - 1273463329u) 9 | // and then to 10 | // MIN(1631381461u * v2 - 4047041419, 1631381461u * v1 - 4047041419) 11 | // 12 | // 1631381461u * 1273463329u = 2077504466193943669, but 32-bit overflow clips 13 | // this to 4047041419. This breaks the comparision implicit in the MIN(). 14 | // Two multiply operations suggests the bad optimization is happening; 15 | // one multiplication, after the MIN(), is correct. 16 | // CHECK: mul 17 | // CHECK-NOT: mul 18 | // CHECK: ret 19 | -------------------------------------------------------------------------------- /test/validator/c++/weak-external.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg %s -S -O2 -o - | FileCheck %s 2 | // PR4262 3 | 4 | // The "basic_string" extern template instantiation declaration is supposed to 5 | // suppress the implicit instantiation of non-inline member functions. Make sure 6 | // that we suppress the implicit instantiation of non-inline member functions 7 | // defined out-of-line. That we aren't instantiating the basic_string 8 | // constructor when we shouldn't be. Such an instantiation forces the implicit 9 | // instantiation of _S_construct. Since _S_construct is a member 10 | // template, it's instantiation is *not* suppressed (despite being in 11 | // basic_string), so we would emit it as a weak definition. 12 | 13 | #include 14 | 15 | void dummysymbol() { 16 | throw(std::runtime_error("string")); 17 | } 18 | // CHECK-NOT: _ZNSs12_S_constructIPKcEEPcT_S3_RKSaIcESt20forward_iterator_tag 19 | -------------------------------------------------------------------------------- /test/compilator/local/fortran/2009-02-09-FloorDivExpr.f90: -------------------------------------------------------------------------------- 1 | ! PR2437 2 | program main 3 | implicit none 4 | call build (77) 5 | contains 6 | subroutine build (order) 7 | integer :: order, i, j 8 | 9 | 10 | call test (1, order, 3, (/ (i, i = 1, order, 3) /)) 11 | call test (order, 1, -3, (/ (i, i = order, 1, -3) /)) 12 | 13 | do j = -10, 10 14 | call test (order + j, order, 5, (/ (i, i = order + j, order, 5) /)) 15 | call test (order + j, order, -5, (/ (i, i = order + j, order, -5) /)) 16 | end do 17 | 18 | end subroutine build 19 | 20 | subroutine test (from, to, step, values) 21 | integer, dimension (:) :: values 22 | integer :: from, to, step, last, i 23 | 24 | last = 0 25 | do i = from, to, step 26 | last = last + 1 27 | if (values (last) .ne. i) call abort 28 | end do 29 | if (size (values, dim = 1) .ne. last) call abort 30 | end subroutine test 31 | end program main 32 | -------------------------------------------------------------------------------- /test/compilator/local/2009-07-15-LineNumbers.cpp: -------------------------------------------------------------------------------- 1 | // This is a regression test on debug info to make sure that we can 2 | // print line numbers in asm. 3 | // RUN: %llvmgcc -S -O0 -g %s -o - | \ 4 | // RUN: llc --disable-fp-elim -O0 -relocation-model=pic | grep {2009-07-15-LineNumbers.cpp:25$} 5 | 6 | #include 7 | 8 | class DeepStack { 9 | int seedVal; 10 | public: 11 | DeepStack(int seed) : seedVal(seed) {} 12 | 13 | int shallowest( int x ) { return shallower(x + 1); } 14 | int shallower ( int x ) { return shallow(x + 2); } 15 | int shallow ( int x ) { return deep(x + 3); } 16 | int deep ( int x ) { return deeper(x + 4); } 17 | int deeper ( int x ) { return deepest(x + 6); } 18 | int deepest ( int x ) { return x + 7; } 19 | 20 | int runit() { return shallowest(seedVal); } 21 | }; 22 | 23 | int main ( int argc, char** argv) { 24 | 25 | DeepStack DS9( (argc > 1 ? atoi(argv[1]) : 0) ); 26 | return DS9.runit(); 27 | } 28 | -------------------------------------------------------------------------------- /test/compilator/local/pr11058.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | typedef uint8_t Uint8; 3 | typedef uint16_t Uint16; 4 | typedef uint32_t Uint32; 5 | typedef int16_t Int16; 6 | struct SelectiveAck 7 | { 8 | Uint8 extension; 9 | Uint8 length; 10 | Uint8* bitmask; 11 | }; 12 | bool Acked(const SelectiveAck* sack, Uint16 bit) 13 | { 14 | // check bounds 15 | if (bit < 2 || bit > 8*sack->length + 1) 16 | return false; 17 | 18 | const Uint8* bitset = sack->bitmask; 19 | int byte = (bit - 2) / 8; 20 | int bit_off = (bit - 2) % 8; 21 | return bitset[byte] & (0x01 << bit_off); 22 | } 23 | Uint16 test(const SelectiveAck* sack) 24 | { 25 | // A packet is lost if 3 packets have been acked after it 26 | Uint32 acked = 0; 27 | Int16 i = sack->length * 8 - 1; 28 | while (i >= 0 && acked < 3) 29 | { 30 | if (Acked(sack, i)) 31 | { 32 | acked++; 33 | if (acked == 3) 34 | return i; 35 | } 36 | 37 | i--; 38 | } 39 | 40 | return 0; 41 | } 42 | int main() { 43 | } 44 | -------------------------------------------------------------------------------- /test/validator/objc/2008-10-3-EhValue.m: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -fobjc-exceptions -w -x objective-c -S %s -o /dev/null 2 | 3 | @interface Object { 4 | @public 5 | Class isa; 6 | } 7 | +initialize; 8 | +alloc; 9 | +new; 10 | +free; 11 | -free; 12 | +(Class)class; 13 | -(Class)class; 14 | -init; 15 | -superclass; 16 | -(const char *)name; 17 | @end 18 | 19 | @interface Frob: Object 20 | @end 21 | 22 | @implementation Frob: Object 23 | @end 24 | 25 | static Frob* _connection = ((void *)0); 26 | 27 | extern void abort(void); 28 | 29 | void test (Object* sendPort) 30 | { 31 | int cleanupPorts = 1; 32 | Frob* receivePort = ((void *)0); 33 | 34 | @try { 35 | receivePort = (Frob *) -1; 36 | _connection = (Frob *) -1; 37 | receivePort = ((void *)0); 38 | sendPort = ((void *)0); 39 | cleanupPorts = 0; 40 | @throw [Object new]; 41 | } 42 | @catch(Frob *obj) { 43 | if(!(0)) abort(); 44 | } 45 | @catch(id exc) { 46 | if(!(!receivePort)) abort(); 47 | if(!(!sendPort)) abort(); 48 | if(!(!cleanupPorts)) abort(); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /test/validator/c++/nullptr21.C: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -xc++ -S -std=c++0x -o /dev/null %s 2 | // XFAIL: gcc-4.5 3 | // PR14777 4 | extern "C" void abort (void); 5 | 6 | typedef decltype(nullptr) nullptr_t; 7 | 8 | int result[2]; 9 | 10 | void __attribute__((noinline)) 11 | foo (int i, int j) 12 | { 13 | result[i] = j; 14 | } 15 | 16 | int main() 17 | { 18 | try { 19 | throw nullptr; 20 | } catch (void*) { 21 | foo (0, 1); 22 | } catch (bool) { 23 | foo (0, 2); 24 | } catch (int) { 25 | foo (0, 3); 26 | } catch (long int) { 27 | foo (0, 4); 28 | } catch (nullptr_t) { 29 | foo (0, 5); 30 | } catch (...) { 31 | foo (0, 6); 32 | } 33 | 34 | nullptr_t mynull = 0; 35 | try { 36 | throw mynull; 37 | } catch (void*) { 38 | foo (1, 1); 39 | } catch (bool) { 40 | foo (1, 2); 41 | } catch (int) { 42 | foo (1, 3); 43 | } catch (long int) { 44 | foo (1, 4); 45 | } catch (nullptr_t) { 46 | foo (1, 5); 47 | } catch (...) { 48 | foo (1, 6); 49 | } 50 | 51 | if (result[0] != 5 || result[1] != 5) 52 | abort (); 53 | } 54 | -------------------------------------------------------------------------------- /test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(GCC ${DRAGONEGG_TARGET_GCC}) 2 | set(TARGET_TRIPLE "${TARGET_TRIPLE}-gcc-${GCC_MAJOR}.${GCC_MINOR}") 3 | set(TEST_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/Output") 4 | 5 | get_property(DRAGONEGG_PLUGIN TARGET dragonegg PROPERTY LOCATION) 6 | 7 | configure_lit_site_cfg( 8 | ${CMAKE_CURRENT_SOURCE_DIR}/dragonegg-lit.site.cfg.in 9 | ${CMAKE_CURRENT_BINARY_DIR}/dragonegg-lit.site.cfg 10 | ) 11 | 12 | # Exclude a couple of tests below out of check-all. 13 | set(EXCLUDE_FROM_ALL ON) 14 | 15 | add_lit_testsuite(check-dragonegg-validator "Running the DragonEgg's validator tests" 16 | ${CMAKE_CURRENT_SOURCE_DIR}/validator 17 | --config-prefix=validator-lit 18 | PARAMS site=${CMAKE_CURRENT_BINARY_DIR}/dragonegg-lit.site.cfg 19 | DEPENDS dragonegg 20 | llvm-as 21 | FileCheck count not 22 | ) 23 | 24 | add_lit_testsuite(check-dragonegg-compilator "Running the DragonEgg's compilator tests" 25 | --config-prefix=compilator-lit 26 | ${CMAKE_CURRENT_SOURCE_DIR}/compilator 27 | PARAMS site=${CMAKE_CURRENT_BINARY_DIR}/dragonegg-lit.site.cfg 28 | DEPENDS dragonegg FileCheck 29 | ) 30 | -------------------------------------------------------------------------------- /test/compilator/local/UnderAligned.ii: -------------------------------------------------------------------------------- 1 | typedef long unsigned int size_t; 2 | extern "C" { 3 | extern void *memcpy (void *__restrict __dest, 4 | __const void *__restrict __src, size_t __n) 5 | throw () __attribute__ ((__nonnull__ (1, 2))); 6 | } 7 | typedef unsigned long int uint64_t; 8 | inline uint64_t fetch64(const char *p) { 9 | uint64_t result; 10 | memcpy(&result, p, sizeof(result)); 11 | return result; 12 | } 13 | const uint64_t bigarr[] = { 14 | 0xaaaaaaaaababababULL, 0xacacacacbcbcbcbcULL, 0xccddeeffeeddccbbULL, 15 | 0xdeadbeafdeadbeefULL, 0xfefefefededededeULL, 0xafafafafededededULL, 16 | 0xffffeeeeddddccccULL, 0xaaaacbcbffffababULL, 17 | 0xaaaaaaaaababababULL, 0xacacacacbcbcbcbcULL, 0xccddeeffeeddccbbULL, 18 | 0xdeadbeafdeadbeefULL, 0xfefefefededededeULL, 0xafafafafededededULL, 19 | 0xffffeeeeddddccccULL, 0xaaaacbcbffffababULL, 20 | 0xaaaaaaaaababababULL, 0xacacacacbcbcbcbcULL, 0xccddeeffeeddccbbULL, 21 | 0xdeadbeafdeadbeefULL, 0xfefefefededededeULL, 0xafafafafededededULL, 22 | 0xffffeeeeddddccccULL, 0xaaaacbcbffffababULL 23 | }; 24 | const uint64_t *M() { 25 | return &bigarr[0]; 26 | } 27 | -------------------------------------------------------------------------------- /test/compilator/local/2010-08-31-ByValArg.cpp: -------------------------------------------------------------------------------- 1 | // This regression test checks byval arguments' debug info. 2 | // Radar 8367011 3 | // RUN: %llvmgcc -S -O0 -g %s -o - | \ 4 | // RUN: llc --disable-fp-elim -o %t.s -O0 -relocation-model=pic 5 | // RUN: %compile_c %t.s -o %t.o 6 | // RUN: %link %t.o -o %t.exe 7 | // RUN: echo {break get\nrun\np missing_arg.b} > %t.in 8 | // RUN: gdb -q -batch -n -x %t.in %t.exe | tee %t.out | \ 9 | // RUN: grep {1 = 4242} 10 | 11 | // XTARGET: x86_64-apple-darwin 12 | 13 | class EVT { 14 | public: 15 | int a; 16 | int b; 17 | int c; 18 | }; 19 | 20 | class VAL { 21 | public: 22 | int x; 23 | int y; 24 | }; 25 | void foo(EVT e); 26 | EVT bar(); 27 | 28 | void get(int *i, unsigned dl, VAL v, VAL *p, unsigned n, EVT missing_arg) { 29 | //CHECK: .ascii "missing_arg" 30 | EVT e = bar(); 31 | if (dl == n) 32 | foo(missing_arg); 33 | } 34 | 35 | 36 | EVT bar() { 37 | EVT e; 38 | return e; 39 | } 40 | 41 | void foo(EVT e) {} 42 | 43 | int main(){ 44 | VAL v; 45 | EVT ma; 46 | ma.a = 1; 47 | ma.b = 4242; 48 | ma.c = 3; 49 | int i = 42; 50 | get (&i, 1, v, &v, 2, ma); 51 | return 0; 52 | } 53 | 54 | -------------------------------------------------------------------------------- /test/validator/fortran/2012-04-25-VecPermExpr.f90: -------------------------------------------------------------------------------- 1 | ! RUN: %dragonegg -S %s -O3 -fplugin-arg-dragonegg-enable-gcc-optzns 2 | ! PR12610 3 | 4 | module solv_cap 5 | integer, parameter, public :: dp = selected_real_kind(5) 6 | real(kind=dp), private :: D1, D2 7 | integer, private, save :: Ng1=0, Ng2=0 8 | integer, private, pointer, dimension(:,:) :: Grid 9 | contains 10 | subroutine Preco(X) 11 | real(kind=dp), intent(in out), dimension(0:,0:) :: X 12 | complex(kind=dp), allocatable, dimension(:,:) :: t 13 | real(kind=dp) :: K0, D 14 | integer :: i, j, is, js 15 | allocate( t(0:Ng1-1,0:Ng2-1) ) 16 | t = X 17 | call Fourir2D(t, 1) 18 | K0 = 0.15_dp 19 | do j=0,Ng2-1 20 | js = min(j, Ng2-j) 21 | do i=0,Ng1-1 22 | is = min(i, Ng1-i) 23 | D = sqrt( (K0+is**2)/(D1*Ng1)**2 + (K0+js**2)/(D2*Ng2)**2 ) 24 | t(i,j) = t(i,j) * D 25 | end do 26 | end do 27 | call Fourir2D(t, -1) 28 | X = t(0:Ng1-1,0:Ng2-1) 29 | where (Grid==0) 30 | X = 0 31 | end where 32 | deallocate( t ) 33 | return 34 | end subroutine Preco 35 | end 36 | program capacitance 37 | end 38 | -------------------------------------------------------------------------------- /test/validator/objc/2010-03-17-StructRef.m: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg %s -S -o - | FileCheck %s 2 | // Bitfield references must not touch memory outside of the enclosing 3 | // struct. Radar 7639995 4 | typedef signed char BOOL; 5 | @protocol NSObject 6 | - (id)init; 7 | @end 8 | @interface NSObject {} 9 | @end 10 | @interface IMAVChatParticipant : NSObject { 11 | int _ardRole; 12 | int _state; 13 | int _avRelayStatus; 14 | int _chatEndedReason; 15 | int _chatError; 16 | unsigned _sendingAudio:1; 17 | unsigned _sendingVideo:1; 18 | unsigned _sendingAuxVideo:1; 19 | unsigned _audioMuted:1; 20 | unsigned _videoPaused:1; 21 | unsigned _networkStalled:1; 22 | unsigned _isInitiator:1; 23 | unsigned _isAOLInterop:1; 24 | unsigned _isRecording:1; 25 | unsigned _isUsingICE:1; 26 | } 27 | @end 28 | @implementation IMAVChatParticipant 29 | - (id) init { 30 | self = [super init]; 31 | if ( self ) { 32 | BOOL blah = (BOOL)1; 33 | // We're expecting these three bitfield assignments will generate i8 stores. 34 | _sendingAudio = (BOOL)1; 35 | _isUsingICE = (BOOL)1; 36 | _isUsingICE = blah; 37 | // CHECK: store i8 38 | // CHECK: store i8 39 | // CHECK: store i8 40 | } 41 | return self; 42 | } 43 | @end 44 | -------------------------------------------------------------------------------- /test/validator/c++/nullptr11.C: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -xc++ -S -std=c++0x -o /dev/null %s 2 | // XFAIL: gcc-4.5 3 | // PR14777 4 | #define assert_true(b) do { char c[2 * bool(b) - 1]; } while(0) 5 | #define assert_false(b) do { char c[1 - 2 * bool(b)]; } while(0) 6 | 7 | void fun() 8 | { 9 | assert_true(nullptr == nullptr); 10 | assert_false(nullptr != nullptr); 11 | assert_false(nullptr < nullptr); 12 | assert_false(nullptr > nullptr); 13 | assert_true(nullptr <= nullptr); 14 | assert_true(nullptr >= nullptr); 15 | 16 | decltype(nullptr) mynull = 0; 17 | 18 | assert_true(mynull == nullptr); 19 | assert_false(mynull != nullptr); 20 | assert_false(mynull < nullptr); 21 | assert_false(mynull > nullptr); 22 | assert_true(mynull <= nullptr); 23 | assert_true(mynull >= nullptr); 24 | 25 | assert_true(nullptr == mynull); 26 | assert_false(nullptr != mynull); 27 | assert_false(nullptr < mynull); 28 | assert_false(nullptr > mynull); 29 | assert_true(nullptr <= mynull); 30 | assert_true(nullptr >= mynull); 31 | 32 | assert_true(mynull == mynull); 33 | assert_false(mynull != mynull); 34 | assert_false(mynull < mynull); 35 | assert_false(mynull > mynull); 36 | assert_true(mynull <= mynull); 37 | assert_true(mynull >= mynull); 38 | } 39 | -------------------------------------------------------------------------------- /test/validator/c/2012-09-08-BitfieldAlignment.c: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S %s -o - | FileCheck %s 2 | // Check that bitfields are aligned properly. 3 | 4 | struct __attribute__ ((__packed__)) __attribute__ ((aligned (4))) Foo { 5 | int aligned; 6 | unsigned char aligned4_a : 3; 7 | unsigned char aligned4_b : 3; 8 | unsigned char aligned4_c : 3; 9 | unsigned char aligned1_a : 3; 10 | unsigned char aligned1_b : 3; 11 | unsigned char aligned1_c : 3; 12 | unsigned char aligned2 : 3; 13 | }; 14 | 15 | extern void baz(struct Foo *); 16 | 17 | void bar() { 18 | struct Foo foo; 19 | foo.aligned4_a = 7; 20 | // CHECK: load i8* {{.*}}, align 4 21 | // CHECK: store i8 {{.*}}, align 4 22 | foo.aligned4_b = 7; 23 | // CHECK: load i8* {{.*}}, align 4 24 | // CHECK: store i8 {{.*}}, align 4 25 | foo.aligned4_c = 7; 26 | // CHECK: load i16* {{.*}}, align 4 27 | // CHECK: store i16 {{.*}}, align 4 28 | foo.aligned1_a = 7; 29 | // CHECK: load i8* {{.*}}, align 1 30 | // CHECK: store i8 {{.*}}, align 1 31 | foo.aligned1_b = 7; 32 | // CHECK: load i8* {{.*}}, align 1 33 | // CHECK: store i8 {{.*}}, align 1 34 | foo.aligned1_c = 7; 35 | // CHECK: load i16* {{.*}}, align 1 36 | // CHECK: store i16 {{.*}}, align 1 37 | foo.aligned2 = 7; 38 | // CHECK: load i8* {{.*}}, align 2 39 | // CHECK: store i8 {{.*}}, align 2 40 | baz(&foo); 41 | } 42 | -------------------------------------------------------------------------------- /test/validator/c/ThreadLocalVariables.c: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -fpic -O -S %s -o - | FileCheck %s 2 | 3 | __thread __attribute((tls_model("global-dynamic"))) int a; 4 | __thread __attribute((tls_model("local-dynamic"))) int b; 5 | __thread __attribute((tls_model("initial-exec"))) int c; 6 | __thread __attribute((tls_model("local-exec"))) int d; 7 | __thread int e; 8 | 9 | // CHECK: @e = thread_local unnamed_addr global i32 0 10 | // CHECK: @d = thread_local(localexec) unnamed_addr global i32 0 11 | // CHECK: @c = thread_local(initialexec) unnamed_addr global i32 0 12 | // CHECK: @b = thread_local(localdynamic) unnamed_addr global i32 0 13 | // CHECK: @a = thread_local unnamed_addr global i32 0 14 | 15 | extern __thread __attribute((tls_model("global-dynamic"))) int f; 16 | extern __thread __attribute((tls_model("local-dynamic"))) int g; 17 | extern __thread __attribute((tls_model("initial-exec"))) int h; 18 | extern __thread __attribute((tls_model("local-exec"))) int i; 19 | extern __thread int j; 20 | 21 | // CHECK: @f = external thread_local global i32 22 | // CHECK: @g = external thread_local(localdynamic) global i32 23 | // CHECK: @h = external thread_local(initialexec) global i32 24 | // CHECK: @i = external thread_local(localexec) global i32 25 | // CHECK: @j = external thread_local global i32 26 | 27 | int foo(void) { 28 | return f + g + h + i + j; 29 | } 30 | -------------------------------------------------------------------------------- /test/validator/c++/2009-06-20-DarwinPPCLayout.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S -m32 %s -o - | grep baz | grep global | grep {struct.bar} 2 | // RUN: %dragonegg -S -m32 %s -o - | grep ccc | grep global | grep {struct.CC} 3 | // RUN: %dragonegg -S -m32 %s -o - | grep quux | grep global | grep {struct.bar} 4 | // RUN: %dragonegg -S -m32 %s -o - | grep foo | grep global | grep {struct.SRCFilter::FilterEntry} 5 | // RUN: %dragonegg -S -m32 %s -o - | grep {struct.bar} | grep {1 x i32} 6 | // RUN: %dragonegg -S -m32 %s -o - | grep {struct.CC} | grep {struct.payre struct payre { 12 | _T1 first; 13 | _T2 second; 14 | payre() : first(), second() { } 15 | }; 16 | struct KBFP { 17 | double mCutoffFrequency; 18 | }; 19 | class SRCFilter { 20 | struct FilterEntry: public payre{}; 21 | static FilterEntry foo; 22 | }; 23 | SRCFilter::FilterEntry SRCFilter::foo; // 12 bytes 24 | payre baz; // 16 bytes 25 | class CC { // 16 bytes 26 | public: payre x; 27 | }; 28 | class CC ccc; 29 | 30 | struct bar { KBFP x; float* y;}; // 16 bytes 31 | struct bar quux; 32 | 33 | -------------------------------------------------------------------------------- /test/compilator/local/2006-11-06-StackTrace.cpp: -------------------------------------------------------------------------------- 1 | // This is a regression test on debug info to make sure that we can get a 2 | // meaningful stack trace from a C++ program. 3 | // RUN: %llvmgcc -S -O0 -g %s -o - | \ 4 | // RUN: llc --disable-fp-elim -o %t.s -O0 -relocation-model=pic 5 | // RUN: %compile_c %t.s -o %t.o 6 | // RUN: %link %t.o -o %t.exe 7 | // RUN: echo {break DeepStack::deepest\nrun 17\nwhere\n} > %t.in 8 | // RN: gdb -q -batch -n -x %t.in %t.exe | tee %t.out | \ 9 | // RN: grep {#0 DeepStack::deepest.*(this=.*,.*x=33)} 10 | // RN: gdb -q -batch -n -x %t.in %t.exe | \ 11 | // RN: grep {#7 0x.* in main.*(argc=\[12\],.*argv=.*)} 12 | 13 | // Only works on ppc (but not apple-darwin9), x86 and x86_64. Should 14 | // generalize? 15 | // XAIL: alpha,arm,powerpc-apple-darwin9 16 | 17 | #include 18 | 19 | class DeepStack { 20 | int seedVal; 21 | public: 22 | DeepStack(int seed) : seedVal(seed) {} 23 | 24 | int shallowest( int x ) { return shallower(x + 1); } 25 | int shallower ( int x ) { return shallow(x + 2); } 26 | int shallow ( int x ) { return deep(x + 3); } 27 | int deep ( int x ) { return deeper(x + 4); } 28 | int deeper ( int x ) { return deepest(x + 6); } 29 | int deepest ( int x ) { return x + 7; } 30 | 31 | int runit() { return shallowest(seedVal); } 32 | }; 33 | 34 | int main ( int argc, char** argv) { 35 | 36 | DeepStack DS9( (argc > 1 ? atoi(argv[1]) : 0) ); 37 | return DS9.runit(); 38 | } 39 | -------------------------------------------------------------------------------- /test/README: -------------------------------------------------------------------------------- 1 | -------------- 2 | - Compilator - 3 | -------------- 4 | 5 | Every file found under the compilator directory is compiled by GCC both with and 6 | without the DragonEgg plugin, at a variety of optimization levels. If GCC can 7 | compile a file but DragonEgg cannot, or DragonEgg can compile the file but GCC 8 | cannot, then that test is considered to have failed. Note that the generated 9 | code is *not* checked for correctness. 10 | 11 | External source 12 | --------------- 13 | 14 | You should either checkout the GCC testsuite in the compilator directory or use 15 | a symbolic link to ensure that compilator/gcc-testsuite means the gcc/testsuite/ 16 | directory from the GCC source tree. 17 | 18 | For testing C/C++, consider having compilator/clang-test be a symbolic link to 19 | Clang's test directory, and compilator/llvm-test-suite a symbolic link to LLVM's 20 | nightly testsuite. 21 | 22 | For testing Fortran, consider putting a copy of the LAPACK source distribution 23 | in the compilator directory. Note that LAPACK includes a copy of the BLAS. A 24 | few other interesting collections of Fortran source code: 25 | The NIST Fortran 77 test suite 26 | The polyhedron benchmarks 27 | 28 | For testing Java, consider having compilator/gcc-libjava be a symbolic link to 29 | GCC's libjava. 30 | 31 | 32 | --------------- 33 | -- Validator -- 34 | --------------- 35 | 36 | The validator directory contains tests that check the correctness of generated 37 | code. 38 | -------------------------------------------------------------------------------- /test/compilator/local/2006-11-30-NoCompileUnit.cpp: -------------------------------------------------------------------------------- 1 | // This is a regression test on debug info to make sure we don't hit a compile 2 | // unit size issue with gdb. 3 | // RUN: %llvmgcc -S -O0 -g %s -o - | \ 4 | // RUN: llc --disable-fp-elim -o NoCompileUnit.s 5 | // RUN: %compile_c NoCompileUnit.s -o NoCompileUnit.o 6 | // RUN: %link NoCompileUnit.o -o NoCompileUnit.exe 7 | // RUN: echo {break main\nrun\np NoCompileUnit::pubname} > %t2 8 | // RUN: gdb -q -batch -n -x %t2 NoCompileUnit.exe | \ 9 | // RUN: tee NoCompileUnit.out | not grep {"low == high"} 10 | // XFAIL: alpha,arm 11 | // XFAIL: * 12 | // See PR2454 13 | 14 | 15 | class MamaDebugTest { 16 | private: 17 | int N; 18 | 19 | protected: 20 | MamaDebugTest(int n) : N(n) {} 21 | 22 | int getN() const { return N; } 23 | 24 | }; 25 | 26 | class BabyDebugTest : public MamaDebugTest { 27 | private: 28 | 29 | public: 30 | BabyDebugTest(int n) : MamaDebugTest(n) {} 31 | 32 | static int doh; 33 | 34 | int doit() { 35 | int N = getN(); 36 | int Table[N]; 37 | 38 | int sum = 0; 39 | 40 | for (int i = 0; i < N; ++i) { 41 | int j = i; 42 | Table[i] = j; 43 | } 44 | for (int i = 0; i < N; ++i) { 45 | int j = Table[i]; 46 | sum += j; 47 | } 48 | 49 | return sum; 50 | } 51 | 52 | }; 53 | 54 | int BabyDebugTest::doh; 55 | 56 | 57 | int main(int argc, const char *argv[]) { 58 | BabyDebugTest BDT(20); 59 | return BDT.doit(); 60 | } 61 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #==============================================================================# 2 | # This file specifies intentionally untracked files that git should ignore. 3 | # See: http://www.kernel.org/pub/software/scm/git/docs/gitignore.html 4 | # 5 | # This file is intentionally different from the output of `git svn show-ignore`, 6 | # as most of those are useless. 7 | #==============================================================================# 8 | 9 | #==============================================================================# 10 | # File extensions to be ignored anywhere in the tree. 11 | #==============================================================================# 12 | # Temp files created by most text editors. 13 | *~ 14 | # Merge files created by git. 15 | *.orig 16 | # Byte compiled python modules. 17 | *.pyc 18 | # vim swap files 19 | .*.swp 20 | .sw? 21 | # In-tree build files 22 | *.d 23 | *.o 24 | 25 | #==============================================================================# 26 | # Explicit files to ignore (only matches one). 27 | #==============================================================================# 28 | /.gitusers 29 | 30 | # Generated files 31 | /TargetInfo 32 | /dragonegg.so 33 | /test/*lit.site.cfg 34 | 35 | #==============================================================================# 36 | # Directories to ignore (do not add trailing '/'s, they skip symlinks). 37 | #==============================================================================# 38 | # Lit outputs 39 | /test/Output 40 | -------------------------------------------------------------------------------- /include/dragonegg/Aliasing.h: -------------------------------------------------------------------------------- 1 | //=------- Aliasing.h - Type-based alias analysis metadata --------*- C++ -*-=// 2 | // 3 | // Copyright (C) 2012 to 2013 Duncan Sands. 4 | // 5 | // This file is part of DragonEgg. 6 | // 7 | // DragonEgg is free software; you can redistribute it and/or modify it under 8 | // the terms of the GNU General Public License as published by the Free Software 9 | // Foundation; either version 2, or (at your option) any later version. 10 | // 11 | // DragonEgg is distributed in the hope that it will be useful, but WITHOUT ANY 12 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 13 | // A PARTICULAR PURPOSE. See the GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License along with 16 | // DragonEgg; see the file COPYING. If not, write to the Free Software 17 | // Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. 18 | // 19 | //===----------------------------------------------------------------------===// 20 | // This file declares routines for generating TBAA metadata from what GCC knows 21 | // about pointer aliasing. 22 | //===----------------------------------------------------------------------===// 23 | 24 | #ifndef DRAGONEGG_ALIASING_H 25 | #define DRAGONEGG_ALIASING_H 26 | 27 | // Forward declarations. 28 | namespace llvm { class MDNode; } 29 | union tree_node; 30 | 31 | /// describeAliasSet - Return TBAA metadata describing what a load from or store 32 | /// to the given tree may alias. 33 | extern llvm::MDNode *describeAliasSet(tree_node *t); 34 | 35 | #endif /* DRAGONEGG_ALIASING_H */ 36 | -------------------------------------------------------------------------------- /test/validator/c++/2007-04-11-InlineStorageClassC++.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg %s -S -O0 -o - | grep define | \ 2 | // RUN: grep xglobWeak | grep linkonce | count 1 3 | // RUN: %dragonegg %s -S -O0 -o - | grep define | \ 4 | // RUN: grep xextWeak | grep linkonce | count 1 5 | // RUN: %dragonegg %s -S -O0 -o - | grep define | \ 6 | // RUN: grep xWeaknoinline | grep weak | count 1 7 | // RUN: %dragonegg %s -S -O0 -o - | grep define | \ 8 | // RUN: grep xWeakextnoinline | grep weak | count 1 9 | // RUN: %dragonegg %s -S -O0 -o - | grep define | \ 10 | // RUN: grep xglobnoWeak | grep linkonce | count 1 11 | // RUN: %dragonegg %s -S -O0 -o - | grep define | \ 12 | // RUN: grep xstatnoWeak | grep internal | count 1 13 | // RUN: %dragonegg %s -S -O0 -o - | grep define | \ 14 | // RUN: grep xextnoWeak | grep linkonce | count 1 15 | // XFAIL: gcc-4.5 16 | inline int xglobWeak(int) __attribute__((weak)); 17 | inline int xglobWeak (int i) { 18 | return i*2; 19 | } 20 | inline int xextWeak(int) __attribute__((weak)); 21 | extern inline int xextWeak (int i) { 22 | return i*4; 23 | } 24 | int xWeaknoinline(int) __attribute__((weak)); 25 | int xWeaknoinline(int i) { 26 | return i*8; 27 | } 28 | int xWeakextnoinline(int) __attribute__((weak)); 29 | extern int xWeakextnoinline(int i) { 30 | return i*16; 31 | } 32 | inline int xglobnoWeak (int i) { 33 | return i*32; 34 | } 35 | static inline int xstatnoWeak (int i) { 36 | return i*64; 37 | } 38 | extern inline int xextnoWeak (int i) { 39 | return i*128; 40 | } 41 | int j(int y) { 42 | return xglobnoWeak(y)+xstatnoWeak(y)+xextnoWeak(y)+ 43 | xglobWeak(y)+xextWeak(y)+ 44 | xWeakextnoinline(y)+xWeaknoinline(y); 45 | } 46 | -------------------------------------------------------------------------------- /test/validator/c++/2007-01-06-ELF-Thunk-Sections.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg %s -S -o - | FileCheck %s 2 | // PR1085 3 | // XFAIL: gcc-4.7, gcc-4.8 4 | 5 | // CHECK: define weak void @_ZThn{{[48]}}_N 6 | // CHECK: define weak void @_ZThn{{[48]}}_N 7 | // CHECK: define weak void @_ZThn{{[48]}}_N 8 | // CHECK: define weak void @_ZThn{{[48]}}_N 9 | // CHECK: define weak void @_ZThn{{[48]}}_N 10 | // CHECK: define weak void @_ZThn{{[48]}}_N 11 | 12 | class 13 | __attribute__((visibility("default"))) QGenericArgument 14 | { 15 | public:inline QGenericArgument(const char *aName = 0, const void *aData = 0):_data(aData), _name(aName) { 16 | } 17 | private:const void *_data; 18 | const char *_name; 19 | }; 20 | struct __attribute__ (( 21 | visibility("default"))) QMetaObject 22 | { 23 | struct { 24 | } 25 | d; 26 | }; 27 | class 28 | __attribute__((visibility("default"))) QObject 29 | { 30 | virtual const QMetaObject *metaObject() const; 31 | }; 32 | class 33 | __attribute__((visibility("default"))) QPaintDevice 34 | { 35 | public:enum PaintDeviceMetric { 36 | PdmWidth = 1, PdmHeight, PdmWidthMM, PdmHeightMM, PdmNumColors, PdmDepth, PdmDpiX, PdmDpiY, PdmPhysicalDpiX, PdmPhysicalDpiY 37 | }; 38 | virtual ~ QPaintDevice(); 39 | union { 40 | } 41 | ct; 42 | }; 43 | class 44 | __attribute__((visibility("default"))) QWidget:public QObject, public QPaintDevice 45 | { 46 | }; 47 | class 48 | __attribute__((visibility("default"))) QDialog:public QWidget 49 | { 50 | }; 51 | class TopicChooser:public QDialog { 52 | virtual const QMetaObject *metaObject() const; 53 | }; 54 | const QMetaObject *TopicChooser:: 55 | metaObject() const 56 | { 57 | } 58 | -------------------------------------------------------------------------------- /include/linux/dragonegg/OS.h: -------------------------------------------------------------------------------- 1 | //===------------- OS.h - Linux specific definitions ------------*- C++ -*-===// 2 | // 3 | // Copyright (C) 2009 to 2013 Duncan Sands et al. 4 | // 5 | // This file is part of DragonEgg. 6 | // 7 | // DragonEgg is free software; you can redistribute it and/or modify it under 8 | // the terms of the GNU General Public License as published by the Free Software 9 | // Foundation; either version 2, or (at your option) any later version. 10 | // 11 | // DragonEgg is distributed in the hope that it will be useful, but WITHOUT ANY 12 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 13 | // A PARTICULAR PURPOSE. See the GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License along with 16 | // DragonEgg; see the file COPYING. If not, write to the Free Software 17 | // Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. 18 | // 19 | //===----------------------------------------------------------------------===// 20 | // This file provides Linux specific declarations. 21 | //===----------------------------------------------------------------------===// 22 | 23 | #ifndef DRAGONEGG_OS_H 24 | #define DRAGONEGG_OS_H 25 | 26 | /* Yes, we support PIC codegen for linux targets! */ 27 | #define LLVM_SET_RELOC_MODEL(RelocModel) \ 28 | if (flag_pic) \ 29 | RelocModel = Reloc::PIC_; \ 30 | else \ 31 | RelocModel = Reloc::Static; 32 | 33 | #endif /* DRAGONEGG_OS_H */ 34 | -------------------------------------------------------------------------------- /include/freebsd/dragonegg/OS.h: -------------------------------------------------------------------------------- 1 | //===------------ OS.h - FreeBSD specific definitions -----------*- C++ -*-===// 2 | // 3 | // Copyright (C) 2009 to 2013 Duncan Sands et al. 4 | // 5 | // This file is part of DragonEgg. 6 | // 7 | // DragonEgg is free software; you can redistribute it and/or modify it under 8 | // the terms of the GNU General Public License as published by the Free Software 9 | // Foundation; either version 2, or (at your option) any later version. 10 | // 11 | // DragonEgg is distributed in the hope that it will be useful, but WITHOUT ANY 12 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 13 | // A PARTICULAR PURPOSE. See the GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License along with 16 | // DragonEgg; see the file COPYING. If not, write to the Free Software 17 | // Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. 18 | // 19 | //===----------------------------------------------------------------------===// 20 | // This file provides FreeBSD specific declarations. 21 | //===----------------------------------------------------------------------===// 22 | 23 | #ifndef DRAGONEGG_OS_H 24 | #define DRAGONEGG_OS_H 25 | 26 | /* Yes, we support PIC codegen for FreeBSD targets! */ 27 | #define LLVM_SET_RELOC_MODEL(RelocModel) \ 28 | if (flag_pic) \ 29 | RelocModel = Reloc::PIC_; \ 30 | else \ 31 | RelocModel = Reloc::Static; 32 | 33 | #endif /* DRAGONEGG_OS_H */ 34 | -------------------------------------------------------------------------------- /include/openbsd/dragonegg/OS.h: -------------------------------------------------------------------------------- 1 | //===------------ OS.h - OpenBSD specific definitions -----------*- C++ -*-===// 2 | // 3 | // Copyright (C) 2009 to 2013 Duncan Sands et al. 4 | // 5 | // This file is part of DragonEgg. 6 | // 7 | // DragonEgg is free software; you can redistribute it and/or modify it under 8 | // the terms of the GNU General Public License as published by the Free Software 9 | // Foundation; either version 2, or (at your option) any later version. 10 | // 11 | // DragonEgg is distributed in the hope that it will be useful, but WITHOUT ANY 12 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 13 | // A PARTICULAR PURPOSE. See the GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License along with 16 | // DragonEgg; see the file COPYING. If not, write to the Free Software 17 | // Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. 18 | // 19 | //===----------------------------------------------------------------------===// 20 | // This file provides OpenBSD specific declarations. 21 | //===----------------------------------------------------------------------===// 22 | 23 | #ifndef DRAGONEGG_OS_H 24 | #define DRAGONEGG_OS_H 25 | 26 | /* Yes, we support PIC codegen for OpenBSD targets! */ 27 | #define LLVM_SET_RELOC_MODEL(RelocModel) \ 28 | if (flag_pic) \ 29 | RelocModel = Reloc::PIC_; \ 30 | else \ 31 | RelocModel = Reloc::Static; 32 | 33 | #endif /* DRAGONEGG_OS_H */ 34 | -------------------------------------------------------------------------------- /include/kfreebsd/dragonegg/OS.h: -------------------------------------------------------------------------------- 1 | //===------------ OS.h - KFreeBSD specific definitions ----------*- C++ -*-===// 2 | // 3 | // Copyright (C) 2009 to 2013 Duncan Sands et al. 4 | // 5 | // This file is part of DragonEgg. 6 | // 7 | // DragonEgg is free software; you can redistribute it and/or modify it under 8 | // the terms of the GNU General Public License as published by the Free Software 9 | // Foundation; either version 2, or (at your option) any later version. 10 | // 11 | // DragonEgg is distributed in the hope that it will be useful, but WITHOUT ANY 12 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 13 | // A PARTICULAR PURPOSE. See the GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License along with 16 | // DragonEgg; see the file COPYING. If not, write to the Free Software 17 | // Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. 18 | // 19 | //===----------------------------------------------------------------------===// 20 | // This file provides KFreeBSD specific declarations. 21 | //===----------------------------------------------------------------------===// 22 | 23 | #ifndef DRAGONEGG_OS_H 24 | #define DRAGONEGG_OS_H 25 | 26 | /* Yes, we support PIC codegen for KFreeBSD targets! */ 27 | #define LLVM_SET_RELOC_MODEL(RelocModel) \ 28 | if (flag_pic) \ 29 | RelocModel = Reloc::PIC_; \ 30 | else \ 31 | RelocModel = Reloc::Static; 32 | 33 | #endif /* DRAGONEGG_OS_H */ 34 | -------------------------------------------------------------------------------- /test/validator/c++/2007-01-06-ELF-Thunk-Sections-2.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg %s -S -o - | FileCheck %s 2 | // PR1085 3 | // XFAIL: gcc-4.5, gcc-4.6 4 | 5 | // CHECK: define linkonce_odr void @_ZThn{{[48]}}_N 6 | // CHECK: define linkonce_odr void @_ZThn{{[48]}}_N 7 | // CHECK: define linkonce_odr void @_ZThn{{[48]}}_N 8 | // CHECK: define linkonce_odr void @_ZThn{{[48]}}_N 9 | // CHECK: define linkonce_odr void @_ZThn{{[48]}}_N 10 | // CHECK: define linkonce_odr void @_ZThn{{[48]}}_N 11 | 12 | class 13 | __attribute__((visibility("default"))) QGenericArgument 14 | { 15 | public:inline QGenericArgument(const char *aName = 0, const void *aData = 0):_data(aData), _name(aName) { 16 | } 17 | private:const void *_data; 18 | const char *_name; 19 | }; 20 | struct __attribute__ (( 21 | visibility("default"))) QMetaObject 22 | { 23 | struct { 24 | } 25 | d; 26 | }; 27 | class 28 | __attribute__((visibility("default"))) QObject 29 | { 30 | virtual const QMetaObject *metaObject() const; 31 | }; 32 | class 33 | __attribute__((visibility("default"))) QPaintDevice 34 | { 35 | public:enum PaintDeviceMetric { 36 | PdmWidth = 1, PdmHeight, PdmWidthMM, PdmHeightMM, PdmNumColors, PdmDepth, PdmDpiX, PdmDpiY, PdmPhysicalDpiX, PdmPhysicalDpiY 37 | }; 38 | virtual ~ QPaintDevice(); 39 | union { 40 | } 41 | ct; 42 | }; 43 | class 44 | __attribute__((visibility("default"))) QWidget:public QObject, public QPaintDevice 45 | { 46 | }; 47 | class 48 | __attribute__((visibility("default"))) QDialog:public QWidget 49 | { 50 | }; 51 | class TopicChooser:public QDialog { 52 | virtual const QMetaObject *metaObject() const; 53 | }; 54 | const QMetaObject *TopicChooser:: 55 | metaObject() const 56 | { 57 | } 58 | -------------------------------------------------------------------------------- /test/compilator/local/2007-04-11-InlineStorageClassC89.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc %s -S -O0 -o - | grep define | grep xglobWeak | \ 2 | // RUN: grep weak | count 1 3 | // RUN: %llvmgcc %s -S -O0 -o - | grep define | grep xextWeak | \ 4 | // RUN: grep weak | count 1 5 | // RUN: %llvmgcc %s -S -O0 -o - | grep define | \ 6 | // RUN: grep xWeaknoinline | grep weak | count 1 7 | // RUN: %llvmgcc %s -S -O0 -o - | grep define | \ 8 | // RUN: grep xWeakextnoinline | grep weak | count 1 9 | // RUN: %llvmgcc %s -S -O0 -o - | grep define | \ 10 | // RUN: grep xglobnoWeak | grep -v internal | grep -v weak | \ 11 | // RUN: grep -v linkonce | count 1 12 | // RUN: %llvmgcc %s -S -O0 -o - | grep define | \ 13 | // RUN: grep xstatnoWeak | grep internal | count 1 14 | // RUN: %llvmgcc %s -S -O0 -o - | grep define | \ 15 | // RUN: grep xextnoWeak | grep available_externally | grep -v weak | \ 16 | // RUN: grep -v linkonce | count 1 17 | inline int xglobWeak(int) __attribute__((weak)); 18 | inline int xglobWeak (int i) { 19 | return i*2; 20 | } 21 | inline int xextWeak(int) __attribute__((weak)); 22 | extern inline int xextWeak (int i) { 23 | return i*4; 24 | } 25 | int xWeaknoinline(int) __attribute__((weak)); 26 | int xWeaknoinline(int i) { 27 | return i*8; 28 | } 29 | int xWeakextnoinline(int) __attribute__((weak)); 30 | extern int xWeakextnoinline(int i) { 31 | return i*16; 32 | } 33 | inline int xglobnoWeak (int i) { 34 | return i*32; 35 | } 36 | static inline int xstatnoWeak (int i) { 37 | return i*64; 38 | } 39 | extern inline int xextnoWeak (int i) { 40 | return i*128; 41 | } 42 | int j(int y) { 43 | return xglobnoWeak(y)+xstatnoWeak(y)+xextnoWeak(y)+ 44 | xglobWeak(y)+xextWeak(y)+ 45 | xWeakextnoinline(y)+xWeaknoinline(y); 46 | } 47 | -------------------------------------------------------------------------------- /test/compilator/local/2007-04-11-InlineStorageClassC99.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc -std=c99 %s -S -O0 -o - | grep declare | \ 2 | // RUN: grep xglobWeak | grep extern_weak | count 1 3 | // RUN: %llvmgcc -std=c99 %s -S -O0 -o - | grep define | \ 4 | // RUN: grep xextWeak | grep weak | count 1 5 | // RUN: %llvmgcc -std=c99 %s -S -O0 -o - | grep define | \ 6 | // RUN: grep xWeaknoinline | grep weak | count 1 7 | // RUN: %llvmgcc -std=c99 %s -S -O0 -o - | grep define | \ 8 | // RUN: grep xWeakextnoinline | grep weak | count 1 9 | // RUN: %llvmgcc -std=c99 %s -S -O0 -o - | grep define | \ 10 | // RUN: grep xglobnoWeak | grep available_externally | grep -v weak | \ 11 | // RUN: grep -v linkonce | count 1 12 | // RUN: %llvmgcc -std=c99 %s -S -O0 -o - | grep define | \ 13 | // RUN: grep xstatnoWeak | grep internal | count 1 14 | // RUN: %llvmgcc -std=c99 %s -S -O0 -o - | grep define | \ 15 | // RUN: grep xextnoWeak | grep -v available_externally | grep -v weak | \ 16 | // RUN: grep -v linkonce | count 1 17 | inline int xglobWeak(int) __attribute__((weak)); 18 | inline int xglobWeak (int i) { 19 | return i*2; 20 | } 21 | inline int xextWeak(int) __attribute__((weak)); 22 | extern inline int xextWeak (int i) { 23 | return i*4; 24 | } 25 | int xWeaknoinline(int) __attribute__((weak)); 26 | int xWeaknoinline(int i) { 27 | return i*8; 28 | } 29 | int xWeakextnoinline(int) __attribute__((weak)); 30 | extern int xWeakextnoinline(int i) { 31 | return i*16; 32 | } 33 | inline int xglobnoWeak (int i) { 34 | return i*32; 35 | } 36 | static inline int xstatnoWeak (int i) { 37 | return i*64; 38 | } 39 | extern inline int xextnoWeak (int i) { 40 | return i*128; 41 | } 42 | int j(int y) { 43 | return xglobnoWeak(y)+xstatnoWeak(y)+xextnoWeak(y)+ 44 | xglobWeak(y)+xextWeak(y)+ 45 | xWeakextnoinline(y)+xWeaknoinline(y); 46 | } 47 | -------------------------------------------------------------------------------- /test/validator/fortran/VecPackFixTruncExpr.f: -------------------------------------------------------------------------------- 1 | C RUN: %dragonegg %s -S -msse3 -ffast-math -funroll-loops -O3 -fplugin-arg-dragonegg-enable-gcc-optzns 2 | C PR12664 3 | SUBROUTINE MLIST() 4 | IMPLICIT DOUBLE PRECISION(A-H,O-Z) 5 | PARAMETER (NM=16384) 6 | PARAMETER (NG=100) 7 | PARAMETER (NH=100) 8 | PARAMETER (MU=20) 9 | PARAMETER (NL=1) 10 | PARAMETER (LL=10*NM) 11 | PARAMETER (KP=2001,KR=2001,KG=2001) 12 | COMMON /COUNT / NFI , LCOunt , LISter , KNTsta , KNTgor , LEP , & 13 | & MANyon 14 | COMMON /LCS / X0(3,-2:NM) , X(3,-2:NM,5) , XIN(3,-2:NM) 15 | COMMON /LISCOM/ LISt(LL) , MRKr1(NM) , MRKr2(NM) , LISlen 16 | COMMON /MOLEC / LPBc(3) , MOLsp , MOLsa , NBX , NBY , NBZ , NPLa ,& 17 | & LPBcsm 18 | COMMON /PARAM / DELta , DELta2 , GAMma , VSCale , CTRlce , & 19 | & CTRlmi , CTRlma , RSQupd , RANsq , VMAs , BOX(3,3) 20 | COMMON /PBCS / HALf , PBCx , PBCy , PBCz 21 | COMMON /PRINT / LNGprt , IPRind 22 | COMMON /SCRATC/ DUMmy1(NM) , DUMmy2(NM) , DUMmy3(NM) , DUMmy4(NM) 23 | COMMON /STATIS/ FGS(NG) , GRAng , FACng , SCAby2 , RESz , DONtr , & 24 | & FONtr , SIG2 , NGS(NG) , NGMax , NZHigh , NZLow , & 25 | & MULtip 26 | COMMON /WALLS / HI(3,3) , G(3,3) , DH , AREa , VOLume , SCM(3) 27 | DIMENSION H(3,3) , HIN(3,3) 28 | EQUIVALENCE (X0(1,-2),H(1,1)) 29 | EQUIVALENCE (XIN(1,-2),HIN(1,1)) 30 | IF ( LPBcsm.GT.0 ) THEN 31 | DO i = 1 , MOLsp 32 | boxjmp = PBCx*INT(X0(1,i)+SIGN(HALf,X0(1,i))) 33 | X0(1,i) = X0(1,i) - boxjmp 34 | XIN(1,i) = XIN(1,i) - boxjmp 35 | boxjmp = PBCy*INT(X0(2,i)+SIGN(HALf,X0(2,i))) 36 | X0(2,i) = X0(2,i) - boxjmp 37 | XIN(2,i) = XIN(2,i) - boxjmp 38 | boxjmp = PBCz*INT(X0(3,i)+SIGN(HALf,X0(3,i))) 39 | X0(3,i) = X0(3,i) - boxjmp 40 | XIN(3,i) = XIN(3,i) - boxjmp 41 | ENDDO 42 | ENDIF 43 | END 44 | -------------------------------------------------------------------------------- /test/validator/objc/2009-04-28-bitfield-vs-vbc.m: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S -x objective-c -m32 %s -o /dev/null 2 | // This used to crash, 6831493. 3 | // XFAIL: gcc-4.5 4 | #include 5 | 6 | struct s0 { 7 | double x; 8 | }; 9 | 10 | @interface I2 { 11 | struct s0 _iv1; 12 | } 13 | @end 14 | 15 | @interface I3 : I2 { 16 | unsigned int _iv2 :1; 17 | unsigned : 0; 18 | unsigned int _iv3 : 3; 19 | } 20 | @end 21 | 22 | @interface I4 : I3 { 23 | char _iv4; 24 | } 25 | @end 26 | 27 | @interface I5 : I4 { 28 | char _iv5; 29 | int _iv6; 30 | int _iv7; 31 | } 32 | 33 | @property int P1; 34 | @end 35 | 36 | @implementation I2 37 | @end 38 | 39 | @implementation I3 40 | @end 41 | 42 | @implementation I4 43 | @end 44 | 45 | @interface I5 () 46 | @property int P2; 47 | @end 48 | 49 | #if 0 50 | int g2 = sizeof(I2); 51 | int g3 = sizeof(I3); 52 | int g4 = sizeof(I4); 53 | int g5_0 = sizeof(I5); 54 | #endif 55 | 56 | @implementation I5 57 | #ifdef __x86_64 58 | @synthesize P1 = _MadeUpName; 59 | @synthesize P2 = _AnotherMadeUpName; 60 | #else 61 | @synthesize P1 = _iv6; 62 | @synthesize P2 = _iv7; 63 | #endif 64 | @end 65 | 66 | #if 0 67 | int g5_1 = sizeof(I5); 68 | #endif 69 | 70 | @interface T0_I0 { 71 | double iv_A_0; 72 | char iv_A_1; 73 | } 74 | @end 75 | 76 | @interface T0_I1 : T0_I0 { 77 | char iv_B_0; 78 | } 79 | @end 80 | 81 | @interface T0_I2 : T0_I1 { 82 | char iv_C_0; 83 | } 84 | @end 85 | 86 | #if 0 87 | int g6 = sizeof(T0_I0); 88 | int g7 = sizeof(T0_I1); 89 | int g8 = sizeof(T0_I2); 90 | #endif 91 | 92 | @implementation T0_I0 @end 93 | @implementation T0_I1 @end 94 | @implementation T0_I2 @end 95 | 96 | void f0(I2*i2,I3*i3,I4*i4,I5*i5,T0_I0*t0_i0,T0_I1*t0_i1,T0_I2*t0_i2) { 97 | } 98 | 99 | // Thomas Wang's ui32 hash. 100 | unsigned hash_ui32_to_ui32(unsigned a) { 101 | a = (a ^ 61) ^ (a >> 16); 102 | a = a + (a << 3); 103 | a = a ^ (a >> 4); 104 | a = a * 0x27d4eb2d; 105 | a = a ^ (a >> 15); 106 | return a; 107 | } 108 | 109 | unsigned char hash_ui32_to_ui8(unsigned ui) { 110 | ui = hash_ui32_to_ui32(ui); 111 | ui ^= ui>>8; 112 | ui ^= ui>>8; 113 | ui ^= ui>>8; 114 | return (unsigned char) ui; 115 | } 116 | 117 | void *init() { 118 | unsigned i, N = 1024; 119 | unsigned char *p = malloc(N); 120 | for (i=0; i != N; ++i) 121 | p[i] = hash_ui32_to_ui8(i); 122 | return p; 123 | } 124 | 125 | int main(){ 126 | void *p = init(); 127 | f0(p,p,p,p,p,p,p); 128 | } 129 | -------------------------------------------------------------------------------- /test/compilator/local/CodeCompleteConsumer.ii: -------------------------------------------------------------------------------- 1 | typedef long unsigned int size_t; 2 | 3 | namespace llvm { 4 | namespace dont_use { 5 | template char is_class_helper(void(T::*)()); 6 | } 7 | template struct is_class { 8 | public: 9 | enum { value = sizeof(char) == sizeof(dont_use::is_class_helper(0)) }; 10 | }; 11 | template struct isPodLike { 12 | static const bool value = !is_class::value; 13 | }; 14 | } 15 | 16 | namespace std __attribute__ ((__visibility__ ("default"))) { 17 | template 18 | _Function for_each(_InputIterator __first, _InputIterator __last, _Function __f) 19 | { 20 | for ( ; __first != __last; ++__first) __f(*__first); 21 | } 22 | } 23 | 24 | namespace llvm { 25 | class SmallVectorBase { }; 26 | template 27 | class SmallVectorTemplateCommon : public SmallVectorBase { 28 | public: 29 | SmallVectorTemplateCommon(size_t Size) : SmallVectorBase(Size) { } 30 | typedef T *iterator; 31 | iterator begin() { } 32 | iterator end() { } 33 | }; 34 | 35 | template 36 | class SmallVectorTemplateBase : public SmallVectorTemplateCommon { }; 37 | 38 | template 39 | class SmallVectorImpl : public SmallVectorTemplateBase::value> { }; 40 | 41 | template 42 | class SmallVector : public SmallVectorImpl { }; 43 | } 44 | 45 | namespace std __attribute__ ((__visibility__ ("default"))) { 46 | template 47 | struct unary_function { }; 48 | template 49 | class mem_fun_ref_t : public unary_function<_Tp, _Ret> { 50 | public: 51 | explicit mem_fun_ref_t(_Ret (_Tp::*__pf)()) : _M_f(__pf) { } 52 | _Ret operator()(_Tp& __r) const { 53 | return (__r.*_M_f)(); 54 | } 55 | private: 56 | _Ret (_Tp::*_M_f)(); 57 | }; 58 | 59 | template 60 | inline mem_fun_ref_t<_Ret, _Tp> mem_fun_ref(_Ret (_Tp::*__f)()) { } 61 | } 62 | 63 | namespace clang { 64 | class CodeCompletionString { 65 | struct Chunk { 66 | void Destroy(); 67 | }; 68 | private: 69 | llvm::SmallVector Chunks; 70 | ~CodeCompletionString(); 71 | }; 72 | } 73 | 74 | using namespace clang; 75 | CodeCompletionString::~CodeCompletionString() { 76 | std::for_each(Chunks.begin(), Chunks.end(), std::mem_fun_ref(&Chunk::Destroy)); 77 | } 78 | -------------------------------------------------------------------------------- /include/dragonegg/Cache.h: -------------------------------------------------------------------------------- 1 | //==----------- Cache.h - Caching values "in" GCC trees ----------*- C++ -*-==// 2 | // 3 | // Copyright (C) 2009 to 2013 Duncan Sands. 4 | // 5 | // This file is part of DragonEgg. 6 | // 7 | // DragonEgg is free software; you can redistribute it and/or modify it under 8 | // the terms of the GNU General Public License as published by the Free 9 | // Software Foundation; either version 2, or (at your option) any later 10 | // version. 11 | // 12 | // DragonEgg is distributed in the hope that it will be useful, but WITHOUT 13 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 | // more details. 16 | // You should have received a copy of the GNU General Public License along 17 | // with DragonEgg; see the file COPYING. If not, write to the Free Software 18 | // Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. 19 | // 20 | //===----------------------------------------------------------------------===// 21 | // This code lets you associate a value with a tree, as if it were cached inside 22 | // the tree: if the tree is garbage collected and reallocated, then the cached 23 | // value will have been cleared. 24 | //===----------------------------------------------------------------------===// 25 | 26 | #ifndef DRAGONEGG_CACHE_H 27 | #define DRAGONEGG_CACHE_H 28 | 29 | // Forward declarations. 30 | namespace llvm { 31 | class Type; 32 | class Value; 33 | } 34 | union tree_node; 35 | 36 | /// getCachedInteger - Returns true if there is an integer associated with the 37 | /// given GCC tree and puts the integer in 'val'. Otherwise returns false. 38 | extern bool getCachedInteger(union tree_node *t, int &Val); 39 | 40 | /// setCachedInteger - Associates the given integer with the given GCC tree, and 41 | /// returns the integer. 42 | extern void setCachedInteger(union tree_node *t, int Val); 43 | 44 | /// getCachedType - Returns the type associated with the given GCC tree, or null 45 | /// if none. 46 | extern llvm::Type *getCachedType(union tree_node *t); 47 | 48 | /// setCachedType - Associates the given type (which may be null) with the given 49 | /// GCC tree, and returns the type. 50 | extern void setCachedType(union tree_node *t, llvm::Type *Ty); 51 | 52 | /// getCachedValue - Returns the value associated with the given GCC tree, or 53 | /// null if none. 54 | extern llvm::Value *getCachedValue(union tree_node *t); 55 | 56 | /// setCachedValue - Associates the given value (which may be null) with the 57 | /// given GCC tree. The association is removed if tree is garbage collected 58 | /// or the value deleted. 59 | extern void setCachedValue(union tree_node *t, llvm::Value *V); 60 | 61 | #endif /* DRAGONEGG_CACHE_H */ 62 | -------------------------------------------------------------------------------- /test/compilator/local/pr3373.c: -------------------------------------------------------------------------------- 1 | void 2 | fd_zero (void) 3 | { 4 | long int x; 5 | int d0, d1; 6 | __asm__ __volatile__ ("cld; rep; " "stosq":"=c" (d0), "=D" (d1):"a" (0), 7 | "0" (1), "1" (&x):"memory"); 8 | } 9 | 10 | int 11 | foo (unsigned long *addr) 12 | { 13 | int __ret_pu; 14 | unsigned long __pu_val; 15 | return ( 16 | { 17 | asm volatile ("call __put_user_" "8": "=a" (__ret_pu): "0" (__pu_val), "c" (addr):"ebx"); 18 | __ret_pu; 19 | }); 20 | } 21 | 22 | static struct 23 | { 24 | unsigned long address; 25 | unsigned short segment; 26 | } bios32_indirect; 27 | unsigned long 28 | bios32_service (unsigned long service) 29 | { 30 | unsigned char return_code; /* %al */ 31 | unsigned long address; /* %ebx */ 32 | unsigned long length; /* %ecx */ 33 | unsigned long entry; /* %edx */ 34 | unsigned long flags; 35 | 36 | local_irq_save (flags); 37 | __asm__ ("lcall *(%%edi); cld": "=a" (return_code), "=b" (address), "=c" (length), "=d" (entry):"0" (service), 38 | "1" (0), 39 | "D" (&bios32_indirect)); 40 | } 41 | 42 | //int x(void) 43 | //{ 44 | // unsigned long in; 45 | // int out; 46 | // asm("insn %0" : "=r" (out) : "0" (in)); 47 | // 48 | // return out; 49 | //} 50 | 51 | int test(unsigned long b) { 52 | int a; 53 | asm volatile("nop " : "=a" (a) :"0" (b)); 54 | return a; 55 | } 56 | 57 | int 58 | bar () 59 | { 60 | char c; 61 | asm ("sarl $10, %%eax": "=a" (c):"0" (1000000)); 62 | return c; 63 | } 64 | 65 | //int 66 | //test7 (unsigned long long b) 67 | //{ 68 | // int a; 69 | // asm volatile ("foo %0 %1":"=a" (a):"0" (b)); // expected-error {{input with type 'unsigned long long' matching output with type 'int'}} 70 | // return a; 71 | //} 72 | 73 | //unsigned long long 74 | //test8 (unsigned long long b) 75 | //{ 76 | // int a; 77 | // asm volatile ("bar %1":"=a" (b):"0" (a)); // expected-error {{input with type 'unsigned long long' matching output with type 'int'}} 78 | // return b; 79 | //} 80 | 81 | // PR3373 82 | unsigned 83 | t11 (signed char input) 84 | { 85 | unsigned output; 86 | __asm__ ("nop": "=a" (output):"0" (input)); 87 | return output; 88 | } 89 | 90 | // PR3373 91 | unsigned char 92 | t12 (unsigned input) 93 | { 94 | unsigned char output; 95 | __asm__ ("nop": "=a" (output):"0" (input)); 96 | return output; 97 | } 98 | 99 | unsigned char 100 | t13 (unsigned input) 101 | { 102 | unsigned char output; 103 | __asm__ ("nop": "=a" (output):"0" (input)); 104 | return output; 105 | } 106 | 107 | struct large 108 | { 109 | int x[1000]; 110 | }; 111 | 112 | unsigned long 113 | t15 (int x, struct large *P) 114 | { 115 | __asm__ ("nop ": "=r" (x):"m" (*P), "0" (x)); 116 | return x; 117 | } 118 | -------------------------------------------------------------------------------- /test/validator/validator-lit.cfg: -------------------------------------------------------------------------------- 1 | # -*- Python -*- 2 | import os 3 | import platform 4 | import re 5 | import subprocess 6 | 7 | import lit.formats 8 | 9 | # Allow import of our local utilities. 10 | sys.path.append(os.path.dirname(os.path.dirname(__file__))) 11 | import DEUtils 12 | 13 | # It will validate you. That's what it does. That's all it does. 14 | config.name = 'The Validator' 15 | 16 | # Load common definitions. 17 | lit_config.load_config(config, lit_config.params['site']) 18 | 19 | # Tweak PATH for Win32 20 | if platform.system() == 'Windows': 21 | # Seek sane tools in directories and set to $PATH. 22 | path = getattr(config, 'lit_tools_dir', None) 23 | path = lit_config.getToolsPath(path, 24 | config.environment['PATH'], 25 | ['cmp.exe', 'grep.exe', 'sed.exe']) 26 | if path is not None: 27 | path = os.path.pathsep.join((path, 28 | config.environment['PATH'])) 29 | config.environment['PATH'] = path 30 | # Tweak the PATH to include the tools dir. 31 | path = os.path.pathsep.join((config.llvm_tools_dir, config.environment['PATH'])) 32 | config.environment['PATH'] = path 33 | 34 | 35 | # testFormat: The test format to use to interpret tests. 36 | # 37 | # For now we require '&&' between commands, until they get globally killed and 38 | # the test runner updated. 39 | execute_external = (platform.system() != 'Windows' 40 | or lit_config.getBashPath() not in [None, ""]) 41 | config.test_format = lit.formats.ShTest(execute_external) 42 | 43 | # suffixes: A list of file extensions to treat as test files. 44 | config.suffixes = [] 45 | for language in DEUtils.getSupportedLanguages(config.gcc_executable): 46 | config.suffixes = config.suffixes + DEUtils.getSuffixesForLanguage(language) 47 | 48 | # test_source_root: The root path where tests are located. 49 | config.test_source_root = os.path.dirname(__file__) 50 | 51 | # test_exec_root: The root path where tests should be run. 52 | config.test_exec_root = config.test_output_dir + '/validator/' 53 | 54 | # When running under valgrind, we mangle '-vg' onto the end of the triple so we 55 | # can check it with XFAIL and XTARGET. 56 | if lit_config.useValgrind: 57 | config.target_triple += '-vg' 58 | 59 | # %dragonegg means: run dragonegg and output LLVM IR. 60 | config.substitutions.append( ('%dragonegg', '%s -fplugin=%s ' 61 | '-fplugin-arg-dragonegg-emit-ir' % 62 | (config.gcc_executable, config.dragonegg_plugin))) 63 | 64 | # %eggdragon means: run dragonegg and output target assembler. 65 | config.substitutions.append( ('%eggdragon', '%s -fplugin=%s ' % 66 | (config.gcc_executable, config.dragonegg_plugin))) 67 | -------------------------------------------------------------------------------- /utils/TargetInfo.cpp: -------------------------------------------------------------------------------- 1 | //===----- TargetInfo.cpp - Utility for getting info about the target -----===// 2 | // 3 | // Copyright (C) 2009 to 2013 Duncan Sands. 4 | // 5 | // This file is part of DragonEgg. 6 | // 7 | // DragonEgg is free software; you can redistribute it and/or modify it under 8 | // the terms of the GNU General Public License as published by the Free Software 9 | // Foundation; either version 2, or (at your option) any later version. 10 | // 11 | // DragonEgg is distributed in the hope that it will be useful, but WITHOUT ANY 12 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 13 | // A PARTICULAR PURPOSE. See the GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License along with 16 | // DragonEgg; see the file COPYING. If not, write to the Free Software 17 | // Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. 18 | // 19 | //===----------------------------------------------------------------------===// 20 | // Utility program for getting information about the system that GCC targets. 21 | //===----------------------------------------------------------------------===// 22 | 23 | #include 24 | #include 25 | 26 | using namespace llvm; 27 | 28 | static void PrintTriple(Triple &T) { 29 | std::cout << T.getTriple() << "\n"; 30 | } 31 | static void PrintArchName(Triple &T) { 32 | std::cout << T.getArchTypeName(T.getArch()) << "\n"; 33 | } 34 | static void PrintVendorName(Triple &T) { 35 | std::cout << T.getVendorTypeName(T.getVendor()) << "\n"; 36 | } 37 | static void PrintOSName(Triple &T) { 38 | std::cout << T.getOSTypeName(T.getOS()) << "\n"; 39 | } 40 | static void PrintArchTypePrefix(Triple &T) { 41 | std::cout << T.getArchTypePrefix(T.getArch()) << "\n"; 42 | } 43 | 44 | struct Option { 45 | const char *Name; 46 | void (*Action)(Triple &); 47 | }; 48 | 49 | static Option Options[] = { 50 | { "-t", PrintTriple }, 51 | { "-a", PrintArchName }, 52 | { "-v", PrintVendorName }, 53 | { "-o", PrintOSName }, 54 | { "-p", PrintArchTypePrefix }, 55 | { NULL, NULL } 56 | }; 57 | 58 | int main(int argc, char **argv) { 59 | Triple T(Triple::normalize(TARGET_TRIPLE)); 60 | 61 | for (int i = 1; i < argc; ++i) { 62 | bool Found = false; 63 | for (Option *O = Options; O->Name; ++O) 64 | if (!strcmp(argv[i], O->Name)) { 65 | Found = true; 66 | O->Action(T); 67 | break; 68 | } 69 | if (!Found) { 70 | std::cerr << "Unknown option \"" << argv[i] << "\"\n"; 71 | std::cerr << "Usage: " << argv[0]; 72 | for (Option *O = Options; O->Name; ++O) 73 | std::cerr << " " << O->Name; 74 | std::cerr << "\n"; 75 | return 1; 76 | } 77 | } 78 | 79 | return 0; 80 | } 81 | -------------------------------------------------------------------------------- /test/compilator/local/2002-07-29-Casts.c: -------------------------------------------------------------------------------- 1 | // RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | int 8 | main(int argc, char** argv) 9 | { 10 | char c1; 11 | short s1, ssf1, ssd1; 12 | unsigned char ubs0; 13 | signed char bs0; 14 | unsigned char ubc0, uc2; 15 | unsigned short us2, usf1, usd1; 16 | int ic3, is3, sif1, sid1; 17 | unsigned int uic4, uis4, uif1, uid1; 18 | long slf1, sld1; 19 | unsigned long ulf1, uld1; 20 | float f1; 21 | double d1; 22 | 23 | /* Test integer to integer conversions */ 24 | 25 | c1 = (char) (argc >= 2)? atoi(argv[1]) : 0xff64; /* 100 = 'd' */ 26 | s1 = (short) (argc >= 3)? atoi(argv[2]) : -769; /* 0xf7ff = -769 */ 27 | 28 | ubc0 = (unsigned char) c1; /* 100 = 'd' */ 29 | ubs0 = (unsigned char) s1; /* 0xff = 255 */ 30 | bs0 = (signed char) s1; /* 0xff = -1 */ 31 | 32 | uc2 = (unsigned char) c1; /* 100 = 'd' */ 33 | us2 = (unsigned short) s1; /* 0xf7ff = 64767 */ 34 | 35 | ic3 = (int) c1; /* 100 = 'd' */ 36 | is3 = (int) s1; /* 0xfffff7ff = -769 */ 37 | 38 | uic4 = (unsigned int) c1; /* 100 = 'd' */ 39 | uis4 = (unsigned int) s1; /* 0xfffff7ff = 4294966527 */ 40 | 41 | printf("ubc0 = '%c'\n", ubc0); 42 | printf("ubs0 = %u\n", ubs0); 43 | printf("bs0 = %d\n", bs0); 44 | printf("c1 = '%c'\n", c1); 45 | printf("s1 = %d\n", s1); 46 | printf("uc2 = '%c'\n", uc2); 47 | printf("us2 = %u\n", us2); 48 | printf("ic3 = '%c'\n", ic3); 49 | printf("is3 = %d\n", is3); 50 | printf("uic4 = '%c'\n", uic4); 51 | printf("uis4 = %u\n", uis4); 52 | 53 | /* Test floating-point to integer conversions */ 54 | f1 = (float) (argc >= 4)? atof(argv[3]) : 1.0; 55 | d1 = (argc >= 5)? atof(argv[4]) : 2.0; 56 | 57 | usf1 = (unsigned short) f1; 58 | usd1 = (unsigned short) d1; 59 | uif1 = (unsigned int) f1; 60 | uid1 = (unsigned int) d1; 61 | ulf1 = (unsigned long) f1; 62 | uld1 = (unsigned long) d1; 63 | 64 | ssf1 = (short) f1; 65 | ssd1 = (short) d1; 66 | sif1 = (int) f1; 67 | sid1 = (int) d1; 68 | slf1 = (long) f1; 69 | sld1 = (long) d1; 70 | 71 | printf("usf1 = %u\n", usf1); 72 | printf("usd1 = %u\n", usd1); 73 | printf("uif1 = %u\n", uif1); 74 | printf("uid1 = %u\n", uid1); 75 | printf("ulf1 = %u\n", ulf1); 76 | printf("uld1 = %u\n", uld1); 77 | 78 | printf("ssf1 = %d\n", ssf1); 79 | printf("ssd1 = %d\n", ssd1); 80 | printf("sif1 = %d\n", sif1); 81 | printf("sid1 = %d\n", sid1); 82 | printf("slf1 = %d\n", slf1); 83 | printf("sld1 = %d\n", sld1); 84 | 85 | return 0; 86 | } 87 | -------------------------------------------------------------------------------- /include/darwin/dragonegg/OS.h: -------------------------------------------------------------------------------- 1 | //===------------ OS.h - Darwin specific definitions ------------*- C++ -*-===// 2 | // 3 | // Copyright (C) 2009 to 2013 Duncan Sands et al. 4 | // 5 | // This file is part of DragonEgg. 6 | // 7 | // DragonEgg is free software; you can redistribute it and/or modify it under 8 | // the terms of the GNU General Public License as published by the Free Software 9 | // Foundation; either version 2, or (at your option) any later version. 10 | // 11 | // DragonEgg is distributed in the hope that it will be useful, but WITHOUT ANY 12 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 13 | // A PARTICULAR PURPOSE. See the GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License along with 16 | // DragonEgg; see the file COPYING. If not, write to the Free Software 17 | // Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. 18 | // 19 | //===----------------------------------------------------------------------===// 20 | // This file provides Darwin specific declarations. 21 | //===----------------------------------------------------------------------===// 22 | 23 | #ifndef DRAGONEGG_OS_H 24 | #define DRAGONEGG_OS_H 25 | 26 | /* Darwin X86-64 only supports PIC code generation. */ 27 | #if defined(TARGET_386) 28 | #define LLVM_SET_RELOC_MODEL(RelocModel) \ 29 | if ((TARGET_64BIT) || flag_pic) \ 30 | RelocModel = Reloc::PIC_; \ 31 | else if (!MACHO_DYNAMIC_NO_PIC_P) \ 32 | RelocModel = Reloc::Static; 33 | #elif defined(TARGET_ARM) 34 | #define LLVM_SET_RELOC_MODEL(RelocModel) \ 35 | if (flag_pic) \ 36 | RelocModel = Reloc::PIC_; \ 37 | else if (!MACHO_DYNAMIC_NO_PIC_P) \ 38 | RelocModel = Reloc::Static; \ 39 | #else /* !TARGET_386 && !TARGET_ARM */ 40 | #define LLVM_SET_RELOC_MODEL(RelocModel) \ 41 | if (flag_pic) \ 42 | RelocModel = Reloc::PIC_; \ 43 | else if (!MACHO_DYNAMIC_NO_PIC_P) \ 44 | RelocModel = Reloc::Static; 45 | #endif /* !TARGET_386 && !TARGET_ARM */ 46 | 47 | /* Give a constant string a sufficient alignment for the platform. */ 48 | /* radar 7291825 */ 49 | #define TARGET_ADJUST_CSTRING_ALIGN(GV) \ 50 | do { \ 51 | if (GV->hasInternalLinkage()) { \ 52 | GV->setAlignment(TARGET_64BIT ? 8 : 4); \ 53 | } \ 54 | } while (0) 55 | 56 | #endif /* DRAGONEGG_OS_H */ 57 | -------------------------------------------------------------------------------- /include/dragonegg/ConstantConversion.h: -------------------------------------------------------------------------------- 1 | //=- ConstantConversion.h - Converting and working with constants -*- C++ -*-=// 2 | // 3 | // Copyright (C) 2011 to 2013 Duncan Sands. 4 | // 5 | // This file is part of DragonEgg. 6 | // 7 | // DragonEgg is free software; you can redistribute it and/or modify it under 8 | // the terms of the GNU General Public License as published by the Free Software 9 | // Foundation; either version 2, or (at your option) any later version. 10 | // 11 | // DragonEgg is distributed in the hope that it will be useful, but WITHOUT ANY 12 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 13 | // A PARTICULAR PURPOSE. See the GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License along with 16 | // DragonEgg; see the file COPYING. If not, write to the Free Software 17 | // Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. 18 | // 19 | //===----------------------------------------------------------------------===// 20 | // This file declares functions for converting GCC constants to LLVM and working 21 | // with them. 22 | //===----------------------------------------------------------------------===// 23 | 24 | #ifndef DRAGONEGG_CONSTANTS_H 25 | #define DRAGONEGG_CONSTANTS_H 26 | 27 | // Forward declarations. 28 | namespace llvm { 29 | class Constant; 30 | class Type; 31 | } 32 | union tree_node; 33 | 34 | /// AddressOf - Given an expression with a constant address such as a constant, 35 | /// a global variable or a label, returns the address. The type of the returned 36 | /// is always a pointer type and, as long as 'exp' does not have void type, the 37 | /// type of the pointee is the memory type that corresponds to the type of exp 38 | /// (see ConvertType). 39 | extern llvm::Constant *AddressOf(tree_node *exp); 40 | 41 | /// ConvertInitializer - Convert the initial value for a global variable to an 42 | /// equivalent LLVM constant. Also handles constant constructors. The type of 43 | /// the returned value may be pretty much anything. All that is guaranteed is 44 | /// that its alloc size is equal to the size of the initial value and that its 45 | /// alignment is less than or equal to the initial value's GCC type alignment 46 | /// (here the GCC type means the main variant). Note that the GCC type may have 47 | /// variable size or no size in which case the size is determined by the initial 48 | /// value. When this happens the size of the initial value may exceed the alloc 49 | /// size of the LLVM memory type generated for the GCC type (see ConvertType); 50 | /// it is never smaller than the alloc size. 51 | extern llvm::Constant *ConvertInitializer(tree_node *exp); 52 | 53 | /// ExtractRegisterFromConstant - Extract a value of the given scalar GCC type 54 | /// from a constant. The returned value is of in-register type, as returned by 55 | /// getRegType, and is what you would get by storing the constant to memory and 56 | /// using LoadRegisterFromMemory to load a register value back out starting from 57 | /// byte StartingByte. 58 | extern llvm::Constant *ExtractRegisterFromConstant( 59 | llvm::Constant *C, tree_node *type, int StartingByte = 0); 60 | 61 | #endif /* DRAGONEGG_CONSTANTS_H */ 62 | -------------------------------------------------------------------------------- /test/DEUtils.py: -------------------------------------------------------------------------------- 1 | import os 2 | import signal 3 | import subprocess 4 | import tempfile 5 | 6 | suffixMap = { 7 | '.adb' : 'ada', 8 | '.ads' : 'ada', 9 | '.c' : 'c', 10 | '.i' : 'c', 11 | '.C' : 'c++', 12 | '.cc' : 'c++', 13 | '.cpp' : 'c++', 14 | '.ii' : 'c++', 15 | '.f' : 'fortran', 16 | '.f03' : 'fortran', 17 | '.f08' : 'fortran', 18 | '.f90' : 'fortran', 19 | '.f95' : 'fortran', 20 | '.F' : 'fortran', 21 | '.F03' : 'fortran', 22 | '.F08' : 'fortran', 23 | '.F90' : 'fortran', 24 | '.F95' : 'fortran', 25 | '.go' : 'go', 26 | '.jar' : 'java', 27 | '.class' : 'java', 28 | '.m' : 'objective-c', 29 | '.mm' : 'objective-c++', 30 | } 31 | 32 | def executeCommand(command, cwd=None, env=None): 33 | p = subprocess.Popen(command, cwd=cwd, 34 | stdin=subprocess.PIPE, 35 | stdout=subprocess.PIPE, 36 | stderr=subprocess.PIPE, 37 | env=env, close_fds=True) 38 | out,err = p.communicate() 39 | exitCode = p.wait() 40 | 41 | # Detect Ctrl-C in subprocess. 42 | if exitCode == -signal.SIGINT: 43 | raise KeyboardInterrupt 44 | 45 | return out, err, exitCode 46 | 47 | def getLanguageForSuffix(suffix): 48 | return suffixMap[suffix] 49 | 50 | def getSuffixesForLanguage(language): 51 | suffixes = [] 52 | for suffix in suffixMap: 53 | if suffixMap[suffix] == language: 54 | suffixes.append(suffix) 55 | return suffixes 56 | 57 | def isLanguageSupported(language, compiler): 58 | # How to run the compiler. Additional arguments are added below. 59 | args = [compiler, '-S', '-o', os.devnull] 60 | 61 | if language == 'java': 62 | # GCC can't compile Java source by itself, it can only compile class files. 63 | script_dir = os.path.dirname(os.path.realpath(__file__)) 64 | source = os.path.join(script_dir, 'e.class') 65 | # Java is supported if the class file compiles without error. 66 | out,err,exitCode = executeCommand(args + [source, '-fuse-boehm-gc']) 67 | return exitCode == 0 68 | 69 | if language == 'ada': 70 | suffix='.ads' 71 | elif language == 'c': 72 | suffix='.c' 73 | elif language == 'c++': 74 | suffix='.cpp' 75 | elif language == 'fortran': 76 | suffix='.f' 77 | elif language == 'go': 78 | suffix='.go' 79 | elif language == 'objective-c': 80 | suffix='.m' 81 | elif language == 'objective-c++': 82 | suffix='.mm' 83 | else: 84 | return False 85 | 86 | # For most languages it suffices to try compiling an empty file however for 87 | # Ada and Go an empty file is not a valid compilation unit. 88 | source = tempfile.NamedTemporaryFile(mode='w+t', suffix=suffix) 89 | 90 | if language == 'ada': 91 | # Use an obscure package name, as if the package is called XYZ and a file 92 | # called XYZ.adb exists then the test will fail. 93 | source.write('package U5TE4J886W is end;\n') 94 | elif language == 'go': 95 | source.write('package main\n') 96 | 97 | # If something was written then ensure it is visible to the compiler process. 98 | source.flush() 99 | 100 | # The language is supported if the file compiles without error. 101 | out,err,exitCode = executeCommand(args + [source.name]) 102 | return exitCode == 0 103 | 104 | def getSupportedLanguages(compiler): 105 | allLanguages = set(suffixMap.values()) 106 | return [lang for lang in allLanguages if isLanguageSupported(lang, compiler)] 107 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | Items marked with * are high priority. 2 | 3 | Build system 4 | ------------ 5 | 6 | Determination of the target triple should be moved from the Makefile to a 7 | configure script. 8 | 9 | Target subdirectories should have their own Makefiles, instead of assuming 10 | that there's only one source file and that it's called llvm-target.cpp. 11 | 12 | Currently the target directory (eg: i386) is calculated from the target triple 13 | (eg: x86_64-unknown-linux-gnu) using the "target" tool. This should be done 14 | from a configure script, rather from the Makefile. 15 | 16 | Define LLVM_TARGET_NAME from the Makefile rather than being specified in 17 | llvm-target.h. Maybe LLVM_TARGET_INTRINSIC_PREFIX could go too. An annoyance 18 | is that the target tool returns "x86" while what is needed is "X86". 19 | 20 | Optimizations 21 | ------------- 22 | 23 | Consider using separate caches for types and globals. 24 | 25 | Correctness 26 | ----------- 27 | 28 | GCC now has per-function optimization levels. Add support for this. 29 | 30 | Unify the code that determines which LLVM linkage type to use. Need to do 31 | a bunch of experimenting to work out how the mapping should really be done. 32 | 33 | * Stop hooking directly into target specific ABI code (which requires patching 34 | gcc). Instead, either try to get ABI info from the gcc hooks (which may mean 35 | translating RTL) or reuse the clang code. 36 | 37 | Testing 38 | ------- 39 | 40 | Move the old FrontendXYZ tests from LLVM to dragonegg. 41 | 42 | Code quality 43 | ------------ 44 | 45 | Consider not extending GEP indices to "pointer type" since GEP indices can have 46 | any integer type now (except for struct GEP's - there the type must be i32). 47 | Note that GEP indices are implicitly sign extended, so unsigned indices still 48 | need to be explicitly zero extended to pointer size (is this always done now?). 49 | 50 | Clarify and extend the distinction between gimple registers and "the rest", 51 | the rest being mostly references. 52 | 53 | BIT_FIELD_REF is used to extract (and presumably insert) vector elements. 54 | Consider turning this directly into the corresponding vector operations. 55 | 56 | Work in terms of units rather than octets (i8). For example, if the target 57 | has a 16 bit byte, then use i16 for byte addressing. 58 | 59 | Convert GCC floating point register constants without "going through memory" 60 | (see TreeToLLVM::EmitRealRegisterConstant). 61 | 62 | Reduce the use of macros. 63 | 64 | Features 65 | -------- 66 | 67 | * Move debug info generation over to the latest LLVM system, since we are now 68 | the only user of the old debug info system. 69 | 70 | Output proper debug info rather than throwing most of it away. Provide column 71 | numbers in location info. 72 | 73 | Many x86 specific builtins are not supported, even though it would be easy to 74 | add support for some of them, for example the 256 bit versions of builtins we 75 | do support. Improve this. 76 | 77 | The GCC builtin lowering outputs helpful warnings (for example, 78 | 20081109_0.c:3:35: warning: attempt to free a non-heap object ‘bar’, 79 | see maybe_emit_free_warning), but we don't. Improve this somehow. 80 | 81 | Make LTO transparent. One part of this working out how to write bitcode when 82 | using -c, which runs into trouble because gcc insists on running the assembler 83 | on compiler output. Another part is looking into the possibility of encoding 84 | bitcode in ELF sections like gcc does for gimple when doing LTO. 85 | 86 | Add support for address spaces. 87 | 88 | Add support for non-temporal stores. 89 | 90 | Add type based alias analysis tags in more cases. Extend LLVM's tbaa 91 | representation so it can represent a DAG and generate tags for struct 92 | types too. 93 | -------------------------------------------------------------------------------- /test/compilator/local/lucas_distrib_spec_MINIMIZED.f90: -------------------------------------------------------------------------------- 1 | program lucas_distrib 2 | real*8, allocatable :: a(:,:),wt(:) 3 | integer, parameter :: knowns(37)=(/2,3,5,7,13,17,19,31,61,89,107,127,521,607,1279,2203,2281,3217,4253,4423 & 4 | ,9689,9941,11213,19937,21701,23209,44497,86243,110503,132049,216091,756839,859433,1257787,1398269,2976221,3021377/) 5 | character*16, external :: hex_res64 6 | if(ihi==p-1.and.maxval(abs(a))==0) then 7 | if(any(p==knowns))then 8 | endif 9 | write(*,'(i10,a18)')p,hex_res64(a,n,pad,p,nbits,bits0,base_index(0),p-1) 10 | endif 11 | end program lucas_distrib 12 | character*16 function hex_res64(a,n,pad,p,nbits,bits0,base_index_word,iter) 13 | OUTER: do i=7,0,-1 14 | do j=n/8-1,0,-1 15 | if(a(j,i)/=0) then 16 | endif 17 | enddo 18 | enddo OUTER 19 | do i=1,ndigit 20 | enddo 21 | RES: do i=1,ndigit-1 22 | if(nrem /= 0)then 23 | endif 24 | enddo RES 25 | end function hex_res64 26 | subroutine mers_mod_square(a,base,baseinv,base_index,wt,n,pad,ilo,ihi,p,ofile,diagnose) 27 | logical, save :: first_entry=.true. 28 | if(first_entry) then 29 | do i=1,n 30 | enddo 31 | do i=1,n,2 32 | if(j > i) then 33 | endif 34 | do 35 | enddo 36 | enddo 37 | endif 38 | if(ilo==1)then 39 | do i=0,7 40 | enddo 41 | endif 42 | do iter=ilo+1,ihi-1 43 | do i=0,7 44 | do j=0,n8-1 45 | enddo 46 | enddo 47 | if(temp > err_abs .and. frac > err_rel)then 48 | endif 49 | if(fracmax >= 0.4d0)then 50 | if(fracmax > 0.45 ) then 51 | endif 52 | endif 53 | do 54 | enddo 55 | enddo 56 | if(temp > err_abs .and. frac > err_rel)then 57 | endif 58 | if(fracmax >= 0.4d0)then 59 | if(fracmax > 0.45 ) then 60 | endif 61 | endif 62 | do 63 | enddo 64 | end subroutine mers_mod_square 65 | subroutine fft_square(b,a,index,n,pad,check1i) 66 | logical, save :: first_entry=.true. 67 | if(first_entry) then 68 | do 69 | enddo 70 | if(mod(n2bit,3)==0)then 71 | endif 72 | do 73 | do m=1,mm-1 74 | enddo 75 | enddo 76 | if(mod(n2bit,3)==1)then 77 | do m=1,n8-1 78 | enddo 79 | endif 80 | endif 81 | do i=ilo,ihi,16 82 | enddo 83 | do m=1,8 84 | do i=ilo,ihi,16 85 | enddo 86 | enddo 87 | do j=2,n4 88 | enddo 89 | do m=1,8 90 | do i=ilo,ihi,16 91 | enddo 92 | enddo 93 | if(n2==65536)then 94 | do m=1,32768 95 | do i=ilo,ihi,4 96 | enddo 97 | enddo 98 | endif 99 | if(n2==131072)then 100 | do m=1,32768 101 | do i=ilo,ihi,8 102 | enddo 103 | enddo 104 | endif 105 | do m=1,32768 106 | do i=ilo,ihi,16 107 | enddo 108 | enddo 109 | if(n2==524288)then 110 | do m=1,262144 111 | do i=ilo,ihi,4 112 | enddo 113 | enddo 114 | endif 115 | do m=1,262144 116 | do i=ilo,ihi,16 117 | enddo 118 | enddo 119 | end subroutine fft_square 120 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "Configuring DragonEgg...") 2 | 3 | add_definitions(-DIN_GCC) 4 | 5 | set(DRAGONEGG_TARGET_GCC ${CMAKE_C_COMPILER} CACHE PATH "plugin --print-file-name=plugin") 6 | message(STATUS "Target GCC is ${DRAGONEGG_TARGET_GCC}") 7 | 8 | function(get_gcc_prop prop OUTVAR) 9 | execute_process( 10 | COMMAND ${DRAGONEGG_TARGET_GCC} "-${prop}" 11 | OUTPUT_STRIP_TRAILING_WHITESPACE 12 | OUTPUT_VARIABLE gcc_prop 13 | ) 14 | set(${OUTVAR} ${gcc_prop} PARENT_SCOPE) 15 | endfunction() 16 | 17 | function(get_gcc_version) 18 | get_gcc_prop(dumpversion VER) 19 | set(VER__ "${VER}.0.0") 20 | 21 | string(REGEX MATCHALL "[0-9]+" VERS ${VER__}) 22 | 23 | list(GET VERS 0 V0) 24 | set(GCC_MAJOR ${V0} PARENT_SCOPE) 25 | list(GET VERS 1 V1) 26 | set(GCC_MINOR ${V1} PARENT_SCOPE) 27 | list(GET VERS 2 V2) 28 | set(GCC_MICRO ${V2} PARENT_SCOPE) 29 | 30 | message(STATUS "The version is ${VER} (major=${V0}, minor=${V1}, micro=${V2})") 31 | endfunction() 32 | 33 | function(add_backend_header FLAG FILE) 34 | get_target_property(TARGET_UTIL TargetInfo LOCATION) 35 | set(DST ${CMAKE_BINARY_DIR}/include/dragonegg/${FILE}) 36 | file(GLOB inc include/*/dragonegg/${FILE}) 37 | add_custom_command( 38 | OUTPUT ${DST} 39 | COMMAND mkdir -p ${CMAKE_BINARY_DIR}/include/dragonegg 40 | COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/include/`${TARGET_UTIL} ${FLAG}`/dragonegg/${FILE} ${DST} 41 | DEPENDS 42 | ${inc} 43 | ${TARGET_UTIL} 44 | COMMENT "Updating include/dragonegg/${FILE}" 45 | ) 46 | set_source_files_properties(${DST} PROPERTIES GENERATED 1) 47 | add_file_dependencies(src/Backend.cpp ${DST}) 48 | endfunction() 49 | 50 | function(add_target_source FILE) 51 | get_target_property(TARGET_UTIL TargetInfo LOCATION) 52 | set(DST ${CMAKE_CURRENT_BINARY_DIR}/${FILE}) 53 | file(GLOB src src/*/${FILE}) 54 | add_custom_command( 55 | OUTPUT ${DST} 56 | COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/src/`${TARGET_UTIL} -p`/${FILE} ${DST} 57 | DEPENDS 58 | ${src} 59 | ${TARGET_UTIL} 60 | COMMENT "Updating ${FILE}" 61 | ) 62 | set_source_files_properties(${DST} PROPERTIES GENERATED 1) 63 | endfunction() 64 | 65 | get_gcc_prop("-print-file-name=plugin" GCC_PLUGIN_DIR) 66 | message(STATUS "GCC's plugin directory is ${GCC_PLUGIN_DIR}") 67 | include_directories(SYSTEM "${GCC_PLUGIN_DIR}/include") 68 | 69 | get_gcc_prop(dumpmachine TARGET_TRIPLE) 70 | message(STATUS "Target triple is ${TARGET_TRIPLE}") 71 | add_definitions(-DTARGET_TRIPLE="${TARGET_TRIPLE}") 72 | 73 | get_gcc_version() 74 | add_definitions( 75 | -DGCC_MAJOR=${GCC_MAJOR} 76 | -DGCC_MINOR=${GCC_MINOR} 77 | -DGCC_MICRO=${GCC_MICRO} 78 | ) 79 | 80 | # TODO: Put appropriate version string. 81 | add_definitions(-DLLVM_VERSION="") 82 | 83 | include_directories(include) 84 | 85 | add_subdirectory(utils) 86 | 87 | add_backend_header(-o OS.h) 88 | 89 | # add_backend_header(-p Target.h) 90 | string(REGEX MATCH "^(i[3-6]86|x86_64)-" TARGET_X86 ${TARGET_TRIPLE}) 91 | string(REGEX MATCH "^(arm|thumb)" TARGET_ARM ${TARGET_TRIPLE}) 92 | if (TARGET_ARM) 93 | set(TARGET_ARCH "ARM") 94 | elseif (TARGET_X86) 95 | set(TARGET_ARCH "X86") 96 | else () 97 | message(FATAL_ERROR "Target architecture is unknown") 98 | endif () 99 | 100 | message(STATUS "Target architecture is ${TARGET_ARCH}") 101 | string(TOLOWER ${TARGET_ARCH} TARGET_arch_dir) 102 | include_directories("include/${TARGET_arch_dir}") 103 | 104 | file(GLOB SRC src/*.cpp) 105 | set(LLVM_LINK_COMPONENTS ipo scalaropts X86) 106 | 107 | add_llvm_loadable_module( 108 | dragonegg 109 | src/Aliasing.cpp 110 | src/Backend.cpp 111 | src/bits_and_bobs.cpp 112 | src/Cache.cpp 113 | src/ConstantConversion.cpp 114 | src/Convert.cpp 115 | src/Debug.cpp 116 | src/DefaultABI.cpp 117 | src/Trees.cpp 118 | src/TypeConversion.cpp 119 | src/${TARGET_arch_dir}/Target.cpp 120 | 121 | DEPENDS 122 | intrinsics_gen 123 | ) 124 | 125 | add_subdirectory(test) 126 | -------------------------------------------------------------------------------- /include/dragonegg/ADT/Range.h: -------------------------------------------------------------------------------- 1 | //=------------------ Range.h - Interval of values ----------------*- C++ -*-=// 2 | // 3 | // Copyright (C) 2011 to 2013 Duncan Sands. 4 | // 5 | // This file is part of DragonEgg. 6 | // 7 | // DragonEgg is free software; you can redistribute it and/or modify it under 8 | // the terms of the GNU General Public License as published by the Free Software 9 | // Foundation; either version 2, or (at your option) any later version. 10 | // 11 | // DragonEgg is distributed in the hope that it will be useful, but WITHOUT ANY 12 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 13 | // A PARTICULAR PURPOSE. See the GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License along with 16 | // DragonEgg; see the file COPYING. If not, write to the Free Software 17 | // Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. 18 | // 19 | //===----------------------------------------------------------------------===// 20 | // This file declares a utility class for representing an interval of values. 21 | //===----------------------------------------------------------------------===// 22 | 23 | #ifndef DRAGONEGG_RANGE_H 24 | #define DRAGONEGG_RANGE_H 25 | 26 | #include 27 | 28 | /// Range - Represents the interval [First, Last). 29 | template class Range { 30 | T First, Last; 31 | public: 32 | Range() : First(0), Last(0) {} 33 | Range(T first, T last) : First(first), Last(last) {} 34 | 35 | bool operator==(const Range &other) const { 36 | return (empty() && other.empty()) || 37 | (First == other.First && Last == other.Last); 38 | } 39 | 40 | /// empty - Return whether the range is empty. 41 | bool empty() const { return Last <= First; } 42 | 43 | /// getFirst - Return the value defining the start of the range. 44 | T getFirst() const { 45 | assert(!empty() && "An empty range has no starting value!"); 46 | return First; 47 | } 48 | 49 | /// getLast - Return the value defining the end of the range. 50 | T getLast() const { 51 | assert(!empty() && "An empty range has no ending value!"); 52 | return Last; 53 | } 54 | 55 | /// getWidth - Return the number of values in the range. 56 | T getWidth() const { return empty() ? 0 : Last - First; } 57 | 58 | /// contains - Return true if the given range is contained in this one. 59 | bool contains(Range r) const { 60 | if (r.empty()) 61 | return true; 62 | if (empty()) 63 | return false; 64 | return First <= r.First && Last >= r.Last; 65 | } 66 | 67 | /// intersects - Return true if the given range intersects this one. 68 | bool intersects(Range r) const { 69 | if (empty() || r.empty()) 70 | return false; 71 | return r.First < Last && r.Last > First; 72 | } 73 | 74 | /// Displace - Return the range obtained by adding the given offset. 75 | Range Displace(T Offset) const { 76 | if (empty()) 77 | return Range(); 78 | assert(((Offset >= 0 && First + Offset >= First && Last + Offset >= Last) || 79 | (Offset < 0 && First + Offset < First && Last + Offset < Last)) && 80 | "Displacement wrapped range!"); 81 | return Range(First + Offset, Last + Offset); 82 | } 83 | 84 | /// Join - Return the smallest range containing this range and the given one. 85 | Range Join(Range other) const { 86 | if (empty()) 87 | return other; 88 | if (other.empty()) 89 | return *this; 90 | return Range(First < other.First ? First : other.First, 91 | Last > other.Last ? Last : other.Last); 92 | } 93 | 94 | /// Meet - Return the intersection of this range and the given one. 95 | Range Meet(Range other) const { 96 | if (empty() || other.empty()) 97 | return Range(); 98 | return Range(First > other.First ? First : other.First, 99 | Last < other.Last ? Last : other.Last); 100 | } 101 | }; 102 | 103 | #endif /* DRAGONEGG_RANGE_H */ 104 | -------------------------------------------------------------------------------- /test/validator/c++/2010-07-23-DeclLoc.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %dragonegg -S -g %s -o - | FileCheck %s 2 | // Require the template function declaration refer to the correct filename. 3 | // First, locate the function decl in metadata, and pluck out the file handle: 4 | // CHECK: = metadata !{metadata !"0x2e\00extract_dwarf_data_from_header{{[^"]*}}", metadata ![[filedata:[0-9]+]], 5 | // Second: Require that filetag refers to metadata holding the correct filename: 6 | // CHECK: {{^!}}[[filedata]] = metadata !{metadata !"decl_should_be_here.hpp", 7 | typedef long unsigned int __darwin_size_t; 8 | typedef __darwin_size_t size_t; 9 | typedef unsigned char uint8_t; 10 | typedef unsigned int uint32_t; 11 | typedef unsigned long long uint64_t; 12 | namespace std { 13 | template class auto_ptr { 14 | _Tp* _M_ptr; 15 | public: 16 | typedef _Tp element_type; 17 | auto_ptr(element_type* __p = 0) throw() : _M_ptr(__p) { } 18 | element_type& operator*() const throw() { } 19 | }; 20 | } 21 | class Pointer32 { 22 | public: 23 | typedef uint32_t ptr_t; 24 | typedef uint32_t size_t; 25 | }; 26 | class Pointer64 { 27 | public: 28 | typedef uint64_t ptr_t; 29 | typedef uint64_t size_t; 30 | }; 31 | class BigEndian {}; 32 | class LittleEndian {}; 33 | template class SizeAndEndianness { 34 | public: 35 | typedef _SIZE SIZE; 36 | }; 37 | typedef SizeAndEndianness ISA32Little; 38 | typedef SizeAndEndianness ISA32Big; 39 | typedef SizeAndEndianness ISA64Little; 40 | typedef SizeAndEndianness ISA64Big; 41 | template class TRange { 42 | protected: 43 | typename SIZE::ptr_t _location; 44 | typename SIZE::size_t _length; 45 | TRange(typename SIZE::ptr_t location, typename SIZE::size_t length) : _location(location), _length(length) { } 46 | }; 47 | template class TRangeValue : public TRange { 48 | T _value; 49 | public: 50 | TRangeValue(typename SIZE::ptr_t location, typename SIZE::size_t length, T value) : TRange(location, length), _value(value) {}; 51 | }; 52 | template class TAddressRelocator {}; 53 | class CSCppSymbolOwner{}; 54 | class CSCppSymbolOwnerData{}; 55 | template class TRawSymbolOwnerData 56 | { 57 | TRangeValue< SIZE, uint8_t* > _TEXT_text_section; 58 | const char* _dsym_path; 59 | uint32_t _dylib_current_version; 60 | uint32_t _dylib_compatibility_version; 61 | public: 62 | TRawSymbolOwnerData() : 63 | _TEXT_text_section(0, 0, __null), _dsym_path(__null), _dylib_current_version(0), _dylib_compatibility_version(0) {} 64 | }; 65 | template class TExtendedMachOHeader {}; 66 | # 16 "decl_should_be_here.hpp" 67 | template void extract_dwarf_data_from_header(TExtendedMachOHeader& header, 68 | TRawSymbolOwnerData& symbol_owner_data, 69 | TAddressRelocator* address_relocator) {} 70 | struct CSCppSymbolOwnerHashFunctor { 71 | size_t operator()(const CSCppSymbolOwner& symbol_owner) const { 72 | # 97 "wrong_place_for_decl.cpp" 73 | } 74 | }; 75 | template CSCppSymbolOwnerData* create_symbol_owner_data_arch_specific(CSCppSymbolOwner* symbol_owner, const char* dsym_path) { 76 | typedef typename SIZE_AND_ENDIANNESS::SIZE SIZE; 77 | std::auto_ptr< TRawSymbolOwnerData > data(new TRawSymbolOwnerData()); 78 | std::auto_ptr< TExtendedMachOHeader > header; 79 | extract_dwarf_data_from_header(*header, *data, (TAddressRelocator*)__null); 80 | } 81 | CSCppSymbolOwnerData* create_symbol_owner_data2(CSCppSymbolOwner* symbol_owner, const char* dsym_path) { 82 | create_symbol_owner_data_arch_specific< ISA32Little >(symbol_owner, dsym_path); 83 | create_symbol_owner_data_arch_specific< ISA32Big >(symbol_owner, dsym_path); 84 | create_symbol_owner_data_arch_specific< ISA64Little >(symbol_owner, dsym_path); 85 | create_symbol_owner_data_arch_specific< ISA64Big >(symbol_owner, dsym_path); 86 | } 87 | -------------------------------------------------------------------------------- /include/dragonegg/TypeConversion.h: -------------------------------------------------------------------------------- 1 | //=----- TypeConversion.h - Converting and working with types -----*- C++ -*-=// 2 | // 3 | // Copyright (C) 2011 to 2013 Duncan Sands. 4 | // 5 | // This file is part of DragonEgg. 6 | // 7 | // DragonEgg is free software; you can redistribute it and/or modify it under 8 | // the terms of the GNU General Public License as published by the Free Software 9 | // Foundation; either version 2, or (at your option) any later version. 10 | // 11 | // DragonEgg is distributed in the hope that it will be useful, but WITHOUT ANY 12 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 13 | // A PARTICULAR PURPOSE. See the GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License along with 16 | // DragonEgg; see the file COPYING. If not, write to the Free Software 17 | // Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. 18 | // 19 | //===----------------------------------------------------------------------===// 20 | // This file declares functions for converting GCC types to LLVM types, and for 21 | // working with types. 22 | //===----------------------------------------------------------------------===// 23 | 24 | #ifndef DRAGONEGG_TYPES_H 25 | #define DRAGONEGG_TYPES_H 26 | 27 | // LLVM headers 28 | #include "llvm/IR/CallingConv.h" 29 | 30 | // Forward declarations. 31 | namespace llvm { 32 | class AttributeSet; 33 | class FunctionType; 34 | class LLVMContext; 35 | class Type; 36 | } 37 | union tree_node; 38 | 39 | //===----------------------------------------------------------------------===// 40 | // Utilities 41 | //===----------------------------------------------------------------------===// 42 | 43 | #define NO_LENGTH (~(uint64_t) 0) 44 | 45 | /// ArrayLengthOf - Returns the length of the given gcc array type, or NO_LENGTH 46 | /// if the array has variable or unknown length. 47 | extern uint64_t ArrayLengthOf(tree_node *type); 48 | 49 | /// GetFieldIndex - Return the index of the field in the given LLVM type that 50 | /// corresponds to the GCC field declaration 'decl'. This means that the LLVM 51 | /// and GCC fields start in the same byte (if 'decl' is a bitfield, this means 52 | /// that its first bit is within the byte the LLVM field starts at). Returns 53 | /// INT_MAX if there is no such LLVM field. 54 | int GetFieldIndex(tree_node *decl, llvm::Type *Ty); 55 | 56 | /// GetUnitType - Returns an integer one address unit wide if 'NumUnits' is 1; 57 | /// otherwise returns an array of such integers with 'NumUnits' elements. For 58 | /// example, on a machine which has 16 bit bytes returns an i16 or an array of 59 | /// i16. 60 | extern llvm::Type *GetUnitType(llvm::LLVMContext &C, unsigned NumUnits = 1); 61 | 62 | /// GetUnitPointerType - Returns an LLVM pointer type which points to memory one 63 | /// address unit wide. For example, on a machine which has 16 bit bytes returns 64 | /// an i16*. 65 | extern llvm::Type * 66 | GetUnitPointerType(llvm::LLVMContext &C, unsigned AddrSpace = 0); 67 | 68 | /// isSizeCompatible - Return true if the specified gcc type is guaranteed to be 69 | /// turned by ConvertType into an LLVM type of the same size (i.e. TYPE_SIZE the 70 | /// same as getTypeAllocSizeInBits). 71 | extern bool isSizeCompatible(tree_node *type); 72 | 73 | /// getRegType - Returns the LLVM type to use for registers that hold a value 74 | /// of the scalar GCC type 'type'. All of the EmitReg* routines use this to 75 | /// determine the LLVM type to return. Note that this only considers the main 76 | /// variant of the type. 77 | extern llvm::Type *getRegType(tree_node *type); 78 | 79 | /// getPointerToType - Returns the LLVM register type to use for a pointer to 80 | /// the given GCC type. 81 | extern llvm::Type *getPointerToType(tree_node *type); 82 | 83 | /// ConvertType - Returns the LLVM type to use for memory that holds a value 84 | /// of the given GCC type (getRegType should be used for values in registers). 85 | /// Note that the conversion only considers the main variant of the type. 86 | extern llvm::Type *ConvertType(tree_node *type); 87 | 88 | /// ConvertFunctionType - Convert the specified FUNCTION_TYPE or METHOD_TYPE 89 | /// tree to an LLVM type. This does the same thing that ConvertType does, but 90 | /// it also returns the function's LLVM calling convention and attributes. 91 | extern llvm::FunctionType * 92 | ConvertFunctionType(tree_node *type, tree_node *decl, tree_node *static_chain, 93 | llvm::CallingConv::ID &CC, llvm::AttributeSet &PAL); 94 | 95 | /// ConvertArgListToFnType - Given a DECL_ARGUMENTS list on an GCC tree, 96 | /// return the LLVM type corresponding to the function. This is useful for 97 | /// turning "T foo(...)" functions into "T foo(void)" functions. 98 | llvm::FunctionType *ConvertArgListToFnType( 99 | tree_node *type, llvm::ArrayRef arglist, 100 | tree_node *static_chain, bool KNRPromotion, llvm::CallingConv::ID &CC, 101 | llvm::AttributeSet &PAL); 102 | 103 | #endif /* DRAGONEGG_TYPES_H */ 104 | --------------------------------------------------------------------------------