1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
//! The LLVM intermediate representation.

use super::*;

// Core
extern "C" {
    pub fn LLVMShutdown();
    pub fn LLVMCreateMessage(Message: *const ::libc::c_char) -> *mut ::libc::c_char;
    pub fn LLVMDisposeMessage(Message: *mut ::libc::c_char);
}

// Core->Contexts
extern "C" {
    pub fn LLVMContextCreate() -> LLVMContextRef;
    pub fn LLVMGetGlobalContext() -> LLVMContextRef;
    pub fn LLVMContextSetDiagnosticHandler(C: LLVMContextRef,
                                           Handler: LLVMDiagnosticHandler,
                                           DiagnosticContext: *mut ::libc::c_void);
    /// Get the diagnostic handler of this context.
    pub fn LLVMContextGetDiagnosticHandler(C: LLVMContextRef) -> LLVMDiagnosticHandler;
    /// Get the diagnostic context of this context.
    pub fn LLVMContextGetDiagnosticContext(C: LLVMContextRef) -> *mut ::libc::c_void;
    pub fn LLVMContextSetYieldCallback(C: LLVMContextRef,
                                       Callback: LLVMYieldCallback,
                                       OpaqueHandle: *mut ::libc::c_void);
    pub fn LLVMContextDispose(C: LLVMContextRef);
    pub fn LLVMGetDiagInfoDescription(DI: LLVMDiagnosticInfoRef) -> *mut ::libc::c_char;
    pub fn LLVMGetDiagInfoSeverity(DI: LLVMDiagnosticInfoRef) -> LLVMDiagnosticSeverity;
    pub fn LLVMGetMDKindIDInContext(C: LLVMContextRef,
                                    Name: *const ::libc::c_char,
                                    SLen: ::libc::c_uint)
                                    -> ::libc::c_uint;
    pub fn LLVMGetMDKindID(Name: *const ::libc::c_char, SLen: ::libc::c_uint) -> ::libc::c_uint;

    /// Return a unique id given the name of an enum attribute, or 0 if no attribute
    /// by that name exists.
    ///
    /// See http://llvm.org/docs/LangRef.html#parameter-attributes
    /// and http://llvm.org/docs/LangRef.html#function-attributes
    /// for the list of available attributes.
    ///
    /// Note that attribute names and IDs are not subject to the same stability
    /// guarantees as this API.
    pub fn LLVMGetEnumAttributeKindForName(Name: *const ::libc::c_char,
                                           SLen: ::libc::size_t)
                                           -> ::libc::c_uint;
    pub fn LLVMGetLastEnumAttributeKind() -> ::libc::c_uint;

    /// Create an enum attribute.
    pub fn LLVMCreateEnumAttribute(C: LLVMContextRef,
                                   KindID: ::libc::c_uint,
                                   Val: u64)
                                   -> LLVMAttributeRef;
    /// Get the unique id corresponding to the provided enum attribute.
    pub fn LLVMGetEnumAttributeKind(A: LLVMAttributeRef) -> ::libc::c_uint;
    /// Get the value of an enum attribute.
    ///
    /// Returns 0 if none exists.
    pub fn LLVMGetEnumAttributeValue(A: LLVMAttributeRef) -> u64;
    /// Create a string attribute.
    pub fn LLVMCreateStringAttribute(C: LLVMContextRef,
                                     K: *const ::libc::c_char,
                                     KLength: ::libc::c_uint,
                                     V: *const ::libc::c_char,
                                     VLength: ::libc::c_uint)
                                     -> LLVMAttributeRef;
    /// Get a string attribute's kind.
    pub fn LLVMGetStringAttributeKind(A: LLVMAttributeRef,
                                      Length: *mut ::libc::c_uint)
                                      -> *const ::libc::c_char;
    /// Get a string attribute's value.
    pub fn LLVMGetStringAttributeValue(A: LLVMAttributeRef,
                                       Length: *mut ::libc::c_uint)
                                       -> *const ::libc::c_char;
    pub fn LLVMIsEnumAttribute(A: LLVMAttributeRef) -> LLVMBool;
    pub fn LLVMIsStringAttribute(A: LLVMAttributeRef) -> LLVMBool;
}

// Core->Modules
extern "C" {
    pub fn LLVMModuleCreateWithName(ModuleID: *const ::libc::c_char) -> LLVMModuleRef;
    pub fn LLVMModuleCreateWithNameInContext(ModuleID: *const ::libc::c_char,
                                             C: LLVMContextRef)
                                             -> LLVMModuleRef;
    pub fn LLVMCloneModule(M: LLVMModuleRef) -> LLVMModuleRef;
    pub fn LLVMDisposeModule(M: LLVMModuleRef);
    /// Get the identifier of a module.
    ///
    /// `Len` is written to contains the length of the returned string.
    pub fn LLVMGetModuleIdentifier(M: LLVMModuleRef,
                                   Len: *mut ::libc::size_t)
                                   -> *const ::libc::c_char;
    /// Set the identifier of a module.
    ///
    /// `Len` is the length of the string pointed to by `Ident`.
    pub fn LLVMSetModuleIdentifier(M: LLVMModuleRef,
                                   Ident: *const ::libc::c_char,
                                   Len: ::libc::size_t);
    #[deprecated(since="3.9", note="Confusingly named. Use LLVMGetDataLayoutStr.")]
    pub fn LLVMGetDataLayout(M: LLVMModuleRef) -> *const ::libc::c_char;
    /// Obtain the data layout for a module.
    pub fn LLVMGetDataLayoutStr(M: LLVMModuleRef) -> *const ::libc::c_char;
    pub fn LLVMSetDataLayout(M: LLVMModuleRef, DataLayoutStr: *const ::libc::c_char);
    pub fn LLVMGetTarget(M: LLVMModuleRef) -> *const ::libc::c_char;
    pub fn LLVMSetTarget(M: LLVMModuleRef, Triple: *const ::libc::c_char);
    pub fn LLVMDumpModule(M: LLVMModuleRef);
    pub fn LLVMPrintModuleToFile(M: LLVMModuleRef,
                                 Filename: *const ::libc::c_char,
                                 ErrorMessage: *mut *mut ::libc::c_char)
                                 -> LLVMBool;
    pub fn LLVMPrintModuleToString(M: LLVMModuleRef) -> *mut ::libc::c_char;
    pub fn LLVMSetModuleInlineAsm(M: LLVMModuleRef, Asm: *const ::libc::c_char);
    pub fn LLVMGetModuleContext(M: LLVMModuleRef) -> LLVMContextRef;
    pub fn LLVMGetTypeByName(M: LLVMModuleRef, Name: *const ::libc::c_char) -> LLVMTypeRef;
    pub fn LLVMGetNamedMetadataNumOperands(M: LLVMModuleRef,
                                           name: *const ::libc::c_char)
                                           -> ::libc::c_uint;
    pub fn LLVMGetNamedMetadataOperands(M: LLVMModuleRef,
                                        name: *const ::libc::c_char,
                                        Dest: *mut LLVMValueRef);
    pub fn LLVMAddNamedMetadataOperand(M: LLVMModuleRef,
                                       name: *const ::libc::c_char,
                                       Val: LLVMValueRef);
    pub fn LLVMAddFunction(M: LLVMModuleRef,
                           Name: *const ::libc::c_char,
                           FunctionTy: LLVMTypeRef)
                           -> LLVMValueRef;
    pub fn LLVMGetNamedFunction(M: LLVMModuleRef, Name: *const ::libc::c_char) -> LLVMValueRef;
    pub fn LLVMGetFirstFunction(M: LLVMModuleRef) -> LLVMValueRef;
    pub fn LLVMGetLastFunction(M: LLVMModuleRef) -> LLVMValueRef;
    pub fn LLVMGetNextFunction(Fn: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMGetPreviousFunction(Fn: LLVMValueRef) -> LLVMValueRef;
}

// Core->Types
extern "C" {
    pub fn LLVMGetTypeKind(Ty: LLVMTypeRef) -> LLVMTypeKind;
    pub fn LLVMTypeIsSized(Ty: LLVMTypeRef) -> LLVMBool;
    pub fn LLVMGetTypeContext(Ty: LLVMTypeRef) -> LLVMContextRef;
    pub fn LLVMDumpType(Val: LLVMTypeRef);
    pub fn LLVMPrintTypeToString(Val: LLVMTypeRef) -> *mut ::libc::c_char;

    // Core->Types->Integer
    pub fn LLVMInt1TypeInContext(C: LLVMContextRef) -> LLVMTypeRef;
    pub fn LLVMInt8TypeInContext(C: LLVMContextRef) -> LLVMTypeRef;
    pub fn LLVMInt16TypeInContext(C: LLVMContextRef) -> LLVMTypeRef;
    pub fn LLVMInt32TypeInContext(C: LLVMContextRef) -> LLVMTypeRef;
    pub fn LLVMInt64TypeInContext(C: LLVMContextRef) -> LLVMTypeRef;
    pub fn LLVMInt128TypeInContext(C: LLVMContextRef) -> LLVMTypeRef;
    pub fn LLVMIntTypeInContext(C: LLVMContextRef, NumBits: ::libc::c_uint) -> LLVMTypeRef;
    pub fn LLVMInt1Type() -> LLVMTypeRef;
    pub fn LLVMInt8Type() -> LLVMTypeRef;
    pub fn LLVMInt16Type() -> LLVMTypeRef;
    pub fn LLVMInt32Type() -> LLVMTypeRef;
    pub fn LLVMInt64Type() -> LLVMTypeRef;
    pub fn LLVMInt128Type() -> LLVMTypeRef;
    pub fn LLVMIntType(NumBits: ::libc::c_uint) -> LLVMTypeRef;
    pub fn LLVMGetIntTypeWidth(IntegerTy: LLVMTypeRef) -> ::libc::c_uint;

    // Core->Types->Floating-Point
    pub fn LLVMHalfTypeInContext(C: LLVMContextRef) -> LLVMTypeRef;
    pub fn LLVMFloatTypeInContext(C: LLVMContextRef) -> LLVMTypeRef;
    pub fn LLVMDoubleTypeInContext(C: LLVMContextRef) -> LLVMTypeRef;
    pub fn LLVMX86FP80TypeInContext(C: LLVMContextRef) -> LLVMTypeRef;
    pub fn LLVMFP128TypeInContext(C: LLVMContextRef) -> LLVMTypeRef;
    pub fn LLVMPPCFP128TypeInContext(C: LLVMContextRef) -> LLVMTypeRef;
    pub fn LLVMHalfType() -> LLVMTypeRef;
    pub fn LLVMFloatType() -> LLVMTypeRef;
    pub fn LLVMDoubleType() -> LLVMTypeRef;
    pub fn LLVMX86FP80Type() -> LLVMTypeRef;
    pub fn LLVMFP128Type() -> LLVMTypeRef;
    pub fn LLVMPPCFP128Type() -> LLVMTypeRef;

    // Core->Types->Function
    pub fn LLVMFunctionType(ReturnType: LLVMTypeRef,
                            ParamTypes: *mut LLVMTypeRef,
                            ParamCount: ::libc::c_uint,
                            IsVarArg: LLVMBool)
                            -> LLVMTypeRef;
    pub fn LLVMIsFunctionVarArg(FunctionTy: LLVMTypeRef) -> LLVMBool;
    pub fn LLVMGetReturnType(FunctionTy: LLVMTypeRef) -> LLVMTypeRef;
    pub fn LLVMCountParamTypes(FunctionTy: LLVMTypeRef) -> ::libc::c_uint;
    pub fn LLVMGetParamTypes(FunctionTy: LLVMTypeRef, Dest: *mut LLVMTypeRef);

    // Core->Types->Struct
    pub fn LLVMStructTypeInContext(C: LLVMContextRef,
                                   ElementTypes: *mut LLVMTypeRef,
                                   ElementCount: ::libc::c_uint,
                                   Packed: LLVMBool)
                                   -> LLVMTypeRef;
    pub fn LLVMStructType(ElementTypes: *mut LLVMTypeRef,
                          ElementCount: ::libc::c_uint,
                          Packed: LLVMBool)
                          -> LLVMTypeRef;
    pub fn LLVMStructCreateNamed(C: LLVMContextRef, Name: *const ::libc::c_char) -> LLVMTypeRef;
    pub fn LLVMGetStructName(Ty: LLVMTypeRef) -> *const ::libc::c_char;
    pub fn LLVMStructSetBody(StructTy: LLVMTypeRef,
                             ElementTypes: *mut LLVMTypeRef,
                             ElementCount: ::libc::c_uint,
                             Packed: LLVMBool);
    pub fn LLVMCountStructElementTypes(StructTy: LLVMTypeRef) -> ::libc::c_uint;
    pub fn LLVMGetStructElementTypes(StructTy: LLVMTypeRef, Dest: *mut LLVMTypeRef);
    /// Get the type of the element at the given index in a structure.
    ///
    /// Added in LLVM 3.7.
    pub fn LLVMStructGetTypeAtIndex(StructTy: LLVMTypeRef, i: ::libc::c_uint) -> LLVMTypeRef;
    /// Determine whether a structure is packed.
    pub fn LLVMIsPackedStruct(StructTy: LLVMTypeRef) -> LLVMBool;
    pub fn LLVMIsOpaqueStruct(StructTy: LLVMTypeRef) -> LLVMBool;

    // Core->Types->Sequential
    pub fn LLVMGetElementType(Ty: LLVMTypeRef) -> LLVMTypeRef;
    pub fn LLVMArrayType(ElementType: LLVMTypeRef, ElementCount: ::libc::c_uint) -> LLVMTypeRef;
    pub fn LLVMGetArrayLength(ArrayTy: LLVMTypeRef) -> ::libc::c_uint;
    pub fn LLVMPointerType(ElementType: LLVMTypeRef, AddressSpace: ::libc::c_uint) -> LLVMTypeRef;
    pub fn LLVMGetPointerAddressSpace(PointerTy: LLVMTypeRef) -> ::libc::c_uint;
    pub fn LLVMVectorType(ElementType: LLVMTypeRef, ElementCount: ::libc::c_uint) -> LLVMTypeRef;
    pub fn LLVMGetVectorSize(VectorTy: LLVMTypeRef) -> ::libc::c_uint;

    // Core->Types->Other
    pub fn LLVMVoidTypeInContext(C: LLVMContextRef) -> LLVMTypeRef;
    pub fn LLVMLabelTypeInContext(C: LLVMContextRef) -> LLVMTypeRef;
    pub fn LLVMX86MMXTypeInContext(C: LLVMContextRef) -> LLVMTypeRef;
    pub fn LLVMVoidType() -> LLVMTypeRef;
    pub fn LLVMLabelType() -> LLVMTypeRef;
    pub fn LLVMX86MMXType() -> LLVMTypeRef;
}

// Core->Values
extern "C" {
    // Core->Values->General
    // Get the enumerated kind of a Value instance.
    pub fn LLVMGetValueKind(Val: LLVMValueRef) -> LLVMValueKind;
    pub fn LLVMTypeOf(Val: LLVMValueRef) -> LLVMTypeRef;
    pub fn LLVMGetValueName(Val: LLVMValueRef) -> *const ::libc::c_char;
    pub fn LLVMSetValueName(Val: LLVMValueRef, Name: *const ::libc::c_char);
    pub fn LLVMDumpValue(Val: LLVMValueRef);
    pub fn LLVMPrintValueToString(Val: LLVMValueRef) -> *mut ::libc::c_char;
    pub fn LLVMReplaceAllUsesWith(OldVal: LLVMValueRef, NewVal: LLVMValueRef);
    /// Determine whether the specified value instance is constant.
    pub fn LLVMIsConstant(Val: LLVMValueRef) -> LLVMBool;
    pub fn LLVMIsUndef(Val: LLVMValueRef) -> LLVMBool;
    pub fn LLVMIsAMDNode(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAMDString(Val: LLVMValueRef) -> LLVMValueRef;

    // Core->Values->Usage
    pub fn LLVMGetFirstUse(Val: LLVMValueRef) -> LLVMUseRef;
    pub fn LLVMGetNextUse(U: LLVMUseRef) -> LLVMUseRef;
    pub fn LLVMGetUser(U: LLVMUseRef) -> LLVMValueRef;
    pub fn LLVMGetUsedValue(U: LLVMUseRef) -> LLVMValueRef;

    // Core->Values->User value
    pub fn LLVMGetOperand(Val: LLVMValueRef, Index: ::libc::c_uint) -> LLVMValueRef;
    pub fn LLVMGetOperandUse(Val: LLVMValueRef, Index: ::libc::c_uint) -> LLVMUseRef;
    pub fn LLVMSetOperand(User: LLVMValueRef, Index: ::libc::c_uint, Val: LLVMValueRef);
    pub fn LLVMGetNumOperands(Val: LLVMValueRef) -> ::libc::c_int;

    // Core->Values->Constants
    pub fn LLVMConstNull(Ty: LLVMTypeRef) -> LLVMValueRef;
    pub fn LLVMConstAllOnes(Ty: LLVMTypeRef) -> LLVMValueRef;
    pub fn LLVMGetUndef(Ty: LLVMTypeRef) -> LLVMValueRef;
    pub fn LLVMIsNull(Val: LLVMValueRef) -> LLVMBool;
    pub fn LLVMConstPointerNull(Ty: LLVMTypeRef) -> LLVMValueRef;

    // Core->Values->Constants->Scalar
    pub fn LLVMConstInt(IntTy: LLVMTypeRef,
                        N: ::libc::c_ulonglong,
                        SignExtend: LLVMBool)
                        -> LLVMValueRef;
    pub fn LLVMConstIntOfArbitraryPrecision(IntTy: LLVMTypeRef,
                                            NumWords: ::libc::c_uint,
                                            Words: *const u64)
                                            -> LLVMValueRef;
    pub fn LLVMConstIntOfString(IntTy: LLVMTypeRef,
                                Text: *const ::libc::c_char,
                                Radix: u8)
                                -> LLVMValueRef;
    pub fn LLVMConstIntOfStringAndSize(IntTy: LLVMTypeRef,
                                       Text: *const ::libc::c_char,
                                       SLen: ::libc::c_uint,
                                       Radix: u8)
                                       -> LLVMValueRef;
    pub fn LLVMConstReal(RealTy: LLVMTypeRef, N: ::libc::c_double) -> LLVMValueRef;
    pub fn LLVMConstRealOfString(RealTy: LLVMTypeRef, Text: *const ::libc::c_char) -> LLVMValueRef;
    pub fn LLVMConstRealOfStringAndSize(RealTy: LLVMTypeRef,
                                        Text: *const ::libc::c_char,
                                        SLen: ::libc::c_uint)
                                        -> LLVMValueRef;
    pub fn LLVMConstIntGetZExtValue(ConstantVal: LLVMValueRef) -> ::libc::c_ulonglong;
    pub fn LLVMConstIntGetSExtValue(ConstantVal: LLVMValueRef) -> ::libc::c_longlong;
    pub fn LLVMConstRealGetDouble(ConstantVal: LLVMValueRef,
                                  losesInfo: *mut LLVMBool)
                                  -> ::libc::c_double;

    // Core->Values->Constants->Composite
    pub fn LLVMConstStringInContext(C: LLVMContextRef,
                                    Str: *const ::libc::c_char,
                                    Length: ::libc::c_uint,
                                    DontNullTerminate: LLVMBool)
                                    -> LLVMValueRef;
    pub fn LLVMConstString(Str: *const ::libc::c_char,
                           Length: ::libc::c_uint,
                           DontNullTerminate: LLVMBool)
                           -> LLVMValueRef;
    pub fn LLVMIsConstantString(c: LLVMValueRef) -> LLVMBool;
    pub fn LLVMGetAsString(C: LLVMValueRef, Length: *mut ::libc::size_t) -> *const ::libc::c_char;
    pub fn LLVMConstStructInContext(C: LLVMContextRef,
                                    ConstantVals: *mut LLVMValueRef,
                                    Count: ::libc::c_uint,
                                    Packed: LLVMBool)
                                    -> LLVMValueRef;
    pub fn LLVMConstStruct(ConstantVals: *mut LLVMValueRef,
                           Count: ::libc::c_uint,
                           Packed: LLVMBool)
                           -> LLVMValueRef;
    pub fn LLVMConstArray(ElementTy: LLVMTypeRef,
                          ConstantVals: *mut LLVMValueRef,
                          Length: ::libc::c_uint)
                          -> LLVMValueRef;
    pub fn LLVMConstNamedStruct(StructTy: LLVMTypeRef,
                                ConstantVals: *mut LLVMValueRef,
                                Count: ::libc::c_uint)
                                -> LLVMValueRef;
    pub fn LLVMGetElementAsConstant(C: LLVMValueRef, idx: ::libc::c_uint) -> LLVMValueRef;
    pub fn LLVMConstVector(ScalarConstantVals: *mut LLVMValueRef,
                           Size: ::libc::c_uint)
                           -> LLVMValueRef;

    // Core->Values->Constants->Constant expressions
    pub fn LLVMGetConstOpcode(ConstantVal: LLVMValueRef) -> LLVMOpcode;
    pub fn LLVMAlignOf(Ty: LLVMTypeRef) -> LLVMValueRef;
    pub fn LLVMSizeOf(Ty: LLVMTypeRef) -> LLVMValueRef;
    pub fn LLVMConstNeg(ConstantVal: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMConstNSWNeg(ConstantVal: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMConstNUWNeg(ConstantVal: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMConstFNeg(ConstantVal: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMConstNot(ConstantVal: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMConstAdd(LHSConstant: LLVMValueRef, RHSConstant: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMConstNSWAdd(LHSConstant: LLVMValueRef, RHSConstant: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMConstNUWAdd(LHSConstant: LLVMValueRef, RHSConstant: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMConstFAdd(LHSConstant: LLVMValueRef, RHSConstant: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMConstSub(LHSConstant: LLVMValueRef, RHSConstant: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMConstNSWSub(LHSConstant: LLVMValueRef, RHSConstant: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMConstNUWSub(LHSConstant: LLVMValueRef, RHSConstant: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMConstFSub(LHSConstant: LLVMValueRef, RHSConstant: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMConstMul(LHSConstant: LLVMValueRef, RHSConstant: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMConstNSWMul(LHSConstant: LLVMValueRef, RHSConstant: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMConstNUWMul(LHSConstant: LLVMValueRef, RHSConstant: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMConstFMul(LHSConstant: LLVMValueRef, RHSConstant: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMConstUDiv(LHSConstant: LLVMValueRef, RHSConstant: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMConstExactUDiv(LHSConstant: LLVMValueRef, RHSConstant: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMConstSDiv(LHSConstant: LLVMValueRef, RHSConstant: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMConstExactSDiv(LHSConstant: LLVMValueRef,
                              RHSConstant: LLVMValueRef)
                              -> LLVMValueRef;
    pub fn LLVMConstFDiv(LHSConstant: LLVMValueRef, RHSConstant: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMConstURem(LHSConstant: LLVMValueRef, RHSConstant: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMConstSRem(LHSConstant: LLVMValueRef, RHSConstant: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMConstFRem(LHSConstant: LLVMValueRef, RHSConstant: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMConstAnd(LHSConstant: LLVMValueRef, RHSConstant: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMConstOr(LHSConstant: LLVMValueRef, RHSConstant: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMConstXor(LHSConstant: LLVMValueRef, RHSConstant: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMConstICmp(Predicate: LLVMIntPredicate,
                         LHSConstant: LLVMValueRef,
                         RHSConstant: LLVMValueRef)
                         -> LLVMValueRef;
    pub fn LLVMConstFCmp(Predicate: LLVMRealPredicate,
                         LHSConstant: LLVMValueRef,
                         RHSConstant: LLVMValueRef)
                         -> LLVMValueRef;
    pub fn LLVMConstShl(LHSConstant: LLVMValueRef, RHSConstant: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMConstLShr(LHSConstant: LLVMValueRef, RHSConstant: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMConstAShr(LHSConstant: LLVMValueRef, RHSConstant: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMConstGEP(ConstantVal: LLVMValueRef,
                        ConstantIndices: *mut LLVMValueRef,
                        NumIndices: ::libc::c_uint)
                        -> LLVMValueRef;
    pub fn LLVMConstInBoundsGEP(ConstantVal: LLVMValueRef,
                                ConstantIndices: *mut LLVMValueRef,
                                NumIndices: ::libc::c_uint)
                                -> LLVMValueRef;
    pub fn LLVMConstTrunc(ConstantVal: LLVMValueRef, ToType: LLVMTypeRef) -> LLVMValueRef;
    pub fn LLVMConstSExt(ConstantVal: LLVMValueRef, ToType: LLVMTypeRef) -> LLVMValueRef;
    pub fn LLVMConstZExt(ConstantVal: LLVMValueRef, ToType: LLVMTypeRef) -> LLVMValueRef;
    pub fn LLVMConstFPTrunc(ConstantVal: LLVMValueRef, ToType: LLVMTypeRef) -> LLVMValueRef;
    pub fn LLVMConstFPExt(ConstantVal: LLVMValueRef, ToType: LLVMTypeRef) -> LLVMValueRef;
    pub fn LLVMConstUIToFP(ConstantVal: LLVMValueRef, ToType: LLVMTypeRef) -> LLVMValueRef;
    pub fn LLVMConstSIToFP(ConstantVal: LLVMValueRef, ToType: LLVMTypeRef) -> LLVMValueRef;
    pub fn LLVMConstFPToUI(ConstantVal: LLVMValueRef, ToType: LLVMTypeRef) -> LLVMValueRef;
    pub fn LLVMConstFPToSI(ConstantVal: LLVMValueRef, ToType: LLVMTypeRef) -> LLVMValueRef;
    pub fn LLVMConstPtrToInt(ConstantVal: LLVMValueRef, ToType: LLVMTypeRef) -> LLVMValueRef;
    pub fn LLVMConstIntToPtr(ConstantVal: LLVMValueRef, ToType: LLVMTypeRef) -> LLVMValueRef;
    pub fn LLVMConstBitCast(ConstantVal: LLVMValueRef, ToType: LLVMTypeRef) -> LLVMValueRef;
    pub fn LLVMConstAddrSpaceCast(ConstantVal: LLVMValueRef, ToType: LLVMTypeRef) -> LLVMValueRef;
    pub fn LLVMConstZExtOrBitCast(ConstantVal: LLVMValueRef, ToType: LLVMTypeRef) -> LLVMValueRef;
    pub fn LLVMConstSExtOrBitCast(ConstantVal: LLVMValueRef, ToType: LLVMTypeRef) -> LLVMValueRef;
    pub fn LLVMConstTruncOrBitCast(ConstantVal: LLVMValueRef, ToType: LLVMTypeRef) -> LLVMValueRef;
    pub fn LLVMConstPointerCast(ConstantVal: LLVMValueRef, ToType: LLVMTypeRef) -> LLVMValueRef;
    pub fn LLVMConstIntCast(ConstantVal: LLVMValueRef,
                            ToType: LLVMTypeRef,
                            isSigned: LLVMBool)
                            -> LLVMValueRef;
    pub fn LLVMConstFPCast(ConstantVal: LLVMValueRef, ToType: LLVMTypeRef) -> LLVMValueRef;
    pub fn LLVMConstSelect(ConstantCondition: LLVMValueRef,
                           ConstantIfTrue: LLVMValueRef,
                           ConstantIfFalse: LLVMValueRef)
                           -> LLVMValueRef;
    pub fn LLVMConstExtractElement(VectorConstant: LLVMValueRef,
                                   IndexConstant: LLVMValueRef)
                                   -> LLVMValueRef;
    pub fn LLVMConstInsertElement(VectorConstant: LLVMValueRef,
                                  ElementValueConstant: LLVMValueRef,
                                  IndexConstant: LLVMValueRef)
                                  -> LLVMValueRef;
    pub fn LLVMConstShuffleVector(VectorAConstant: LLVMValueRef,
                                  VectorBConstant: LLVMValueRef,
                                  MaskConstant: LLVMValueRef)
                                  -> LLVMValueRef;
    pub fn LLVMConstExtractValue(AggConstant: LLVMValueRef,
                                 IdxList: *mut ::libc::c_uint,
                                 NumIdx: ::libc::c_uint)
                                 -> LLVMValueRef;
    pub fn LLVMConstInsertValue(AggConstant: LLVMValueRef,
                                ElementValueConstant: LLVMValueRef,
                                IdxList: *mut ::libc::c_uint,
                                NumIdx: ::libc::c_uint)
                                -> LLVMValueRef;
    pub fn LLVMConstInlineAsm(Ty: LLVMTypeRef,
                              AsmString: *const ::libc::c_char,
                              Constraints: *const ::libc::c_char,
                              HasSideEffects: LLVMBool,
                              IsAlignStack: LLVMBool)
                              -> LLVMValueRef;
    pub fn LLVMBlockAddress(F: LLVMValueRef, BB: LLVMBasicBlockRef) -> LLVMValueRef;

    // Core->Values->Constants->Global Values
    pub fn LLVMGetGlobalParent(Global: LLVMValueRef) -> LLVMModuleRef;
    pub fn LLVMIsDeclaration(Global: LLVMValueRef) -> LLVMBool;
    pub fn LLVMGetLinkage(Global: LLVMValueRef) -> LLVMLinkage;
    pub fn LLVMSetLinkage(Global: LLVMValueRef, Linkage: LLVMLinkage);
    pub fn LLVMGetSection(Global: LLVMValueRef) -> *const ::libc::c_char;
    pub fn LLVMSetSection(Global: LLVMValueRef, Section: *const ::libc::c_char);
    pub fn LLVMGetVisibility(Global: LLVMValueRef) -> LLVMVisibility;
    pub fn LLVMSetVisibility(Global: LLVMValueRef, Viz: LLVMVisibility);
    pub fn LLVMGetDLLStorageClass(Global: LLVMValueRef) -> LLVMDLLStorageClass;
    pub fn LLVMSetDLLStorageClass(Global: LLVMValueRef, Class: LLVMDLLStorageClass);
    pub fn LLVMHasUnnamedAddr(Global: LLVMValueRef) -> LLVMBool;
    pub fn LLVMSetUnnamedAddr(Global: LLVMValueRef, HasUnnamedAddr: LLVMBool);
    pub fn LLVMGetAlignment(V: LLVMValueRef) -> ::libc::c_uint;
    pub fn LLVMSetAlignment(V: LLVMValueRef, Bytes: ::libc::c_uint);

    // Core->Values->Constants->Global Variables
    pub fn LLVMAddGlobal(M: LLVMModuleRef,
                         Ty: LLVMTypeRef,
                         Name: *const ::libc::c_char)
                         -> LLVMValueRef;
    pub fn LLVMAddGlobalInAddressSpace(M: LLVMModuleRef,
                                       Ty: LLVMTypeRef,
                                       Name: *const ::libc::c_char,
                                       AddressSpace: ::libc::c_uint)
                                       -> LLVMValueRef;
    pub fn LLVMGetNamedGlobal(M: LLVMModuleRef, Name: *const ::libc::c_char) -> LLVMValueRef;
    pub fn LLVMGetFirstGlobal(M: LLVMModuleRef) -> LLVMValueRef;
    pub fn LLVMGetLastGlobal(M: LLVMModuleRef) -> LLVMValueRef;
    pub fn LLVMGetNextGlobal(GlobalVar: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMGetPreviousGlobal(GlobalVar: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMDeleteGlobal(GlobalVar: LLVMValueRef);
    pub fn LLVMGetInitializer(GlobalVar: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMSetInitializer(GlobalVar: LLVMValueRef, ConstantVal: LLVMValueRef);
    pub fn LLVMIsThreadLocal(GlobalVar: LLVMValueRef) -> LLVMBool;
    pub fn LLVMSetThreadLocal(GlobalVar: LLVMValueRef, IsThreadLocal: LLVMBool);
    pub fn LLVMIsGlobalConstant(GlobalVar: LLVMValueRef) -> LLVMBool;
    pub fn LLVMSetGlobalConstant(GlobalVar: LLVMValueRef, IsConstant: LLVMBool);
    pub fn LLVMGetThreadLocalMode(GlobalVar: LLVMValueRef) -> LLVMThreadLocalMode;
    pub fn LLVMSetThreadLocalMode(GlobalVar: LLVMValueRef, Mode: LLVMThreadLocalMode);
    pub fn LLVMIsExternallyInitialized(GlobalVar: LLVMValueRef) -> LLVMBool;
    pub fn LLVMSetExternallyInitialized(GlobalVar: LLVMValueRef, IsExtInit: LLVMBool);

    // Core->Values->Constants->Global Aliases
    pub fn LLVMAddAlias(M: LLVMModuleRef,
                        Ty: LLVMTypeRef,
                        Aliasee: LLVMValueRef,
                        Name: *const ::libc::c_char)
                        -> LLVMValueRef;

    // ..->Function Values
    pub fn LLVMDeleteFunction(Fn: LLVMValueRef);
    /// Check whether the given function has a personality function.
    pub fn LLVMHasPersonalityFn(Fn: LLVMValueRef) -> LLVMBool;
    /// Obtain the personality function attached to the function.
    ///
    /// Added in LLVM 3.7.
    pub fn LLVMGetPersonalityFn(Fn: LLVMValueRef) -> LLVMValueRef;
    /// Set the personality function attached to the function.
    ///
    /// Added in LLVM 3.7.
    pub fn LLVMSetPersonalityFn(Fn: LLVMValueRef, PersonalityFn: LLVMValueRef);
    /// Obtain the ID number from a function instance.
    pub fn LLVMGetIntrinsicID(Fn: LLVMValueRef) -> ::libc::c_uint;
    pub fn LLVMGetFunctionCallConv(Fn: LLVMValueRef) -> ::libc::c_uint;
    pub fn LLVMSetFunctionCallConv(Fn: LLVMValueRef, CC: ::libc::c_uint);
    pub fn LLVMGetGC(Fn: LLVMValueRef) -> *const ::libc::c_char;
    pub fn LLVMSetGC(Fn: LLVMValueRef, Name: *const ::libc::c_char);
    pub fn LLVMAddAttributeAtIndex(F: LLVMValueRef, Idx: LLVMAttributeIndex, A: LLVMAttributeRef);
    pub fn LLVMGetAttributeCountAtIndex(F: LLVMValueRef,
                                        Idx: LLVMAttributeIndex)
                                        -> ::libc::c_uint;
    pub fn LLVMGetAttributesAtIndex(F: LLVMValueRef,
                                    Idx: LLVMAttributeIndex,
                                    Attrs: *mut LLVMAttributeRef);
    pub fn LLVMGetEnumAttributeAtIndex(F: LLVMValueRef,
                                       Idx: LLVMAttributeIndex,
                                       KindID: ::libc::c_uint)
                                       -> LLVMAttributeRef;
    pub fn LLVMGetStringAttributeAtIndex(F: LLVMValueRef,
                                         Idx: LLVMAttributeIndex,
                                         K: *const ::libc::c_char,
                                         KLen: ::libc::c_uint)
                                         -> LLVMAttributeRef;
    pub fn LLVMRemoveEnumAttributeAtIndex(F: LLVMValueRef,
                                          Idx: LLVMAttributeIndex,
                                          KindID: ::libc::c_uint);
    pub fn LLVMRemoveStringAttributeAtIndex(F: LLVMValueRef,
                                            Idx: LLVMAttributeIndex,
                                            K: *const ::libc::c_char,
                                            KLen: ::libc::c_uint);
    pub fn LLVMAddTargetDependentFunctionAttr(Fn: LLVMValueRef,
                                              A: *const ::libc::c_char,
                                              V: *const ::libc::c_char);

    // ..->Function Values->Function Parameters
    pub fn LLVMCountParams(Fn: LLVMValueRef) -> ::libc::c_uint;
    pub fn LLVMGetParams(Fn: LLVMValueRef, Params: *mut LLVMValueRef);
    pub fn LLVMGetParam(Fn: LLVMValueRef, Index: ::libc::c_uint) -> LLVMValueRef;
    pub fn LLVMGetParamParent(Inst: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMGetFirstParam(Fn: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMGetLastParam(Fn: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMGetNextParam(Arg: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMGetPreviousParam(Arg: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMSetParamAlignment(Arg: LLVMValueRef, Align: ::libc::c_uint);
}

// Core->Metadata
extern "C" {
    pub fn LLVMMDStringInContext(C: LLVMContextRef,
                                 Str: *const ::libc::c_char,
                                 SLen: ::libc::c_uint)
                                 -> LLVMValueRef;
    pub fn LLVMMDString(Str: *const ::libc::c_char, SLen: ::libc::c_uint) -> LLVMValueRef;
    pub fn LLVMMDNodeInContext(C: LLVMContextRef,
                               Vals: *mut LLVMValueRef,
                               Count: ::libc::c_uint)
                               -> LLVMValueRef;
    pub fn LLVMMDNode(Vals: *mut LLVMValueRef, Count: ::libc::c_uint) -> LLVMValueRef;
    /// Obtain the underlying string from a MDString value.
    ///
    /// `Len` is written to contain the length of the returned string.
    pub fn LLVMGetMDString(V: LLVMValueRef, Len: *mut ::libc::c_uint) -> *const ::libc::c_char;
    pub fn LLVMGetMDNodeNumOperands(V: LLVMValueRef) -> ::libc::c_uint;
    pub fn LLVMGetMDNodeOperands(V: LLVMValueRef, Dest: *mut LLVMValueRef);
}

// Core->Basic Block
extern "C" {
    pub fn LLVMBasicBlockAsValue(BB: LLVMBasicBlockRef) -> LLVMValueRef;
    pub fn LLVMValueIsBasicBlock(Val: LLVMValueRef) -> LLVMBool;
    pub fn LLVMValueAsBasicBlock(Val: LLVMValueRef) -> LLVMBasicBlockRef;
    /// Get the string name of a basic block.
    pub fn LLVMGetBasicBlockName(BB: LLVMBasicBlockRef) -> *const ::libc::c_char;
    pub fn LLVMGetBasicBlockParent(BB: LLVMBasicBlockRef) -> LLVMValueRef;
    pub fn LLVMGetBasicBlockTerminator(BB: LLVMBasicBlockRef) -> LLVMValueRef;
    pub fn LLVMCountBasicBlocks(Fn: LLVMValueRef) -> ::libc::c_uint;
    pub fn LLVMGetBasicBlocks(Fn: LLVMValueRef, BasicBlocks: *mut LLVMBasicBlockRef);
    pub fn LLVMGetFirstBasicBlock(Fn: LLVMValueRef) -> LLVMBasicBlockRef;
    pub fn LLVMGetLastBasicBlock(Fn: LLVMValueRef) -> LLVMBasicBlockRef;
    pub fn LLVMGetNextBasicBlock(BB: LLVMBasicBlockRef) -> LLVMBasicBlockRef;
    pub fn LLVMGetPreviousBasicBlock(BB: LLVMBasicBlockRef) -> LLVMBasicBlockRef;
    pub fn LLVMGetEntryBasicBlock(Fn: LLVMValueRef) -> LLVMBasicBlockRef;
    pub fn LLVMAppendBasicBlockInContext(C: LLVMContextRef,
                                         Fn: LLVMValueRef,
                                         Name: *const ::libc::c_char)
                                         -> LLVMBasicBlockRef;
    pub fn LLVMAppendBasicBlock(Fn: LLVMValueRef,
                                Name: *const ::libc::c_char)
                                -> LLVMBasicBlockRef;
    pub fn LLVMInsertBasicBlockInContext(C: LLVMContextRef,
                                         BB: LLVMBasicBlockRef,
                                         Name: *const ::libc::c_char)
                                         -> LLVMBasicBlockRef;
    pub fn LLVMInsertBasicBlock(InsertBeforeBB: LLVMBasicBlockRef,
                                Name: *const ::libc::c_char)
                                -> LLVMBasicBlockRef;
    pub fn LLVMDeleteBasicBlock(BB: LLVMBasicBlockRef);
    pub fn LLVMRemoveBasicBlockFromParent(BB: LLVMBasicBlockRef);
    pub fn LLVMMoveBasicBlockBefore(BB: LLVMBasicBlockRef, MovePos: LLVMBasicBlockRef);
    pub fn LLVMMoveBasicBlockAfter(BB: LLVMBasicBlockRef, MovePos: LLVMBasicBlockRef);
    pub fn LLVMGetFirstInstruction(BB: LLVMBasicBlockRef) -> LLVMValueRef;
    pub fn LLVMGetLastInstruction(BB: LLVMBasicBlockRef) -> LLVMValueRef;
}

// Core->Instructions
extern "C" {
    pub fn LLVMHasMetadata(Val: LLVMValueRef) -> ::libc::c_int;
    pub fn LLVMGetMetadata(Val: LLVMValueRef, KindID: ::libc::c_uint) -> LLVMValueRef;
    pub fn LLVMSetMetadata(Val: LLVMValueRef, KindID: ::libc::c_uint, Node: LLVMValueRef);
    pub fn LLVMGetInstructionParent(Inst: LLVMValueRef) -> LLVMBasicBlockRef;
    pub fn LLVMGetNextInstruction(Inst: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMGetPreviousInstruction(Inst: LLVMValueRef) -> LLVMValueRef;
    /// Remove the given instruction from its containing building block but
    /// kept alive.
    pub fn LLVMInstructionRemoveFromParent(Inst: LLVMValueRef);
    /// Remove the given instruction from its containing building block and
    /// delete it.
    pub fn LLVMInstructionEraseFromParent(Inst: LLVMValueRef);
    pub fn LLVMGetInstructionOpcode(Inst: LLVMValueRef) -> LLVMOpcode;
    pub fn LLVMGetICmpPredicate(Inst: LLVMValueRef) -> LLVMIntPredicate;
    pub fn LLVMGetFCmpPredicate(Inst: LLVMValueRef) -> LLVMRealPredicate;
    pub fn LLVMInstructionClone(Inst: LLVMValueRef) -> LLVMValueRef;

    // Instructions->Call Sites and Invocations
    // Obtain the argument count for a call instruction.
    //
    // The provided value should be either a CallInst or InvokeInst.
    pub fn LLVMGetNumArgOperands(Instr: LLVMValueRef) -> ::libc::c_uint;
    pub fn LLVMSetInstructionCallConv(Instr: LLVMValueRef, CC: ::libc::c_uint);
    pub fn LLVMGetInstructionCallConv(Instr: LLVMValueRef) -> ::libc::c_uint;
    pub fn LLVMSetInstrParamAlignment(Instr: LLVMValueRef,
                                      index: ::libc::c_uint,
                                      Align: ::libc::c_uint);
    pub fn LLVMAddCallSiteAttribute(C: LLVMValueRef,
                                    Idx: LLVMAttributeIndex,
                                    A: LLVMAttributeRef);
    pub fn LLVMGetCallSiteAttributeCount(C: LLVMValueRef,
                                         Idx: LLVMAttributeIndex)
                                         -> ::libc::c_uint;
    pub fn LLVMGetCallSiteAttributes(C: LLVMValueRef,
                                     Idx: LLVMAttributeIndex,
                                     Attrs: *mut LLVMAttributeRef);
    pub fn LLVMGetCallSiteEnumAttribute(C: LLVMValueRef,
                                        Idx: LLVMAttributeIndex,
                                        KindID: ::libc::c_uint)
                                        -> LLVMAttributeRef;
    pub fn LLVMGetCallSiteStringAttribute(C: LLVMValueRef,
                                          Idx: LLVMAttributeIndex,
                                          K: *const ::libc::c_char,
                                          KLen: ::libc::c_uint)
                                          -> LLVMAttributeRef;
    pub fn LLVMRemoveCallSiteEnumAttribute(C: LLVMValueRef,
                                           Idx: LLVMAttributeIndex,
                                           KindID: ::libc::c_uint);
    pub fn LLVMRemoveCallSiteStringAttribute(C: LLVMValueRef,
                                             Idx: LLVMAttributeIndex,
                                             K: *const ::libc::c_char,
                                             KLen: ::libc::c_uint);
    /// Get a pointer to the function invoked by this instruction.
    ///
    /// The provided value should be a CallInst or InvokeInst.
    pub fn LLVMGetCalledValue(Instr: LLVMValueRef) -> LLVMValueRef;
    /// Get whether a call instruction is a tail call.
    pub fn LLVMIsTailCall(CallInst: LLVMValueRef) -> LLVMBool;
    pub fn LLVMSetTailCall(CallInst: LLVMValueRef, IsTailCall: LLVMBool);
    /// Return the normal destination basic block of an invoke instruction.
    pub fn LLVMGetNormalDest(InvokeInst: LLVMValueRef) -> LLVMBasicBlockRef;
    /// Return the unwind destination basic block of an invoke instruction.
    pub fn LLVMGetUnwindDest(InvokeInst: LLVMValueRef) -> LLVMBasicBlockRef;
    /// Set the normal destination basic block of an invoke instruction.
    pub fn LLVMSetNormalDest(InvokeInst: LLVMValueRef, B: LLVMBasicBlockRef);
    /// Set the unwind destination basic block of an invoke instruction.
    pub fn LLVMSetUnwindDest(InvokeInst: LLVMValueRef, B: LLVMBasicBlockRef);

    // Instructions->Terminators
    pub fn LLVMGetNumSuccessors(Term: LLVMValueRef) -> ::libc::c_uint;
    pub fn LLVMGetSuccessor(Term: LLVMValueRef, i: ::libc::c_uint) -> LLVMBasicBlockRef;
    pub fn LLVMSetSuccessor(Term: LLVMValueRef, i: ::libc::c_uint, block: LLVMBasicBlockRef);
    pub fn LLVMIsConditional(Branch: LLVMValueRef) -> LLVMBool;
    pub fn LLVMGetCondition(Branch: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMSetCondition(Branch: LLVMValueRef, Cond: LLVMValueRef);
    pub fn LLVMGetSwitchDefaultDest(SwitchInstr: LLVMValueRef) -> LLVMBasicBlockRef;

    // Instructions->Allocas
    // Obtain the type being allocated by an alloca instruction.
    pub fn LLVMGetAllocatedType(Alloca: LLVMValueRef) -> LLVMTypeRef;

    // Instructions->GEPs
    // Check whether the given GEP instruction is inbounds.
    pub fn LLVMIsInBounds(GEP: LLVMValueRef) -> LLVMBool;
    /// Set the given GEP instruction to be inbounds or not.
    pub fn LLVMSetIsInBounds(GEP: LLVMValueRef, InBounds: LLVMBool);

    // Instruction->PHI Nodes
    pub fn LLVMAddIncoming(PhiNode: LLVMValueRef,
                           IncomingValues: *mut LLVMValueRef,
                           IncomingBlocks: *mut LLVMBasicBlockRef,
                           Count: ::libc::c_uint);
    pub fn LLVMCountIncoming(PhiNode: LLVMValueRef) -> ::libc::c_uint;
    pub fn LLVMGetIncomingValue(PhiNode: LLVMValueRef, Index: ::libc::c_uint) -> LLVMValueRef;
    pub fn LLVMGetIncomingBlock(PhiNode: LLVMValueRef, Index: ::libc::c_uint) -> LLVMBasicBlockRef;

}

// Core->Values again; these don't appear in Doxygen because they're macro-generated.
extern "C" {
    pub fn LLVMIsAArgument(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsABasicBlock(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAInlineAsm(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAUser(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAConstant(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsABlockAddress(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAConstantAggregateZero(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAConstantArray(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAConstantDataSequential(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAConstantDataArray(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAConstantDataVector(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAConstantExpr(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAConstantFP(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAConstantInt(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAConstantPointerNull(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAConstantStruct(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAConstantTokenNone(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAConstantVector(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAGlobalValue(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAGlobalAlias(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAGlobalObject(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAFunction(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAGlobalVariable(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAUndefValue(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAInstruction(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsABinaryOperator(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsACallInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAIntrinsicInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsADbgInfoIntrinsic(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsADbgDeclareInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAMemIntrinsic(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAMemCpyInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAMemMoveInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAMemSetInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsACmpInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAFCmpInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAICmpInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAExtractElementInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAGetElementPtrInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAInsertElementInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAInsertValueInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsALandingPadInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAPHINode(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsASelectInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAShuffleVectorInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAStoreInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsATerminatorInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsABranchInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAIndirectBrInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAInvokeInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAReturnInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsASwitchInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAUnreachableInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAResumeInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsACleanupReturnInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsACatchReturnInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAFuncletPadInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsACatchPadInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsACleanupPadInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAUnaryInstruction(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAAllocaInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsACastInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAAddrSpaceCastInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsABitCastInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAFPExtInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAFPToSIInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAFPToUIInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAFPTruncInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAIntToPtrInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAPtrToIntInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsASExtInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsASIToFPInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsATruncInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAUIToFPInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAZExtInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAExtractValueInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsALoadInst(Val: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMIsAVAArgInst(Val: LLVMValueRef) -> LLVMValueRef;
}

// Core->Extract/Insert Value
extern "C" {
    /// Get the number of indices on an ExtractValue, InsertValue or GEP instruction.
    pub fn LLVMGetNumIndices(Inst: LLVMValueRef) -> ::libc::c_uint;
    pub fn LLVMGetIndices(Inst: LLVMValueRef) -> *const ::libc::c_uint;
}

// Core->Instruction Builders
extern "C" {
    pub fn LLVMCreateBuilderInContext(C: LLVMContextRef) -> LLVMBuilderRef;
    pub fn LLVMCreateBuilder() -> LLVMBuilderRef;
    pub fn LLVMPositionBuilder(Builder: LLVMBuilderRef,
                               Block: LLVMBasicBlockRef,
                               Instr: LLVMValueRef);
    pub fn LLVMPositionBuilderBefore(Builder: LLVMBuilderRef, Instr: LLVMValueRef);
    pub fn LLVMPositionBuilderAtEnd(Builder: LLVMBuilderRef, Block: LLVMBasicBlockRef);
    pub fn LLVMGetInsertBlock(Builder: LLVMBuilderRef) -> LLVMBasicBlockRef;
    pub fn LLVMClearInsertionPosition(Builder: LLVMBuilderRef);
    pub fn LLVMInsertIntoBuilder(Builder: LLVMBuilderRef, Instr: LLVMValueRef);
    pub fn LLVMInsertIntoBuilderWithName(Builder: LLVMBuilderRef,
                                         Instr: LLVMValueRef,
                                         Name: *const ::libc::c_char);
    pub fn LLVMDisposeBuilder(Builder: LLVMBuilderRef);

    // Metadata
    pub fn LLVMSetCurrentDebugLocation(Builder: LLVMBuilderRef, L: LLVMValueRef);
    pub fn LLVMGetCurrentDebugLocation(Builder: LLVMBuilderRef) -> LLVMValueRef;
    pub fn LLVMSetInstDebugLocation(Builder: LLVMBuilderRef, Inst: LLVMValueRef);

    // Terminators
    pub fn LLVMBuildRetVoid(arg1: LLVMBuilderRef) -> LLVMValueRef;
    pub fn LLVMBuildRet(arg1: LLVMBuilderRef, V: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMBuildAggregateRet(arg1: LLVMBuilderRef,
                                 RetVals: *mut LLVMValueRef,
                                 N: ::libc::c_uint)
                                 -> LLVMValueRef;
    pub fn LLVMBuildBr(arg1: LLVMBuilderRef, Dest: LLVMBasicBlockRef) -> LLVMValueRef;
    pub fn LLVMBuildCondBr(arg1: LLVMBuilderRef,
                           If: LLVMValueRef,
                           Then: LLVMBasicBlockRef,
                           Else: LLVMBasicBlockRef)
                           -> LLVMValueRef;
    pub fn LLVMBuildSwitch(arg1: LLVMBuilderRef,
                           V: LLVMValueRef,
                           Else: LLVMBasicBlockRef,
                           NumCases: ::libc::c_uint)
                           -> LLVMValueRef;
    pub fn LLVMBuildIndirectBr(B: LLVMBuilderRef,
                               Addr: LLVMValueRef,
                               NumDests: ::libc::c_uint)
                               -> LLVMValueRef;
    pub fn LLVMBuildInvoke(arg1: LLVMBuilderRef,
                           Fn: LLVMValueRef,
                           Args: *mut LLVMValueRef,
                           NumArgs: ::libc::c_uint,
                           Then: LLVMBasicBlockRef,
                           Catch: LLVMBasicBlockRef,
                           Name: *const ::libc::c_char)
                           -> LLVMValueRef;
    pub fn LLVMBuildLandingPad(B: LLVMBuilderRef,
                               Ty: LLVMTypeRef,
                               PersFn: LLVMValueRef,
                               NumClauses: ::libc::c_uint,
                               Name: *const ::libc::c_char)
                               -> LLVMValueRef;
    pub fn LLVMBuildResume(B: LLVMBuilderRef, Exn: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMBuildUnreachable(arg1: LLVMBuilderRef) -> LLVMValueRef;

    /// Add a case to a `switch` instruction
    pub fn LLVMAddCase(Switch: LLVMValueRef, OnVal: LLVMValueRef, Dest: LLVMBasicBlockRef);

    /// Add a destination to an `indirectbr` instruction
    pub fn LLVMAddDestination(IndirectBr: LLVMValueRef, Dest: LLVMBasicBlockRef);

    /// Get the number of clauses on a landingpad instruction.
    pub fn LLVMGetNumClauses(LandingPad: LLVMValueRef) -> ::libc::c_uint;

    /// Get the value of the clause with the given index on a landingpad instruction.
    pub fn LLVMGetClause(LandingPad: LLVMValueRef, Idx: ::libc::c_uint) -> LLVMValueRef;

    /// Add a catch or filter clause to a `landingpad` instruction
    pub fn LLVMAddClause(LandingPad: LLVMValueRef, ClauseVal: LLVMValueRef);

    /// Get the cleanup flag in a landingpad instruction.
    pub fn LLVMIsCleanup(LandingPad: LLVMValueRef) -> LLVMBool;

    /// Set the cleanup flag in a `landingpad` instruction.
    pub fn LLVMSetCleanup(LandingPad: LLVMValueRef, Val: LLVMBool);

    // Arithmetic
    pub fn LLVMBuildAdd(arg1: LLVMBuilderRef,
                        LHS: LLVMValueRef,
                        RHS: LLVMValueRef,
                        Name: *const ::libc::c_char)
                        -> LLVMValueRef;
    pub fn LLVMBuildNSWAdd(arg1: LLVMBuilderRef,
                           LHS: LLVMValueRef,
                           RHS: LLVMValueRef,
                           Name: *const ::libc::c_char)
                           -> LLVMValueRef;
    pub fn LLVMBuildNUWAdd(arg1: LLVMBuilderRef,
                           LHS: LLVMValueRef,
                           RHS: LLVMValueRef,
                           Name: *const ::libc::c_char)
                           -> LLVMValueRef;
    pub fn LLVMBuildFAdd(arg1: LLVMBuilderRef,
                         LHS: LLVMValueRef,
                         RHS: LLVMValueRef,
                         Name: *const ::libc::c_char)
                         -> LLVMValueRef;
    pub fn LLVMBuildSub(arg1: LLVMBuilderRef,
                        LHS: LLVMValueRef,
                        RHS: LLVMValueRef,
                        Name: *const ::libc::c_char)
                        -> LLVMValueRef;
    pub fn LLVMBuildNSWSub(arg1: LLVMBuilderRef,
                           LHS: LLVMValueRef,
                           RHS: LLVMValueRef,
                           Name: *const ::libc::c_char)
                           -> LLVMValueRef;
    pub fn LLVMBuildNUWSub(arg1: LLVMBuilderRef,
                           LHS: LLVMValueRef,
                           RHS: LLVMValueRef,
                           Name: *const ::libc::c_char)
                           -> LLVMValueRef;
    pub fn LLVMBuildFSub(arg1: LLVMBuilderRef,
                         LHS: LLVMValueRef,
                         RHS: LLVMValueRef,
                         Name: *const ::libc::c_char)
                         -> LLVMValueRef;
    pub fn LLVMBuildMul(arg1: LLVMBuilderRef,
                        LHS: LLVMValueRef,
                        RHS: LLVMValueRef,
                        Name: *const ::libc::c_char)
                        -> LLVMValueRef;
    pub fn LLVMBuildNSWMul(arg1: LLVMBuilderRef,
                           LHS: LLVMValueRef,
                           RHS: LLVMValueRef,
                           Name: *const ::libc::c_char)
                           -> LLVMValueRef;
    pub fn LLVMBuildNUWMul(arg1: LLVMBuilderRef,
                           LHS: LLVMValueRef,
                           RHS: LLVMValueRef,
                           Name: *const ::libc::c_char)
                           -> LLVMValueRef;
    pub fn LLVMBuildFMul(arg1: LLVMBuilderRef,
                         LHS: LLVMValueRef,
                         RHS: LLVMValueRef,
                         Name: *const ::libc::c_char)
                         -> LLVMValueRef;
    pub fn LLVMBuildUDiv(arg1: LLVMBuilderRef,
                         LHS: LLVMValueRef,
                         RHS: LLVMValueRef,
                         Name: *const ::libc::c_char)
                         -> LLVMValueRef;
    pub fn LLVMBuildExactUDiv(arg1: LLVMBuilderRef,
                              LHS: LLVMValueRef,
                              RHS: LLVMValueRef,
                              Name: *const ::libc::c_char)
                              -> LLVMValueRef;
    pub fn LLVMBuildSDiv(arg1: LLVMBuilderRef,
                         LHS: LLVMValueRef,
                         RHS: LLVMValueRef,
                         Name: *const ::libc::c_char)
                         -> LLVMValueRef;
    pub fn LLVMBuildExactSDiv(arg1: LLVMBuilderRef,
                              LHS: LLVMValueRef,
                              RHS: LLVMValueRef,
                              Name: *const ::libc::c_char)
                              -> LLVMValueRef;
    pub fn LLVMBuildFDiv(arg1: LLVMBuilderRef,
                         LHS: LLVMValueRef,
                         RHS: LLVMValueRef,
                         Name: *const ::libc::c_char)
                         -> LLVMValueRef;
    pub fn LLVMBuildURem(arg1: LLVMBuilderRef,
                         LHS: LLVMValueRef,
                         RHS: LLVMValueRef,
                         Name: *const ::libc::c_char)
                         -> LLVMValueRef;
    pub fn LLVMBuildSRem(arg1: LLVMBuilderRef,
                         LHS: LLVMValueRef,
                         RHS: LLVMValueRef,
                         Name: *const ::libc::c_char)
                         -> LLVMValueRef;
    pub fn LLVMBuildFRem(arg1: LLVMBuilderRef,
                         LHS: LLVMValueRef,
                         RHS: LLVMValueRef,
                         Name: *const ::libc::c_char)
                         -> LLVMValueRef;
    pub fn LLVMBuildShl(arg1: LLVMBuilderRef,
                        LHS: LLVMValueRef,
                        RHS: LLVMValueRef,
                        Name: *const ::libc::c_char)
                        -> LLVMValueRef;
    pub fn LLVMBuildLShr(arg1: LLVMBuilderRef,
                         LHS: LLVMValueRef,
                         RHS: LLVMValueRef,
                         Name: *const ::libc::c_char)
                         -> LLVMValueRef;
    pub fn LLVMBuildAShr(arg1: LLVMBuilderRef,
                         LHS: LLVMValueRef,
                         RHS: LLVMValueRef,
                         Name: *const ::libc::c_char)
                         -> LLVMValueRef;
    pub fn LLVMBuildAnd(arg1: LLVMBuilderRef,
                        LHS: LLVMValueRef,
                        RHS: LLVMValueRef,
                        Name: *const ::libc::c_char)
                        -> LLVMValueRef;
    pub fn LLVMBuildOr(arg1: LLVMBuilderRef,
                       LHS: LLVMValueRef,
                       RHS: LLVMValueRef,
                       Name: *const ::libc::c_char)
                       -> LLVMValueRef;
    pub fn LLVMBuildXor(arg1: LLVMBuilderRef,
                        LHS: LLVMValueRef,
                        RHS: LLVMValueRef,
                        Name: *const ::libc::c_char)
                        -> LLVMValueRef;
    pub fn LLVMBuildBinOp(B: LLVMBuilderRef,
                          Op: LLVMOpcode,
                          LHS: LLVMValueRef,
                          RHS: LLVMValueRef,
                          Name: *const ::libc::c_char)
                          -> LLVMValueRef;
    pub fn LLVMBuildNeg(arg1: LLVMBuilderRef,
                        V: LLVMValueRef,
                        Name: *const ::libc::c_char)
                        -> LLVMValueRef;
    pub fn LLVMBuildNSWNeg(B: LLVMBuilderRef,
                           V: LLVMValueRef,
                           Name: *const ::libc::c_char)
                           -> LLVMValueRef;
    pub fn LLVMBuildNUWNeg(B: LLVMBuilderRef,
                           V: LLVMValueRef,
                           Name: *const ::libc::c_char)
                           -> LLVMValueRef;
    pub fn LLVMBuildFNeg(arg1: LLVMBuilderRef,
                         V: LLVMValueRef,
                         Name: *const ::libc::c_char)
                         -> LLVMValueRef;
    pub fn LLVMBuildNot(arg1: LLVMBuilderRef,
                        V: LLVMValueRef,
                        Name: *const ::libc::c_char)
                        -> LLVMValueRef;

    // Memory
    pub fn LLVMBuildMalloc(arg1: LLVMBuilderRef,
                           Ty: LLVMTypeRef,
                           Name: *const ::libc::c_char)
                           -> LLVMValueRef;
    pub fn LLVMBuildArrayMalloc(arg1: LLVMBuilderRef,
                                Ty: LLVMTypeRef,
                                Val: LLVMValueRef,
                                Name: *const ::libc::c_char)
                                -> LLVMValueRef;
    pub fn LLVMBuildAlloca(arg1: LLVMBuilderRef,
                           Ty: LLVMTypeRef,
                           Name: *const ::libc::c_char)
                           -> LLVMValueRef;
    pub fn LLVMBuildArrayAlloca(arg1: LLVMBuilderRef,
                                Ty: LLVMTypeRef,
                                Val: LLVMValueRef,
                                Name: *const ::libc::c_char)
                                -> LLVMValueRef;
    pub fn LLVMBuildFree(arg1: LLVMBuilderRef, PointerVal: LLVMValueRef) -> LLVMValueRef;
    pub fn LLVMBuildLoad(arg1: LLVMBuilderRef,
                         PointerVal: LLVMValueRef,
                         Name: *const ::libc::c_char)
                         -> LLVMValueRef;
    pub fn LLVMBuildStore(arg1: LLVMBuilderRef,
                          Val: LLVMValueRef,
                          Ptr: LLVMValueRef)
                          -> LLVMValueRef;
    pub fn LLVMBuildGEP(B: LLVMBuilderRef,
                        Pointer: LLVMValueRef,
                        Indices: *mut LLVMValueRef,
                        NumIndices: ::libc::c_uint,
                        Name: *const ::libc::c_char)
                        -> LLVMValueRef;
    pub fn LLVMBuildInBoundsGEP(B: LLVMBuilderRef,
                                Pointer: LLVMValueRef,
                                Indices: *mut LLVMValueRef,
                                NumIndices: ::libc::c_uint,
                                Name: *const ::libc::c_char)
                                -> LLVMValueRef;
    pub fn LLVMBuildStructGEP(B: LLVMBuilderRef,
                              Pointer: LLVMValueRef,
                              Idx: ::libc::c_uint,
                              Name: *const ::libc::c_char)
                              -> LLVMValueRef;
    pub fn LLVMBuildGlobalString(B: LLVMBuilderRef,
                                 Str: *const ::libc::c_char,
                                 Name: *const ::libc::c_char)
                                 -> LLVMValueRef;
    pub fn LLVMBuildGlobalStringPtr(B: LLVMBuilderRef,
                                    Str: *const ::libc::c_char,
                                    Name: *const ::libc::c_char)
                                    -> LLVMValueRef;
    pub fn LLVMGetVolatile(MemoryAccessInst: LLVMValueRef) -> LLVMBool;
    pub fn LLVMSetVolatile(MemoryAccessInst: LLVMValueRef, IsVolatile: LLVMBool);
    pub fn LLVMGetOrdering(MemoryAccessInst: LLVMValueRef) -> LLVMAtomicOrdering;
    pub fn LLVMSetOrdering(MemoryAccessInst: LLVMValueRef, Ordering: LLVMAtomicOrdering);

    // Casts
    pub fn LLVMBuildTrunc(arg1: LLVMBuilderRef,
                          Val: LLVMValueRef,
                          DestTy: LLVMTypeRef,
                          Name: *const ::libc::c_char)
                          -> LLVMValueRef;
    pub fn LLVMBuildZExt(arg1: LLVMBuilderRef,
                         Val: LLVMValueRef,
                         DestTy: LLVMTypeRef,
                         Name: *const ::libc::c_char)
                         -> LLVMValueRef;
    pub fn LLVMBuildSExt(arg1: LLVMBuilderRef,
                         Val: LLVMValueRef,
                         DestTy: LLVMTypeRef,
                         Name: *const ::libc::c_char)
                         -> LLVMValueRef;
    pub fn LLVMBuildFPToUI(arg1: LLVMBuilderRef,
                           Val: LLVMValueRef,
                           DestTy: LLVMTypeRef,
                           Name: *const ::libc::c_char)
                           -> LLVMValueRef;
    pub fn LLVMBuildFPToSI(arg1: LLVMBuilderRef,
                           Val: LLVMValueRef,
                           DestTy: LLVMTypeRef,
                           Name: *const ::libc::c_char)
                           -> LLVMValueRef;
    pub fn LLVMBuildUIToFP(arg1: LLVMBuilderRef,
                           Val: LLVMValueRef,
                           DestTy: LLVMTypeRef,
                           Name: *const ::libc::c_char)
                           -> LLVMValueRef;
    pub fn LLVMBuildSIToFP(arg1: LLVMBuilderRef,
                           Val: LLVMValueRef,
                           DestTy: LLVMTypeRef,
                           Name: *const ::libc::c_char)
                           -> LLVMValueRef;
    pub fn LLVMBuildFPTrunc(arg1: LLVMBuilderRef,
                            Val: LLVMValueRef,
                            DestTy: LLVMTypeRef,
                            Name: *const ::libc::c_char)
                            -> LLVMValueRef;
    pub fn LLVMBuildFPExt(arg1: LLVMBuilderRef,
                          Val: LLVMValueRef,
                          DestTy: LLVMTypeRef,
                          Name: *const ::libc::c_char)
                          -> LLVMValueRef;
    pub fn LLVMBuildPtrToInt(arg1: LLVMBuilderRef,
                             Val: LLVMValueRef,
                             DestTy: LLVMTypeRef,
                             Name: *const ::libc::c_char)
                             -> LLVMValueRef;
    pub fn LLVMBuildIntToPtr(arg1: LLVMBuilderRef,
                             Val: LLVMValueRef,
                             DestTy: LLVMTypeRef,
                             Name: *const ::libc::c_char)
                             -> LLVMValueRef;
    pub fn LLVMBuildBitCast(arg1: LLVMBuilderRef,
                            Val: LLVMValueRef,
                            DestTy: LLVMTypeRef,
                            Name: *const ::libc::c_char)
                            -> LLVMValueRef;
    pub fn LLVMBuildAddrSpaceCast(arg1: LLVMBuilderRef,
                                  Val: LLVMValueRef,
                                  DestTy: LLVMTypeRef,
                                  Name: *const ::libc::c_char)
                                  -> LLVMValueRef;
    pub fn LLVMBuildZExtOrBitCast(arg1: LLVMBuilderRef,
                                  Val: LLVMValueRef,
                                  DestTy: LLVMTypeRef,
                                  Name: *const ::libc::c_char)
                                  -> LLVMValueRef;
    pub fn LLVMBuildSExtOrBitCast(arg1: LLVMBuilderRef,
                                  Val: LLVMValueRef,
                                  DestTy: LLVMTypeRef,
                                  Name: *const ::libc::c_char)
                                  -> LLVMValueRef;
    pub fn LLVMBuildTruncOrBitCast(arg1: LLVMBuilderRef,
                                   Val: LLVMValueRef,
                                   DestTy: LLVMTypeRef,
                                   Name: *const ::libc::c_char)
                                   -> LLVMValueRef;
    pub fn LLVMBuildCast(B: LLVMBuilderRef,
                         Op: LLVMOpcode,
                         Val: LLVMValueRef,
                         DestTy: LLVMTypeRef,
                         Name: *const ::libc::c_char)
                         -> LLVMValueRef;
    pub fn LLVMBuildPointerCast(arg1: LLVMBuilderRef,
                                Val: LLVMValueRef,
                                DestTy: LLVMTypeRef,
                                Name: *const ::libc::c_char)
                                -> LLVMValueRef;
    pub fn LLVMBuildIntCast(arg1: LLVMBuilderRef,
                            Val: LLVMValueRef,
                            DestTy: LLVMTypeRef,
                            Name: *const ::libc::c_char)
                            -> LLVMValueRef;
    pub fn LLVMBuildFPCast(arg1: LLVMBuilderRef,
                           Val: LLVMValueRef,
                           DestTy: LLVMTypeRef,
                           Name: *const ::libc::c_char)
                           -> LLVMValueRef;

    // Comparisons
    pub fn LLVMBuildICmp(arg1: LLVMBuilderRef,
                         Op: LLVMIntPredicate,
                         LHS: LLVMValueRef,
                         RHS: LLVMValueRef,
                         Name: *const ::libc::c_char)
                         -> LLVMValueRef;
    pub fn LLVMBuildFCmp(arg1: LLVMBuilderRef,
                         Op: LLVMRealPredicate,
                         LHS: LLVMValueRef,
                         RHS: LLVMValueRef,
                         Name: *const ::libc::c_char)
                         -> LLVMValueRef;

    // Miscellaneous instructions
    pub fn LLVMBuildPhi(arg1: LLVMBuilderRef,
                        Ty: LLVMTypeRef,
                        Name: *const ::libc::c_char)
                        -> LLVMValueRef;
    pub fn LLVMBuildCall(arg1: LLVMBuilderRef,
                         Fn: LLVMValueRef,
                         Args: *mut LLVMValueRef,
                         NumArgs: ::libc::c_uint,
                         Name: *const ::libc::c_char)
                         -> LLVMValueRef;
    pub fn LLVMBuildSelect(arg1: LLVMBuilderRef,
                           If: LLVMValueRef,
                           Then: LLVMValueRef,
                           Else: LLVMValueRef,
                           Name: *const ::libc::c_char)
                           -> LLVMValueRef;
    pub fn LLVMBuildVAArg(arg1: LLVMBuilderRef,
                          List: LLVMValueRef,
                          Ty: LLVMTypeRef,
                          Name: *const ::libc::c_char)
                          -> LLVMValueRef;
    pub fn LLVMBuildExtractElement(arg1: LLVMBuilderRef,
                                   VecVal: LLVMValueRef,
                                   Index: LLVMValueRef,
                                   Name: *const ::libc::c_char)
                                   -> LLVMValueRef;
    pub fn LLVMBuildInsertElement(arg1: LLVMBuilderRef,
                                  VecVal: LLVMValueRef,
                                  EltVal: LLVMValueRef,
                                  Index: LLVMValueRef,
                                  Name: *const ::libc::c_char)
                                  -> LLVMValueRef;
    pub fn LLVMBuildShuffleVector(arg1: LLVMBuilderRef,
                                  V1: LLVMValueRef,
                                  V2: LLVMValueRef,
                                  Mask: LLVMValueRef,
                                  Name: *const ::libc::c_char)
                                  -> LLVMValueRef;
    pub fn LLVMBuildExtractValue(arg1: LLVMBuilderRef,
                                 AggVal: LLVMValueRef,
                                 Index: ::libc::c_uint,
                                 Name: *const ::libc::c_char)
                                 -> LLVMValueRef;
    pub fn LLVMBuildInsertValue(arg1: LLVMBuilderRef,
                                AggVal: LLVMValueRef,
                                EltVal: LLVMValueRef,
                                Index: ::libc::c_uint,
                                Name: *const ::libc::c_char)
                                -> LLVMValueRef;
    pub fn LLVMBuildIsNull(arg1: LLVMBuilderRef,
                           Val: LLVMValueRef,
                           Name: *const ::libc::c_char)
                           -> LLVMValueRef;
    pub fn LLVMBuildIsNotNull(arg1: LLVMBuilderRef,
                              Val: LLVMValueRef,
                              Name: *const ::libc::c_char)
                              -> LLVMValueRef;
    pub fn LLVMBuildPtrDiff(arg1: LLVMBuilderRef,
                            LHS: LLVMValueRef,
                            RHS: LLVMValueRef,
                            Name: *const ::libc::c_char)
                            -> LLVMValueRef;
    pub fn LLVMBuildFence(B: LLVMBuilderRef,
                          ordering: LLVMAtomicOrdering,
                          singleThread: LLVMBool,
                          Name: *const ::libc::c_char)
                          -> LLVMValueRef;
    pub fn LLVMBuildAtomicRMW(B: LLVMBuilderRef,
                              op: LLVMAtomicRMWBinOp,
                              PTR: LLVMValueRef,
                              Val: LLVMValueRef,
                              ordering: LLVMAtomicOrdering,
                              singleThread: LLVMBool)
                              -> LLVMValueRef;
    pub fn LLVMBuildAtomicCmpXchg(B: LLVMBuilderRef,
                                  Ptr: LLVMValueRef,
                                  Cmp: LLVMValueRef,
                                  New: LLVMValueRef,
                                  SuccessOrdering: LLVMAtomicOrdering,
                                  FailureOrdering: LLVMAtomicOrdering,
                                  SingleThread: LLVMBool)
                                  -> LLVMValueRef;
    pub fn LLVMIsAtomicSinglethread(AtomicInst: LLVMValueRef) -> LLVMBool;
    pub fn LLVMSetAtomicSingleThread(AtomicInst: LLVMValueRef, SingleThread: LLVMBool);
    pub fn LLVMGetCmpXchgSuccessOrdering(CmpXchgInst: LLVMValueRef) -> LLVMAtomicOrdering;
    pub fn LLVMSetCmpXchgSuccessOrdering(CmpXchgInst: LLVMValueRef, Ordering: LLVMAtomicOrdering);
    pub fn LLVMGetCmpXchgFailureOrdering(CmpXchgInst: LLVMValueRef) -> LLVMAtomicOrdering;
    pub fn LLVMSetCmpXchgFailureOrdering(CmpXchgInst: LLVMValueRef, Ordering: LLVMAtomicOrdering);
}

// Core->Module Providers
extern "C" {
    pub fn LLVMCreateModuleProviderForExistingModule(M: LLVMModuleRef) -> LLVMModuleProviderRef;
    pub fn LLVMDisposeModuleProvider(M: LLVMModuleProviderRef);
}

// Core->Memory Buffers
extern "C" {
    pub fn LLVMCreateMemoryBufferWithContentsOfFile(Path: *const ::libc::c_char,
                                                    OutMemBuf: *mut LLVMMemoryBufferRef,
                                                    OutMessage: *mut *mut ::libc::c_char)
                                                    -> LLVMBool;
    pub fn LLVMCreateMemoryBufferWithSTDIN(OutMemBuf: *mut LLVMMemoryBufferRef,
                                           OutMessage: *mut *mut ::libc::c_char)
                                           -> LLVMBool;
    pub fn LLVMCreateMemoryBufferWithMemoryRange(InputData: *const ::libc::c_char,
                                                 InputDataLength: ::libc::size_t,
                                                 BufferName: *const ::libc::c_char,
                                                 RequiresNullTerminator: LLVMBool)
                                                 -> LLVMMemoryBufferRef;
    pub fn LLVMCreateMemoryBufferWithMemoryRangeCopy(InputData: *const ::libc::c_char,
                                                     InputDataLength: ::libc::size_t,
                                                     BufferName: *const ::libc::c_char)
                                                     -> LLVMMemoryBufferRef;
    pub fn LLVMGetBufferStart(MemBuf: LLVMMemoryBufferRef) -> *const ::libc::c_char;
    pub fn LLVMGetBufferSize(MemBuf: LLVMMemoryBufferRef) -> ::libc::size_t;
    pub fn LLVMDisposeMemoryBuffer(MemBuf: LLVMMemoryBufferRef);
}

// Core->pass registry
extern "C" {
    pub fn LLVMGetGlobalPassRegistry() -> LLVMPassRegistryRef;
}

// Core->Pass managers
extern "C" {
    pub fn LLVMCreatePassManager() -> LLVMPassManagerRef;
    pub fn LLVMCreateFunctionPassManagerForModule(M: LLVMModuleRef) -> LLVMPassManagerRef;
    pub fn LLVMCreateFunctionPassManager(MP: LLVMModuleProviderRef) -> LLVMPassManagerRef;
    pub fn LLVMRunPassManager(PM: LLVMPassManagerRef, M: LLVMModuleRef) -> LLVMBool;
    pub fn LLVMInitializeFunctionPassManager(FPM: LLVMPassManagerRef) -> LLVMBool;
    pub fn LLVMRunFunctionPassManager(FPM: LLVMPassManagerRef, F: LLVMValueRef) -> LLVMBool;
    pub fn LLVMFinalizeFunctionPassManager(FPM: LLVMPassManagerRef) -> LLVMBool;
    pub fn LLVMDisposePassManager(PM: LLVMPassManagerRef);
}

// Core->Threading
extern "C" {
    /// Deprecated: LLVM threading is configured at compile-time with `LLVM_ENABLE_THREADS`
    pub fn LLVMStartMultithreaded() -> LLVMBool;
    /// Deprecated: LLVM threading is configured at compile-time with `LLVM_ENABLE_THREADS`
    pub fn LLVMStopMultithreaded();
    pub fn LLVMIsMultithreaded() -> LLVMBool;
}