summaryrefslogtreecommitdiff
path: root/node/LiteralNode.cc
diff options
context:
space:
mode:
authorNagi5Yeq <wu@x-nagi.com>2020-06-03 02:36:05 +0800
committerNagi5Yeq <wu@x-nagi.com>2020-06-03 02:36:05 +0800
commit2d6ab4b7f207a746a7caaa93466b410cbe328626 (patch)
tree570a2d7776e616309149adf065acc474c0c0de98 /node/LiteralNode.cc
parentcd1466f30c146e12faa0db7e1b53b508bf2274c6 (diff)
support for short, int64 and AST dump
Diffstat (limited to 'node/LiteralNode.cc')
-rw-r--r--node/LiteralNode.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/node/LiteralNode.cc b/node/LiteralNode.cc
index 43bddb6..2c5d6c6 100644
--- a/node/LiteralNode.cc
+++ b/node/LiteralNode.cc
@@ -5,7 +5,8 @@
#include "LiteralNode.hh"
namespace pcc {
-template <> Value BooleanLiteralNode::CodeGen() {
+template <>
+Value BooleanLiteralNode::CodeGen() {
if (value_ == true) {
return llvm::ConstantInt::getTrue(GlobalLLVMContext);
} else {
@@ -13,15 +14,18 @@ template <> Value BooleanLiteralNode::CodeGen() {
}
}
-template <> Value CharLiteralNode::CodeGen() {
+template <>
+Value CharLiteralNode::CodeGen() {
return llvm::ConstantInt::get(type_->GetLLVMType(), value_, true);
}
-template <> Value IntegerLiteralNode::CodeGen() {
+template <>
+Value IntegerLiteralNode::CodeGen() {
return llvm::ConstantInt::get(type_->GetLLVMType(), value_, true);
}
-template <> Value RealLiteralNode::CodeGen() {
+template <>
+Value RealLiteralNode::CodeGen() {
llvm::APFloat value(value_);
return llvm::ConstantFP::get(GlobalLLVMContext, value);
}