LLVMValue.st
changeset 43 597181c496f0
parent 33 feabf14b6c1d
child 61 c2e287d54de5
equal deleted inserted replaced
42:23ae490859cd 43:597181c496f0
    67 
    67 
    68 asBasicBlock
    68 asBasicBlock
    69     "Return the underlying basic block if the value represents
    69     "Return the underlying basic block if the value represents
    70      a basic block. Otherwise raise an error"
    70      a basic block. Otherwise raise an error"
    71 
    71 
    72     self isBasicBlockValue ifFalse:[ 
    72     self isBasicBlock ifFalse:[ 
    73         self error: 'Not a basic block value'.
    73         self error: 'Not a basic block value'.
    74     ].
    74     ].
    75     ^ LLVM ValueAsBasicBlock: self
    75     ^ LLVM ValueAsBasicBlock: self
    76 
    76 
    77     "Created: / 08-08-2015 / 02:16:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    77     "Created: / 08-08-2015 / 02:16:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    78     "Modified: / 17-09-2015 / 19:25:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    78 !
    79 !
    79 
    80 
    80 asLLVMMetadata
    81 asLLVMMetadata
    81     ^ LLVMCEXT ValueAsMetadata: self
    82     ^ LLVMCEXT ValueAsMetadata: self
    82 
    83 
   137 
   138 
   138     "Created: / 11-07-2015 / 07:09:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   139     "Created: / 11-07-2015 / 07:09:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   139     "Modified: / 08-08-2015 / 04:22:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   140     "Modified: / 08-08-2015 / 04:22:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   140 ! !
   141 ! !
   141 
   142 
       
   143 !LLVMValue methodsFor:'initialization'!
       
   144 
       
   145 initialize
       
   146     self class == LLVMValue ifTrue:[ 
       
   147         self isFunction ifTrue:[ 
       
   148             self changeClassTo: LLVMFunction.
       
   149         ].
       
   150     ].
       
   151 
       
   152     "Created: / 18-09-2015 / 06:14:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   153 ! !
       
   154 
   142 !LLVMValue methodsFor:'testing'!
   155 !LLVMValue methodsFor:'testing'!
   143 
   156 
   144 isBasicBlockValue
   157 isAddrSpaceCastInst
   145     "Return true, if receiver represent a LLVMBasicBlock, i.e.,
   158 
   146      if it can be used in branch instructions as target"
   159     ^ LLVM IsAAddrSpaceCastInst: self
   147     
   160 !
   148     ^ LLVM ValueIsBasicBlock:self
   161 
   149 
   162 isAllocaInst
   150     "Created: / 08-08-2015 / 02:14:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   163 
   151 !
   164     ^ LLVM IsAAllocaInst: self
   152 
   165 !
   153 isConstantValue
   166 
   154     ^ LLVM IsConstant: self
   167 isArgument
   155 
   168 
   156     "Created: / 08-08-2015 / 02:43:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   169     ^ LLVM IsAArgument: self
   157 !
   170 !
   158 
   171 
   159 isIntegerOrIntegerVectorValue
   172 isBasicBlock
   160     ^ self type isIntegerType or:[ self type isVectorType ]
   173 
   161 
   174     ^ LLVM IsABasicBlock: self
   162     "Created: / 11-07-2015 / 14:55:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   175 !
   163     "Modified: / 07-08-2015 / 18:34:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   176 
   164 !
   177 isBinaryOperator
   165 
   178 
   166 isIntegerValue
   179     ^ LLVM IsABinaryOperator: self
   167     ^ self type isIntegerType
   180 !
   168 
   181 
   169     "Created: / 11-07-2015 / 14:55:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   182 isBitCastInst
   170     "Modified: / 03-08-2015 / 16:38:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   183 
       
   184     ^ LLVM IsABitCastInst: self
       
   185 !
       
   186 
       
   187 isBlockAddress
       
   188 
       
   189     ^ LLVM IsABlockAddress: self
       
   190 !
       
   191 
       
   192 isBranchInst
       
   193 
       
   194     ^ LLVM IsABranchInst: self
       
   195 !
       
   196 
       
   197 isCallInst
       
   198 
       
   199     ^ LLVM IsACallInst: self
       
   200 !
       
   201 
       
   202 isCastInst
       
   203 
       
   204     ^ LLVM IsACastInst: self
       
   205 !
       
   206 
       
   207 isCatchEndPadInst
       
   208 
       
   209     ^ LLVM IsACatchEndPadInst: self
       
   210 !
       
   211 
       
   212 isCatchPadInst
       
   213 
       
   214     ^ LLVM IsACatchPadInst: self
       
   215 !
       
   216 
       
   217 isCatchReturnInst
       
   218 
       
   219     ^ LLVM IsACatchReturnInst: self
       
   220 !
       
   221 
       
   222 isCleanupPadInst
       
   223 
       
   224     ^ LLVM IsACleanupPadInst: self
       
   225 !
       
   226 
       
   227 isCleanupReturnInst
       
   228 
       
   229     ^ LLVM IsACleanupReturnInst: self
       
   230 !
       
   231 
       
   232 isCmpInst
       
   233 
       
   234     ^ LLVM IsACmpInst: self
       
   235 !
       
   236 
       
   237 isConstant
       
   238 
       
   239     ^ LLVM IsAConstant: self
       
   240 !
       
   241 
       
   242 isConstantAggregateZero
       
   243 
       
   244     ^ LLVM IsAConstantAggregateZero: self
       
   245 !
       
   246 
       
   247 isConstantArray
       
   248 
       
   249     ^ LLVM IsAConstantArray: self
       
   250 !
       
   251 
       
   252 isConstantDataArray
       
   253 
       
   254     ^ LLVM IsAConstantDataArray: self
       
   255 !
       
   256 
       
   257 isConstantDataSequential
       
   258 
       
   259     ^ LLVM IsAConstantDataSequential: self
       
   260 !
       
   261 
       
   262 isConstantDataVector
       
   263 
       
   264     ^ LLVM IsAConstantDataVector: self
       
   265 !
       
   266 
       
   267 isConstantExpr
       
   268 
       
   269     ^ LLVM IsAConstantExpr: self
       
   270 !
       
   271 
       
   272 isConstantFP
       
   273 
       
   274     ^ LLVM IsAConstantFP: self
       
   275 !
       
   276 
       
   277 isConstantInt
       
   278 
       
   279     ^ LLVM IsAConstantInt: self
       
   280 !
       
   281 
       
   282 isConstantPointerNull
       
   283 
       
   284     ^ LLVM IsAConstantPointerNull: self
       
   285 !
       
   286 
       
   287 isConstantStruct
       
   288 
       
   289     ^ LLVM IsAConstantStruct: self
       
   290 !
       
   291 
       
   292 isConstantVector
       
   293 
       
   294     ^ LLVM IsAConstantVector: self
       
   295 !
       
   296 
       
   297 isDbgDeclareInst
       
   298 
       
   299     ^ LLVM IsADbgDeclareInst: self
       
   300 !
       
   301 
       
   302 isDbgInfoIntrinsic
       
   303 
       
   304     ^ LLVM IsADbgInfoIntrinsic: self
       
   305 !
       
   306 
       
   307 isExtractElementInst
       
   308 
       
   309     ^ LLVM IsAExtractElementInst: self
       
   310 !
       
   311 
       
   312 isExtractValueInst
       
   313 
       
   314     ^ LLVM IsAExtractValueInst: self
       
   315 !
       
   316 
       
   317 isFCmpInst
       
   318 
       
   319     ^ LLVM IsAFCmpInst: self
       
   320 !
       
   321 
       
   322 isFPExtInst
       
   323 
       
   324     ^ LLVM IsAFPExtInst: self
       
   325 !
       
   326 
       
   327 isFPToSIInst
       
   328 
       
   329     ^ LLVM IsAFPToSIInst: self
       
   330 !
       
   331 
       
   332 isFPToUIInst
       
   333 
       
   334     ^ LLVM IsAFPToUIInst: self
       
   335 !
       
   336 
       
   337 isFPTruncInst
       
   338 
       
   339     ^ LLVM IsAFPTruncInst: self
       
   340 !
       
   341 
       
   342 isFunction
       
   343 
       
   344     ^ LLVM IsAFunction: self
       
   345 !
       
   346 
       
   347 isGetElementPtrInst
       
   348 
       
   349     ^ LLVM IsAGetElementPtrInst: self
       
   350 !
       
   351 
       
   352 isGlobalAlias
       
   353 
       
   354     ^ LLVM IsAGlobalAlias: self
       
   355 !
       
   356 
       
   357 isGlobalObject
       
   358 
       
   359     ^ LLVM IsAGlobalObject: self
       
   360 !
       
   361 
       
   362 isGlobalValue
       
   363 
       
   364     ^ LLVM IsAGlobalValue: self
       
   365 !
       
   366 
       
   367 isGlobalVariable
       
   368 
       
   369     ^ LLVM IsAGlobalVariable: self
       
   370 !
       
   371 
       
   372 isICmpInst
       
   373 
       
   374     ^ LLVM IsAICmpInst: self
       
   375 !
       
   376 
       
   377 isIndirectBrInst
       
   378 
       
   379     ^ LLVM IsAIndirectBrInst: self
       
   380 !
       
   381 
       
   382 isInlineAsm
       
   383 
       
   384     ^ LLVM IsAInlineAsm: self
       
   385 !
       
   386 
       
   387 isInsertElementInst
       
   388 
       
   389     ^ LLVM IsAInsertElementInst: self
       
   390 !
       
   391 
       
   392 isInsertValueInst
       
   393 
       
   394     ^ LLVM IsAInsertValueInst: self
       
   395 !
       
   396 
       
   397 isInstruction
       
   398 
       
   399     ^ LLVM IsAInstruction: self
       
   400 !
       
   401 
       
   402 isIntToPtrInst
       
   403 
       
   404     ^ LLVM IsAIntToPtrInst: self
       
   405 !
       
   406 
       
   407 isIntrinsicInst
       
   408 
       
   409     ^ LLVM IsAIntrinsicInst: self
       
   410 !
       
   411 
       
   412 isInvokeInst
       
   413 
       
   414     ^ LLVM IsAInvokeInst: self
   171 !
   415 !
   172 
   416 
   173 isLLVMValue
   417 isLLVMValue
   174     ^ true
   418     ^ true
   175 
   419 
   176     "Created: / 08-08-2015 / 03:28:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   420     "Created: / 08-08-2015 / 03:28:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   421 !
       
   422 
       
   423 isLandingPadInst
       
   424 
       
   425     ^ LLVM IsALandingPadInst: self
       
   426 !
       
   427 
       
   428 isLoadInst
       
   429 
       
   430     ^ LLVM IsALoadInst: self
       
   431 !
       
   432 
       
   433 isMDNode
       
   434 
       
   435     ^ LLVM IsAMDNode: self
       
   436 !
       
   437 
       
   438 isMDString
       
   439 
       
   440     ^ LLVM IsAMDString: self
       
   441 !
       
   442 
       
   443 isMemCpyInst
       
   444 
       
   445     ^ LLVM IsAMemCpyInst: self
       
   446 !
       
   447 
       
   448 isMemIntrinsic
       
   449 
       
   450     ^ LLVM IsAMemIntrinsic: self
       
   451 !
       
   452 
       
   453 isMemMoveInst
       
   454 
       
   455     ^ LLVM IsAMemMoveInst: self
       
   456 !
       
   457 
       
   458 isMemSetInst
       
   459 
       
   460     ^ LLVM IsAMemSetInst: self
       
   461 !
       
   462 
       
   463 isPHINode
       
   464 
       
   465     ^ LLVM IsAPHINode: self
       
   466 !
       
   467 
       
   468 isPtrToIntInst
       
   469 
       
   470     ^ LLVM IsAPtrToIntInst: self
       
   471 !
       
   472 
       
   473 isResumeInst
       
   474 
       
   475     ^ LLVM IsAResumeInst: self
       
   476 !
       
   477 
       
   478 isReturnInst
       
   479 
       
   480     ^ LLVM IsAReturnInst: self
       
   481 !
       
   482 
       
   483 isSExtInst
       
   484 
       
   485     ^ LLVM IsASExtInst: self
       
   486 !
       
   487 
       
   488 isSIToFPInst
       
   489 
       
   490     ^ LLVM IsASIToFPInst: self
       
   491 !
       
   492 
       
   493 isSelectInst
       
   494 
       
   495     ^ LLVM IsASelectInst: self
       
   496 !
       
   497 
       
   498 isShuffleVectorInst
       
   499 
       
   500     ^ LLVM IsAShuffleVectorInst: self
       
   501 !
       
   502 
       
   503 isStoreInst
       
   504 
       
   505     ^ LLVM IsAStoreInst: self
       
   506 !
       
   507 
       
   508 isSwitchInst
       
   509 
       
   510     ^ LLVM IsASwitchInst: self
       
   511 !
       
   512 
       
   513 isTerminatePadInst
       
   514 
       
   515     ^ LLVM IsATerminatePadInst: self
       
   516 !
       
   517 
       
   518 isTerminatorInst
       
   519 
       
   520     ^ LLVM IsATerminatorInst: self
       
   521 !
       
   522 
       
   523 isTruncInst
       
   524 
       
   525     ^ LLVM IsATruncInst: self
       
   526 !
       
   527 
       
   528 isUIToFPInst
       
   529 
       
   530     ^ LLVM IsAUIToFPInst: self
       
   531 !
       
   532 
       
   533 isUnaryInstruction
       
   534 
       
   535     ^ LLVM IsAUnaryInstruction: self
       
   536 !
       
   537 
       
   538 isUndefValue
       
   539 
       
   540     ^ LLVM IsAUndefValue: self
       
   541 !
       
   542 
       
   543 isUnreachableInst
       
   544 
       
   545     ^ LLVM IsAUnreachableInst: self
       
   546 !
       
   547 
       
   548 isUser
       
   549 
       
   550     ^ LLVM IsAUser: self
       
   551 !
       
   552 
       
   553 isVAArgInst
       
   554 
       
   555     ^ LLVM IsAVAArgInst: self
       
   556 !
       
   557 
       
   558 isZExtInst
       
   559 
       
   560     ^ LLVM IsAZExtInst: self
   177 ! !
   561 ! !
   178 
   562 
   179 !LLVMValue class methodsFor:'documentation'!
   563 !LLVMValue class methodsFor:'documentation'!
   180 
   564 
   181 version_HG
   565 version_HG