Skip to content

Commit

Permalink
[llvm] Bind LLVM::Value.isAFoo methods.
Browse files Browse the repository at this point in the history
TODO: rename them to more perlish style similar as in LLVM::Builder.
  • Loading branch information
bacek authored and Reini Urban committed Oct 2, 2012
1 parent 529a8c6 commit 0c7ed05
Showing 1 changed file with 88 additions and 0 deletions.
88 changes: 88 additions & 0 deletions runtime/parrot/library/LLVM/Value.pm
Expand Up @@ -17,6 +17,94 @@ class LLVM::Value is LLVM::Opaque {
method dump() {
LLVM::call("DumpValue", self);
}

INIT {
my @types := <
Argument
BasicBlock
InlineAsm
User
Constant
ConstantAggregateZero
ConstantArray
ConstantExpr
ConstantFP
ConstantInt
ConstantPointerNull
ConstantStruct
ConstantVector
GlobalValue
Function
GlobalAlias
GlobalVariable
UndefValue
Instruction
BinaryOperator
CallInst
IntrinsicInst
DbgInfoIntrinsic
DbgDeclareInst
EHSelectorInst
MemIntrinsic
MemCpyInst
MemMoveInst
MemSetInst
CmpInst
FCmpInst
ICmpInst
ExtractElementInst
GetElementPtrInst
InsertElementInst
InsertValueInst
PHINode
SelectInst
ShuffleVectorInst
StoreInst
TerminatorInst
BranchInst
InvokeInst
ReturnInst
SwitchInst
UnreachableInst
UnwindInst
UnaryInstruction
AllocaInst
CastInst
BitCastInst
FPExtInst
FPToSIInst
FPToUIInst
FPTruncInst
IntToPtrInst
PtrToIntInst
SExtInst
SIToFPInst
TruncInst
UIToFPInst
ZExtInst
ExtractValueInst
LoadInst
VAArgInst
>;

my $HOW := LLVM::Value.HOW;
my $WHAT := LLVM::Value.WHAT;

for @types {
$HOW.add_method(
"isA$_",
multi method () {
LLVM::Value.create(
LLVM::call("IsA$_", self)
)
},
to => $WHAT
);
}
}

}



# vim: ft=perl6

0 comments on commit 0c7ed05

Please sign in to comment.