summaryrefslogtreecommitdiff
path: root/node/LiteralNode.cc
diff options
context:
space:
mode:
authorNagi5Yeq <wu@x-nagi.com>2020-05-15 21:16:26 +0800
committerNagi5Yeq <wu@x-nagi.com>2020-05-15 21:16:26 +0800
commit41f6e75e3f26bdcccfcb3910f202452e14653826 (patch)
tree0076a928d4ac9737f8b83b7b6b0c055e5ff4f46a /node/LiteralNode.cc
parentd80958f987790f533f5048c2e0e8a1cd5fd9f5a1 (diff)
basic support of types
Diffstat (limited to 'node/LiteralNode.cc')
-rw-r--r--node/LiteralNode.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/node/LiteralNode.cc b/node/LiteralNode.cc
index 1e9c4b7..fedeb36 100644
--- a/node/LiteralNode.cc
+++ b/node/LiteralNode.cc
@@ -6,7 +6,7 @@
namespace pcc {
template <> Value BooleanLiteralNode::CodeGen() {
- llvm::LLVMContext& context = driver_->GetModule()->getContext();
+ llvm::LLVMContext& context = context_->GetModule()->getContext();
if (value_ == true) {
return llvm::ConstantInt::getTrue(context);
} else {
@@ -15,19 +15,19 @@ template <> Value BooleanLiteralNode::CodeGen() {
}
template <> Value IntegerLiteralNode::CodeGen() {
- llvm::LLVMContext& context = driver_->GetModule()->getContext();
+ llvm::LLVMContext& context = context_->GetModule()->getContext();
llvm::APInt value(32, (uint64_t) value_, true);
return llvm::ConstantInt::get(context, value);
}
template <> Value RealLiteralNode::CodeGen() {
- llvm::LLVMContext& context = driver_->GetModule()->getContext();
+ llvm::LLVMContext& context = context_->GetModule()->getContext();
llvm::APFloat value(value_);
return llvm::ConstantFP::get(context, value);
}
template <> Value StringLiteralNode::CodeGen() {
- llvm::Module* module = driver_->GetModule();
+ llvm::Module* module = context_->GetModule();
llvm::LLVMContext& context = module->getContext();
llvm::Constant* str = llvm::ConstantDataArray::getString(context, value_);
llvm::Type* type = str->getType();